capybara.rb 694 Bytes
Newer Older
1 2 3
require 'spinach/capybara'
require 'capybara/poltergeist'

4 5 6
# Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10

7 8
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
9
  Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout)
10 11 12 13 14 15
end

Spinach.hooks.on_tag("javascript") do
  Capybara.current_driver = Capybara.javascript_driver
end

16
Capybara.default_wait_time = timeout
17 18
Capybara.ignore_hidden_elements = false

19 20
unless ENV['CI'] || ENV['CI_SERVER']
  require 'capybara-screenshot/spinach'
21

22 23 24
  # Keep only the screenshots generated from the last failing test suite
  Capybara::Screenshot.prune_strategy = :keep_last_run
end