Avoid "Cannot read property 'get_Current' of undefined" issues.

This commit is contained in:
Martin Edenhofer 2015-12-14 11:02:49 +01:00
parent 1d4e1310d1
commit a7a0339f8d
2 changed files with 13 additions and 5 deletions

View file

@ -106,7 +106,7 @@ class AgentTicketActionsLevel3Test < TestCase
css: '.active div.ticket-article', css: '.active div.ticket-article',
value: 'some level 3 <b>body</b> in instance 2', value: 'some level 3 <b>body</b> in instance 2',
) )
sleep 1
match_not( match_not(
browser: browser1, browser: browser1,
css: '.content.active .js-reset', css: '.content.active .js-reset',

View file

@ -41,13 +41,13 @@ class TestCase < Test::Unit::TestCase
@browsers = {} @browsers = {}
end end
if !ENV['REMOTE_URL'] || ENV['REMOTE_URL'].empty? 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) browser_instance_preferences(local_browser)
@browsers[local_browser.hash] = local_browser @browsers[local_browser.hash] = local_browser
return local_browser return local_browser
end end
caps = Selenium::WebDriver::Remote::Capabilities.send( browser ) caps = Selenium::WebDriver::Remote::Capabilities.send(browser)
if ENV['BROWSER_OS'] if ENV['BROWSER_OS']
caps.platform = ENV['BROWSER_OS'] caps.platform = ENV['BROWSER_OS']
end end
@ -59,8 +59,16 @@ class TestCase < Test::Unit::TestCase
url: ENV['REMOTE_URL'], url: ENV['REMOTE_URL'],
desired_capabilities: caps, 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 local_browser
end end