diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-29 04:45:03 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-29 04:56:49 +0300 |
commit | bbe0fa91d01fb9bc70d54e07ee393e857d92a267 (patch) | |
tree | 28a17f7488b87ff7aae0d91b1aca1a0834c51184 /features/support/capybara.rb | |
parent | 2b1ddb0f807b328aae00b1d9b0fb7f62e8adbe59 (diff) |
Prevent transient Capybara timeouts during feature tests
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.
Diffstat (limited to 'features/support/capybara.rb')
-rw-r--r-- | features/support/capybara.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/features/support/capybara.rb b/features/support/capybara.rb index 4156c7ec484..38069ff8835 100644 --- a/features/support/capybara.rb +++ b/features/support/capybara.rb @@ -9,10 +9,6 @@ Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout) end -Spinach.hooks.on_tag("javascript") do - Capybara.current_driver = Capybara.javascript_driver -end - Capybara.default_wait_time = timeout Capybara.ignore_hidden_elements = false @@ -22,3 +18,7 @@ unless ENV['CI'] || ENV['CI_SERVER'] # Keep only the screenshots generated from the last failing test suite Capybara::Screenshot.prune_strategy = :keep_last_run end + +Spinach.hooks.before_run do + TestEnv.warm_asset_cache +end |