I'm very new to cucumber/capybara/ruby, trying BDD on a php-built website.
Checking on:
Different links directs a user to the correct page on : "prod-integration-mycompany.com"
Situation:
on this page I've got some unique links(around 20 to 50) and the links look something like,
<a href= " /edition/123456"> BookTitle 01 by <a class="author" title= "Dan Romio" href=" >/author/Dan+Romio/112212">Dan Romio</a>' <a href= " /edition/654321"> BookTitle 02 by <a class="author" title= "Maggi Smith" href=" >/author/Maggi+Smith/11332">Maggi Smith</a> <a href= " /edition/56232"> BookTitle 03 by <a class="author" title= "Dan Romio" href=" >/author/Dan+Romio/112212">Dan Romio</a> etc…
What I want to check:
I want to check when a user clicks on an edition link, the of that page matches BookTittle. I can do it one by one on my steps
When …… within(:css, 'dd[@id = "(css ID here)"]') do click_on '' or click_link (name of the link) end end Then ………|text| check_destination(text) end
on env.rb, I've got some functions like "check_destination()" and different asserts:
def check_destination(paramText) new_window = page.driver.browser.window_handles.last page.within_window new_window do path = URI.parse(current_url) assert_include(paramText,path) end end
So ? What's the problem ?:
Problem is when I wanna do a whole bunch of them, I don't know how I'm gonna use array's key=> value and loop through them on my steps. Is it Table, is it class, I kind of running out of concept/ideas here…any idea ? link ? And btw sorry if I waste your time. Thanks.