capybara.rb 696 Bytes
Newer Older
1
require 'capybara/poltergeist'
2
require 'capybara-screenshot/spinach'
3

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

7 8
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
9 10 11 12 13 14 15 16 17
  Capybara::Poltergeist::Driver.new(
    app,
    js_errors: true,
    timeout: timeout,
    window_size: [1366, 768],
    phantomjs_options: [
      '--load-images=no'
    ]
  )
18 19
end

20
Capybara.default_max_wait_time = timeout
21 22
Capybara.ignore_hidden_elements = false

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

Spinach.hooks.before_run do
27
  TestEnv.eager_load_driver_server
28
end