BigW Consortium Gitlab

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

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

7 8
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
9
  Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout, window_size: [1366, 768])
10 11
end

12
Capybara.default_max_wait_time = timeout
13 14
Capybara.ignore_hidden_elements = false

15 16
unless ENV['CI'] || ENV['CI_SERVER']
  require 'capybara-screenshot/spinach'
17

18 19 20
  # Keep only the screenshots generated from the last failing test suite
  Capybara::Screenshot.prune_strategy = :keep_last_run
end
21 22

Spinach.hooks.before_run do
23
  TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER']
24
end