diff --git a/Gemfile b/Gemfile index 3bb4a2cfb..74855b08f 100644 --- a/Gemfile +++ b/Gemfile @@ -172,6 +172,7 @@ group :development, :test do # test frameworks gem 'rails-controller-testing' gem 'rspec-rails' + gem 'rspec-retry' gem 'shoulda-matchers' gem 'test-unit' diff --git a/Gemfile.lock b/Gemfile.lock index 1f8a367db..e69868713 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -458,6 +458,8 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) + rspec-retry (0.6.2) + rspec-core (> 3.3) rspec-support (3.11.0) rszr (0.5.2) rubocop (1.26.0) @@ -673,6 +675,7 @@ DEPENDENCIES rchardet (>= 1.8.0) redis rspec-rails + rspec-retry rszr (= 0.5.2) rubocop rubocop-faker diff --git a/spec/support/capybara/driven_by.rb b/spec/support/capybara/driven_by.rb index 2e0e379a7..a79122a7b 100644 --- a/spec/support/capybara/driven_by.rb +++ b/spec/support/capybara/driven_by.rb @@ -61,7 +61,8 @@ RSpec.configure do |config| # WebMock makes it impossible to have persistent http connections to Selenium, # which may cause overhead and Net::OpenTimeout errors. WebMock.disable! if !use_vcr - example.run + # rspec-retry + example.run_with_retry retry: 3, exceptions_to_retry: [Net::OpenTimeout, Net::ReadTimeout] WebMock.enable! if !use_vcr end end diff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rb new file mode 100644 index 000000000..d9b4662b0 --- /dev/null +++ b/spec/support/rspec_retry.rb @@ -0,0 +1,11 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +require 'rspec/retry' + +RSpec.configure do |config| + # show retry status in spec process + config.verbose_retry = true + # show exception that triggers a retry if verbose_retry is set to true + config.display_try_failure_messages = true + # The list of exceptions to fail on should be configured in the individual :run_with_retry calls. +end