Whenever we'd run the full cucumber suite we found that were not timing out if they couldn't find a particular element on the page.

For us, the problem was to do with Timecop.

You see, we're using Timecop in our features like this:

  # in features/cucumber_feature.feature
  Given the date is "21 June 2010"
  # in features/step_definitions/time_steps.rb
  Given /^the (date|time) is (.+)$/ do |_,string|

This is great, because it allows us to fix the time to whenever we want. And because we use Chronic we can use natural language.

However, because this messes with time, the time outs weren't getting called properly! The easy fix was to put this in our a file in the features/support directory:

  # in features/support/hooks.rb
  After do 

This gets called after every scenario and sets the time back to normal, thus removing the timeout bug.

Need to find a lawyer for your business? Get in touch with my company Lexoo and we'll find you a great one for free.