Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow SAUCE_DISABLE_RETRY env variable to disable Capybara retrying

This should help @santiycr and I debug errors in the Sauce service itself
  • Loading branch information...
commit 5832b80ff63f958a558d7037e6331de92cee9cf9 1 parent 2534c0b
@rtyler authored
Showing with 25 additions and 0 deletions.
  1. +7 −0 lib/sauce/capybara.rb
  2. +18 −0 spec/sauce/capybara_spec.rb
View
7 lib/sauce/capybara.rb
@@ -27,6 +27,13 @@ class Driver < ::Capybara::Selenium::Driver
def handle_retry(method, *args)
retries = 0
+
+ # Disable retries only when we really really want to, this will remain
+ # an undocomented hack for the time being
+ if ENV['SAUCE_DISABLE_RETRY']
+ retries = MAX_RETRIES
+ end
+
begin
send("base_#{method}".to_sym, *args)
rescue *RETRY_ON => e
View
18 spec/sauce/capybara_spec.rb
@@ -65,6 +65,24 @@
describe '#find' do
let(:selector) { '#lol' }
+ context 'with an environment override' do
+ before :each do
+ ENV['SAUCE_DISABLE_RETRY'] = '1'
+ end
+
+ it 'should not retry and raise the error' do
+ subject.should_receive(:base_find).with(selector).and_raise(Selenium::WebDriver::Error::UnknownError)
+
+ expect {
+ subject.find(selector)
+ }.to raise_error(Selenium::WebDriver::Error::UnknownError)
+ end
+
+ after :each do
+ ENV['SAUCE_DISABLE_RETRY'] = nil
+ end
+ end
+
it 'should route through handle_retry' do
subject.should_receive(:base_find).with(selector) # BLECH
subject.find(selector)
Please sign in to comment.
Something went wrong with that request. Please try again.