I have this combo running (followed instructions on
http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium),
but I'm getting lots of failures in my features because Webrat will
click a button (say), then immediately check the next Then step
(assertion) before the browser has followed the link and gone to the
next page. For example:
And I press "Create" #
features/step_definitions/webrat_steps.rb:14
Then I should be on the Foo Profile: my_new_profile page #
features/step_definitions/webrat_steps.rb:117
expected: "/profiles/19",
got: "/spaces/Foo/profiles/new" (using ==)
But the browser was on the way to /profiles/19, just hadn't made it
there yet.
This happens with form buttons and with regular links.
I've already added a step that I thought would cause it to wait, and
it helped somewhat, but not fully.
Then /^I should be on (.+)$/ do |page_name|
response.should contain(/./) # make webrat wait for some response to
come
URI.parse(current_url).path.should == path_to(page_name)
end