capybara.rb 728 Bytes
Newer Older
1
require 'capybara-screenshot/spinach'
2

3
# Give CI some extra time
4
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
5

6 7 8 9 10 11
Capybara.javascript_driver = :chrome
Capybara.register_driver :chrome do |app|
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    'chromeOptions' => {
      'args' => %w[headless no-sandbox disable-gpu]
    }
12
  )
13 14 15

  Capybara::Selenium::Driver
    .new(app, browser: :chrome, desired_capabilities: capabilities)
16 17
end

18
Capybara.default_max_wait_time = timeout
19 20
Capybara.ignore_hidden_elements = false

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

Spinach.hooks.before_run do
25
  TestEnv.eager_load_driver_server
26
end