jnicklas/capybara — Issue #655: Is it possible to detect an incorrect redirect?
Author: justin808
Created: 2012-03-02 09:00:05+00:00
State: open

Posted this issue: http://stackoverflow.com/questions/9530414/capybara-timing-issue

Capybara intelligently waits to keep the sequence of test commands in sync with the UI. However, I've got a false positive from the following:

1. Fill in value to input field
2. Click link that incorrectly redirects to same page, wiping out previous value
3. Test checks value of the field. Since the redirect has not come back yet, the old value is still there, recording a false positive.

I was wondering if there is a way correctly test this case, **ensuring that incorrect case is caught**. Not surprisingly, when the code is fixed to use an ajax call, the test passes.

A more direct way to the test would be to assert that the page did not redirect after clicking the link.