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

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

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

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

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

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