Testing window.location with capybara
Capybara does not follow redirect if the page is changing due to a change in window.location. This is typical in backbone apps.
In capybara current_path
only changes after an HTTP redirect.
As a workaround, you can test the content of the destination page.
For example, when writing cucumber steps, if the other page has a "browse" label, you can test it with:
Then I should see "browse"
Instead of:
Then I should be on the browse page
Written by Fabrizio Regini
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#