debian-mirror-gitlab/features/support/capybara.rb

25 lines
723 B
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
require 'spinach/capybara'
require 'capybara/poltergeist'
# Give CI some extra time
2015-12-23 02:04:40 +05:30
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 15
2015-09-11 14:41:01 +05:30
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
2016-04-02 18:10:28 +05:30
Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout, window_size: [1366, 768])
2015-09-11 14:41:01 +05:30
end
2016-06-02 11:05:42 +05:30
Capybara.default_max_wait_time = timeout
2015-09-11 14:41:01 +05:30
Capybara.ignore_hidden_elements = false
unless ENV['CI'] || ENV['CI_SERVER']
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
end
2016-04-02 18:10:28 +05:30
Spinach.hooks.before_run do
2016-11-03 12:29:30 +05:30
TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER']
2016-04-02 18:10:28 +05:30
end