I have a page on my site that I am trying to check, which requires the user to spend at least five seconds on the page before continuing. Is there a way with Capybara that my cucumber tests stop on this page and wait five seconds before proceeding to the next step that I am describing?
I have this in my step definitions:
Given /^I wait for (\d+) seconds?$/ do |n| sleep(n.to_i) end
In your function:
Given I am on the whatever page And I wait for 5 seconds And I follow "A Link" # etc...
It would also be great to define a dynamic unit of time like this:
Given /^I wait for (\d+) (second|minute|hour)s?$/ do |n, unit| sleep(eval("#{n.to_i}.#{unit}")) end