Improved recovery if browser start was failed, try it 5 times.

This commit is contained in:
Martin Edenhofer 2016-05-21 17:40:08 +02:00
parent cbb751d0f3
commit 4c55ca4121
2 changed files with 37 additions and 38 deletions

View file

@ -54,16 +54,16 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/admin_overview_test.rb rm test/browser/admin_overview_test.rb
rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_navigation_and_title_test.rb
rm test/browser/agent_organization_profile_test.rb rm test/browser/agent_organization_profile_test.rb
# test/browser/agent_ticket_actions_level0.rb # test/browser/agent_ticket_actions_level0_test.rb
# test/browser/agent_ticket_actions_level1.rb # test/browser/agent_ticket_actions_level1_test.rb
# test/browser/agent_ticket_actions_level2.rb # test/browser/agent_ticket_actions_level2_test.rb
# test/browser/agent_ticket_actions_level3.rb # test/browser/agent_ticket_actions_level3_test.rb
# test/browser/agent_ticket_actions_level4.rb # test/browser/agent_ticket_actions_level4_test.rb
rm test/browser/agent_ticket_actions_level5.rb rm test/browser/agent_ticket_actions_level5_test.rb
rm test/browser/agent_ticket_actions_level6.rb rm test/browser/agent_ticket_actions_level6_test.rb
rm test/browser/agent_ticket_actions_level7.rb rm test/browser/agent_ticket_actions_level7_test.rb
rm test/browser/agent_ticket_actions_level8.rb rm test/browser/agent_ticket_actions_level8_test.rb
rm test/browser/agent_ticket_actions_level9.rb rm test/browser/agent_ticket_actions_level9_test.rb
rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level0_test.rb
rm test/browser/agent_ticket_overview_level1_test.rb rm test/browser/agent_ticket_overview_level1_test.rb
rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_manage_test.rb
@ -96,16 +96,16 @@ elif [ "$LEVEL" == '3' ]; then
rm test/browser/admin_overview_test.rb rm test/browser/admin_overview_test.rb
rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_navigation_and_title_test.rb
rm test/browser/agent_organization_profile_test.rb rm test/browser/agent_organization_profile_test.rb
rm test/browser/agent_ticket_actions_level0.rb rm test/browser/agent_ticket_actions_level0_test.rb
rm test/browser/agent_ticket_actions_level1.rb rm test/browser/agent_ticket_actions_level1_test.rb
rm test/browser/agent_ticket_actions_level2.rb rm test/browser/agent_ticket_actions_level2_test.rb
rm test/browser/agent_ticket_actions_level3.rb rm test/browser/agent_ticket_actions_level3_test.rb
rm test/browser/agent_ticket_actions_level4.rb rm test/browser/agent_ticket_actions_level4_test.rb
# test/browser/agent_ticket_actions_level5.rb # test/browser/agent_ticket_actions_level5_test.rb
# test/browser/agent_ticket_actions_level6.rb # test/browser/agent_ticket_actions_level6_test.rb
# test/browser/agent_ticket_actions_level7.rb # test/browser/agent_ticket_actions_level7_test.rb
# test/browser/agent_ticket_actions_level8.rb # test/browser/agent_ticket_actions_level8_test.rb
# test/browser/agent_ticket_actions_level9.rb # test/browser/agent_ticket_actions_level9_test.rb
rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level0_test.rb
rm test/browser/agent_ticket_overview_level1_test.rb rm test/browser/agent_ticket_overview_level1_test.rb
rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_manage_test.rb

View file

@ -50,6 +50,22 @@ class TestCase < Test::Unit::TestCase
return local_browser return local_browser
end end
# avoid "Cannot read property 'get_Current' of undefined" issues
(1..5).each {|count|
begin
local_browser = browser_instance_remote
break
rescue
wait_until_ready = rand(9)+5
sleep wait_until_ready
log('browser_instance', { rescure: true, count: count, sleep: wait_until_ready })
end
}
local_browser
end
def browser_instance_remote
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']
@ -63,24 +79,7 @@ class TestCase < Test::Unit::TestCase
desired_capabilities: caps, desired_capabilities: caps,
) )
@browsers[local_browser.hash] = local_browser @browsers[local_browser.hash] = local_browser
# avoid "Cannot read property 'get_Current' of undefined" issues
begin
browser_instance_preferences(local_browser) browser_instance_preferences(local_browser)
rescue
# just try again
sleep 10
log('browser_instance', { rescure: true })
begin
browser_instance_preferences(local_browser)
rescue
# just try again
sleep 10
log('browser_instance', { rescure: true })
browser_instance_preferences(local_browser)
end
end
# upload files from remote dir # upload files from remote dir
local_browser.file_detector = lambda do |args| local_browser.file_detector = lambda do |args|