Reputation: 61
We have a large test suite (full build usually takes 15 minutes to run) that 2 days ago started timing out and we have not been able to run a full build since then. I added a config to the rails_helper to force specs to fail if they take too long to run:
config.around(:each) do |example|
Timeout::timeout(10) {
example.run
}
end
We finally ran a full build yesterday with this config, but with over 60 failed specs! The specs run, and pass, in isolation.
Our DatabaseCleaner is set as follows:
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.use_transactional_fixtures = false
In specs that have been generally flakey, we have a few sleeps.
Unfortunately when I run the build and watch the test logs, nothing interesting is outputted to help me debug.
I think the last noteworthy information is our gemfile setup. Here are our test group gems:
group :test do
gem 'capybara-screenshot', '1.0.10'
gem 'capybara', '2.4.4'
gem 'rspec-rails', '3.2.0'
gem 'capybara-webkit', '1.3.1'
gem 'launchy', '2.4.3'
gem 'selenium-webdriver', '2.46.2'
gem 'database_cleaner', '1.3.0'
end
Has anybody experienced issues like this before?
THANK YOU in advance!!
Upvotes: 4
Views: 560
Reputation: 61
Whelp, it turned out that updating all the test gems and adding the following line to our rails_helper was the answer:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
I unfortunately am not clear as to why this was our fix but the build completed for the first time in 2 days.
Upvotes: 1