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

31 lines
801 B
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
require 'capybara/poltergeist'
2017-08-17 22:00:37 +05:30
require 'capybara-screenshot/spinach'
2015-09-11 14:41:01 +05:30
# Give CI some extra time
2017-08-17 22:00:37 +05:30
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
2015-09-11 14:41:01 +05:30
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
2017-08-17 22:00:37 +05:30
Capybara::Poltergeist::Driver.new(
app,
js_errors: true,
timeout: timeout,
window_size: [1366, 768],
2017-09-10 17:25:29 +05:30
url_whitelist: %w[localhost 127.0.0.1],
url_blacklist: %w[.mp4 .png .gif .avi .bmp .jpg .jpeg],
2017-08-17 22:00:37 +05:30
phantomjs_options: [
2017-09-10 17:25:29 +05:30
'--load-images=yes'
2017-08-17 22:00:37 +05:30
]
)
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
2017-08-17 22:00:37 +05:30
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
2016-04-02 18:10:28 +05:30
Spinach.hooks.before_run do
2017-08-17 22:00:37 +05:30
TestEnv.eager_load_driver_server
2016-04-02 18:10:28 +05:30
end