Skip to content

Commit 77a430b

Browse files
committed
added rspec-retry in order to resolve flaky specs
1 parent 38941c0 commit 77a430b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

spec/spec_helper.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,28 @@
3838

3939
require 'pry'
4040

41+
require 'rspec/retry'
42+
43+
4144
RSpec.configure do |config|
45+
# repeat flaky tests
46+
# show retry status in spec process
47+
config.verbose_retry = true
48+
# show exception that triggers a retry if verbose_retry is set to true
49+
config.display_try_failure_messages = true
50+
51+
# run retry only on features
52+
config.around :each, :js do |ex|
53+
ex.run_with_retry retry: 5
54+
end
55+
56+
# callback to be run between retries
57+
config.retry_callback = proc do |ex|
58+
# run some additional clean up task - can be filtered by example metadata
59+
if ex.metadata[:js]
60+
Capybara.reset!
61+
end
62+
end
4263
# config.include Capybara::DSL
4364
# rspec-expectations config goes here. You can use an alternate
4465
# assertion/expectation library such as wrong or the stdlib/minitest

0 commit comments

Comments
 (0)