summaryrefslogtreecommitdiff
path: root/spec/support/capybara.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r--spec/support/capybara.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 16d5f2bf0b8..b8ca8f22a3d 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -1,9 +1,11 @@
+# rubocop:disable Style/GlobalVars
require 'capybara/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
+require 'capybara-screenshot/rspec'
# Give CI some extra time
-timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
+timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
@@ -21,15 +23,14 @@ end
Capybara.default_max_wait_time = timeout
Capybara.ignore_hidden_elements = true
-unless ENV['CI'] || ENV['CI_SERVER']
- require 'capybara-screenshot/rspec'
-
- # Keep only the screenshots generated from the last failing test suite
- Capybara::Screenshot.prune_strategy = :keep_last_run
-end
+# Keep only the screenshots generated from the last failing test suite
+Capybara::Screenshot.prune_strategy = :keep_last_run
RSpec.configure do |config|
- config.before(:suite) do
- TestEnv.warm_asset_cache
+ config.before(:context, :js) do
+ next if $capybara_server_already_started
+
+ TestEnv.eager_load_driver_server
+ $capybara_server_already_started = true
end
end