summaryrefslogtreecommitdiff
path: root/features/support/capybara.rb
blob: aaec9a6ece72417838fd2184fb4d481ff91f94c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spinach/capybara'
require 'capybara/poltergeist'

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

Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout)
end

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

Capybara.default_wait_time = timeout
Capybara.ignore_hidden_elements = false

require 'capybara-screenshot/spinach'

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