# On the CI box we have seen intermittent failures.
# We think this may be due to timeouts (the default is 2 secs),
# so we've increased the default timeout.
Capybara.default_wait_time = 5

# On the CI box we have seen intermittent failures.
# We think this may be due to timeouts (the default is 2 secs),
# so we've increased the default timeout.
Capybara.default_wait_time = 5

module ScreenshotHelper
  def screenshot(name = 'capybara')
    page.driver.render(File.join(Rails.root, 'tmp', "#{name}.png"), full: true)
  end
end

World(ScreenshotHelper)

Add screenshot helper for cucumber @javascript scenarios
Add screenshot helper for cucumber @javascript scenarios

Call `screenshot` within a Cucumber step and Poltergeist (the capybara
driver) will create a tmp/capybara.png file containing a screenshot of
the current page. Pass an argument to give the screenshot a different
name.

Useful when debugging failing steps.
