In the last weeks, as a low priority task, I ported our rails app from 2.3.4 to 2.3.11.
The process went well, I updated all gems, fixed all warnings and all our cucumber, spec, unit, function, integration tests… easy stuffs.
BUT we have also some selenium tests that cover ajax interactions and some critical scenario for our app, so I started to check if everything was fine there also and that was the start of my odyssey.
To make a long story short here are the steps I followed to find the problem:
running the tests I was receiving:
Webrat::TimeoutError: Timeout exceeded (after 5 sec)
webrat (0.7.3) lib/webrat/selenium/selenium_session.rb:189:in `wait_for'
webrat (0.7.3) lib/webrat/selenium.rb:62:in `wait_for'
basically it cannot verify the user is correctly logged in.
I thought it was a cookie/session problem because I saw it was able to find the given user so I put a “debugger” to be able to use the firefox in the middle of the test and check the response headers. No session cookie was present after log in.
Using script/server everything was fine… so what’s the problem, it should be in the way webrat starts mongrel so I looked in the webrat source to find in which way it starts mongrel.
I started mongrel directly from the terminal and as soon as it was up & running visiting the homepage I got these errors in the console:
Fri Jun 16 13:21:12 +0200 2011: Error calling Dispatcher.dispatch #
Bingo! from here it was easy to ask google for a solution “mongrel_server rails 2.3.11 cookies” and it pointed me to this post that have the solution:
Now it’s time to move to rails 3.0.9!!!