Question

I am in the process of trying to upgrade my app from Rails 3.2.15 to Rails 4.0.3 and am running my integration test suite with Cucumber (1.3.10), Cucumber-Rails (1.4.0) and Capybara (2.2.1).

Tests for functionality that utilise Session which did pass in Rails 3.2 are now failing under Rails 4.

I do the following:

1) Browse to a form with a dropdown which defaults to the first row 2) Change the dropdown to a different row, the value of which is stored in Session 3) Access another page 4) Return to the original page and verify that the dropdown has the value selected in Step 2 and not the default. This functionality is handled in the code by accessing the session variable.

If I test the feature manually, it works as expected and the dropdown has the correct value. If I step through the Scenario with Cucumber (using tip in http://itshouldbeuseful.wordpress.com/tag/capybara/), as above, all good It is only when I run Cucumber in "automated mode" then I can see, using Selenium and the @javascript tag that the dropdown shows the default value when I return to the page and not the selected value

My test steps for checking that the session has been set correctly pass, and debug statements confirm this.

Debug statements also confirm that in automated mode the original dropdown value is seemingly retained in the session when I return to the page. Debug statements also confirm that the correct value is retained when manually stepping through. I tried adding sleeps between all relevant steps which made no difference in automated mode.

What on earth can be going on? I cant see what can be different between normal site operation (which works), step-by-step Cucumber (which works) and automated Cucumber (which fails).

Much Googling has not revealed anything to go on as I am not redirecting or changing host in the steps and this problem seems to have only been introduced in Rails 4.

To be fair I have also upgraded Cucumber and Capybara gems and so will test to see if one of those gem upgrades is the culprit (which would offer me a way back) but I really need to try to move forward with this at some stage.

Thanks in advance.

EDIT: I have now worked out that the problem lies with selenium-webdriver 2.40.0 as my tests pass with the selenium-webdriver gem version I was using with Rails 3.2 (2.37.0) and up to 2.39.0 but fails with 2.40.0 (and Cucumber (1.3.10), Cucumber-Rails (1.4.0) and Capybara (2.2.1)). I will lodge as a defect against selenium-webdriver.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top