Reputation: 81
I'm using Cucumber and running BDD tests.
I'm unsure how to test that I stay on the same page. Suggestions are appreciated.
Upvotes: 2
Views: 129
Reputation: 17657
"Staying on the same page" doesn't seem valuable to me. As a user, I don't care that I stay on the same page.
I might care that, for instance, if I was looking at my basket, when I finish , I am still looking at my basket.
If I'm looking at an Acme 2000 Super Widget, when I finish, I'm still looking at the Acme 2000 Super Widget.
I often find a lot of BDD problems can be answered if I ask, "Can you give me an example of that?" So, can you give me an example of a page that you might want to stay on?
Those specific examples end up being scenarios. Your rule, "should stay on the same page", can go in the explanation at the top of the feature file to explain the examples below.
Upvotes: 2
Reputation: 1506
If you aren't using a one page app then you should just be able to assert based on the url. If you are using watir then
assert_equal 'http://www.yourpage.com', @browser.url
If you are using a different framework then there will be an equivalent.
Upvotes: 0