Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 816f3de

Browse files
Fix Net::ReadTimeout error on the first Capybara test run
1 parent 16e770c commit 816f3de

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

‎Gemfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ end
8787
group :test do
8888
gem "coveralls", require: false
8989
gem "rspec-rails"
90+
gem "rspec-retry"
9091
gem "capybara"
9192
gem "capybara-screenshot"
9293
gem "selenium-webdriver"

‎Gemfile.lock‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ GEM
229229
rspec-expectations (~> 3.4.0)
230230
rspec-mocks (~> 3.4.0)
231231
rspec-support (~> 3.4.0)
232+
rspec-retry (0.4.5)
233+
rspec-core
232234
rspec-support (3.4.1)
233235
rubocop (0.35.1)
234236
astrolabe (~> 1.3)
@@ -350,6 +352,7 @@ DEPENDENCIES
350352
rails_12factor
351353
react_on_rails
352354
rspec-rails
355+
rspec-retry
353356
rubocop
354357
ruby-lint
355358
sass-rails

‎spec/rails_helper.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
end
7575
end
7676

77-
Capybara.default_wait_time = 15
77+
Capybara.default_max_wait_time = 15
7878
puts "Capybara using driver: #{Capybara.javascript_driver}"
7979

8080
Capybara::Screenshot.prune_strategy = { keep: 10 }

‎spec/spec_helper.rb‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
# users commonly want.
1717
#
1818
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19+
20+
require "rspec/retry"
21+
1922
RSpec.configure do |config|
2023
# rspec-expectations config goes here. You can use an alternate
2124
# assertion/expectation library such as wrong or the stdlib/minitest
@@ -29,6 +32,14 @@
2932
# ...rather than:
3033
# # => "be bigger than 2"
3134
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35+
36+
### Fix Net::ReadTimeout error on first test
37+
# Show retry status in spec process
38+
config.verbose_retry = true
39+
# Try twice (retry once)
40+
config.default_retry_count = 2
41+
# Only retry when Selenium raises Net::ReadTimeout
42+
config.exceptions_to_retry = [Net::ReadTimeout]
3243
end
3344

3445
# rspec-mocks config goes here. You can use an alternate test double

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /