From 45f6595bdac2a31089a7e2ef44cb64e07c8ce770 Mon Sep 17 00:00:00 2001 From: Jack Walker Date: Fri, 15 May 2020 11:26:30 +1000 Subject: [PATCH] Fixed BrowserStack timeout error handling. --- spec/beef/core/main/autorun_engine/autorun_engine_spec.rb | 2 +- spec/beef/core/main/handlers/browser_details_handler_spec.rb | 2 +- spec/beef/extensions/websocket_hooked_browser_spec.rb | 2 +- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb index 67664b3ca..ba8155e57 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -120,7 +120,7 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do begin @driver.quit rescue => exception - if exception.include?('Failed to open TCP connection') + if exception.class == NoMethodError && exception.message.include?('Failed to open TCP connection') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('hub-cloud.browserstack.com:80') else diff --git a/spec/beef/core/main/handlers/browser_details_handler_spec.rb b/spec/beef/core/main/handlers/browser_details_handler_spec.rb index a0099c143..16aece581 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -117,7 +117,7 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do begin @driver.quit rescue => exception - if exception.include?('Failed to open TCP connection') + if exception.class == NoMethodError && exception.message.include?('Failed to open TCP connection') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('hub-cloud.browserstack.com:80') else diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index 2b4cfca8f..d5478a414 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -106,7 +106,7 @@ RSpec.describe 'Browser hooking with Websockets', :run_on_browserstack => true d begin @driver.quit rescue => exception - if exception.include?('Failed to open TCP connection') + if exception.class == NoMethodError && exception.message.include?('Failed to open TCP connection') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('hub-cloud.browserstack.com:80') else diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 15353d353..a6c7bccac 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -124,7 +124,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do begin @driver.quit rescue => exception - if exception.include?('Failed to open TCP connection') + if exception.class == NoMethodError && exception.message.include?('Failed to open TCP connection') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('hub-cloud.browserstack.com:80') else