From a7a0339f8d5acf2eca030a8f338e0e150bcc3ce7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 14 Dec 2015 11:02:49 +0100 Subject: [PATCH] Avoid "Cannot read property 'get_Current' of undefined" issues. --- test/browser/agent_ticket_actions_level3_test.rb | 2 +- test/browser_test_helper.rb | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/browser/agent_ticket_actions_level3_test.rb b/test/browser/agent_ticket_actions_level3_test.rb index fe73acef5..a421e9d88 100644 --- a/test/browser/agent_ticket_actions_level3_test.rb +++ b/test/browser/agent_ticket_actions_level3_test.rb @@ -106,7 +106,7 @@ class AgentTicketActionsLevel3Test < TestCase css: '.active div.ticket-article', value: 'some level 3 body in instance 2', ) - + sleep 1 match_not( browser: browser1, css: '.content.active .js-reset', diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 6e29c028d..15ad92376 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -41,13 +41,13 @@ class TestCase < Test::Unit::TestCase @browsers = {} end if !ENV['REMOTE_URL'] || ENV['REMOTE_URL'].empty? - local_browser = Selenium::WebDriver.for( browser.to_sym, profile: profile ) + local_browser = Selenium::WebDriver.for(browser.to_sym, profile: profile) browser_instance_preferences(local_browser) @browsers[local_browser.hash] = local_browser return local_browser end - caps = Selenium::WebDriver::Remote::Capabilities.send( browser ) + caps = Selenium::WebDriver::Remote::Capabilities.send(browser) if ENV['BROWSER_OS'] caps.platform = ENV['BROWSER_OS'] end @@ -59,8 +59,16 @@ class TestCase < Test::Unit::TestCase url: ENV['REMOTE_URL'], desired_capabilities: caps, ) - browser_instance_preferences(local_browser) - @browsers[local_browser.hash] = local_browser + + # avoid "Cannot read property 'get_Current' of undefined" issues + begin + browser_instance_preferences(local_browser) + rescue + # just try again + sleep 10 + browser_instance_preferences(local_browser) + end + local_browser end