Commit e559283c authored by Rémy Coutable's avatar Rémy Coutable

Increase Capybara's timeout

Also disabled assets warming for Capybara/RSpec and remove a check to
skip assets warming when ./tmp/cache/assets/test exists because assets
are now served by webpack-dev-server.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent acc2a03d
...@@ -3,7 +3,7 @@ require 'capybara/poltergeist' ...@@ -3,7 +3,7 @@ require 'capybara/poltergeist'
require 'capybara-screenshot/spinach' require 'capybara-screenshot/spinach'
# Give CI some extra time # Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10 timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 40 : 10
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app| Capybara.register_driver :poltergeist do |app|
......
...@@ -4,7 +4,7 @@ require 'capybara/poltergeist' ...@@ -4,7 +4,7 @@ require 'capybara/poltergeist'
require 'capybara-screenshot/rspec' require 'capybara-screenshot/rspec'
# Give CI some extra time # Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10 timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 40 : 10
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app| Capybara.register_driver :poltergeist do |app|
...@@ -27,6 +27,6 @@ Capybara::Screenshot.prune_strategy = :keep_last_run ...@@ -27,6 +27,6 @@ Capybara::Screenshot.prune_strategy = :keep_last_run
RSpec.configure do |config| RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
TestEnv.warm_asset_cache TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER']
end end
end end
...@@ -170,17 +170,11 @@ module TestEnv ...@@ -170,17 +170,11 @@ module TestEnv
# Otherwise they'd be created by the first test, often timing out and # Otherwise they'd be created by the first test, often timing out and
# causing a transient test failure # causing a transient test failure
def warm_asset_cache def warm_asset_cache
return if warm_asset_cache?
return unless defined?(Capybara) return unless defined?(Capybara)
Capybara.current_session.driver.visit '/' Capybara.current_session.driver.visit '/'
end end
def warm_asset_cache?
cache = Rails.root.join(*%w(tmp cache assets test))
Dir.exist?(cache) && Dir.entries(cache).length > 2
end
private private
def factory_repo_path def factory_repo_path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment