Posted about 10 years ago. Visible to the public. Repeats.

Why your Cucumber feature loses cookies when run under Selenium

When your Cucumber feature seems to forget cookies / sessions when you run it with Selenium check if the test travels in time like here:

Given the date is 2017-10-20 When I sign in Then I should see "Welcome!"

What happens here is that the Rails application serving pages runs in 2017, but the process running your Firefox or Webkit still lives today. This huge gap in time will expire most Cookies immediately.

If all you need is to freeze the time to a date, a workaround is to travel to the future instead.

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Henning Koch
Last edit:
5 days ago
by Henning Koch
timecop, expiration, timeout, timed, out
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more