bbe0fa91d0
The problem occurred because asset compilation takes a long time, so when the asset cache didn't exist and the first test ran, it would often (randomly) time out during the generation before the actual test even had a chance to run. Now we check if the cache exists before the suite runs, and if not, we manually fire a request to the root URL in order to generate it. This should allow subsequent tests to use the cached assets.
27 lines
711 B
Ruby
27 lines
711 B
Ruby
require 'capybara/rails'
|
|
require 'capybara/rspec'
|
|
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
|
|
|
|
Capybara.default_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
|
|
|
|
RSpec.configure do |config|
|
|
config.before(:suite) do
|
|
TestEnv.warm_asset_cache
|
|
end
|
|
end
|