Small selenium adjustments.

This commit is contained in:
Martin Edenhofer 2013-07-24 20:09:20 +02:00
parent 5472a6b648
commit 0a747900f6
4 changed files with 22 additions and 22 deletions

View file

@ -216,6 +216,10 @@ class AgentTicketActionsLevel2Test < TestCase
:execute => 'js', :execute => 'js',
:value => '$(".active .ticket-title .ticket-title-update").trigger("blur")', :value => '$(".active .ticket-title .ticket-title-update").trigger("blur")',
}, },
{
:execute => 'wait',
:value => 1,
},
# set body in edit area # set body in edit area

View file

@ -16,7 +16,7 @@ class TaskbarSessionTest < TestCase
:action => [ :action => [
{ {
:execute => 'wait', :execute => 'wait',
:value => 14, :value => 12,
}, },
{ {
:where => :instance1, :where => :instance1,
@ -32,10 +32,6 @@ class TaskbarSessionTest < TestCase
:value => 'Reload application', :value => 'Reload application',
:match_result => false, :match_result => false,
}, },
# {
# :execute => 'wait',
# :value => 1,
# },
], ],
}, },
] ]
@ -56,7 +52,7 @@ class TaskbarSessionTest < TestCase
:action => [ :action => [
{ {
:execute => 'wait', :execute => 'wait',
:value => 14, :value => 12,
}, },
{ {
:where => :instance1, :where => :instance1,
@ -72,10 +68,6 @@ class TaskbarSessionTest < TestCase
:value => 'Reload application', :value => 'Reload application',
:match_result => false, :match_result => false,
}, },
# {
# :execute => 'wait',
# :value => 1,
# },
], ],
}, },
] ]

View file

@ -42,7 +42,7 @@ class TaskbarTaskTest < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 20, :value => 12,
}, },
], ],
}, },
@ -135,7 +135,7 @@ class TaskbarTaskTest < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 20, :value => 12,
}, },
{ {
:execute => 'click', :execute => 'click',

View file

@ -25,8 +25,7 @@ class TestCase < Test::Unit::TestCase
end end
if !ENV['REMOTE_URL'] if !ENV['REMOTE_URL']
local_browser = Selenium::WebDriver.for( browser.to_sym ) local_browser = Selenium::WebDriver.for( browser.to_sym )
local_browser.manage.window.resize_to(1024, 1024) browser_instance_preferences(local_browser)
local_browser.manage.timeouts.implicit_wait = 3 # seconds
@browsers.push local_browser @browsers.push local_browser
return local_browser return local_browser
end end
@ -39,20 +38,25 @@ class TestCase < Test::Unit::TestCase
:url => ENV['REMOTE_URL'], :url => ENV['REMOTE_URL'],
:desired_capabilities => caps, :desired_capabilities => caps,
) )
local_browser.manage.timeouts.implicit_wait = 3 # seconds browser_instance_preferences(local_browser)
@browsers.push local_browser @browsers.push local_browser
return local_browser return local_browser
end end
def browser_instance_preferences(local_browser)
local_browser.manage.window.resize_to(1024, 1024)
if ENV['REMOTE_URL'] !~ /saucelabs/i
if @browsers.size < 1
local_browser.manage.window.move_to(0, 0)
else
local_browser.manage.window.move_to(1024, 0)
end
end
local_browser.manage.timeouts.implicit_wait = 3 # seconds
end
def teardown def teardown
return if !@browsers return if !@browsers
# only shut down browser type once
# otherwise this error will happen "Errno::ECONNREFUSED: Connection refused - connect(2)"
shutdown = {}
@browsers.each{ |local_browser| @browsers.each{ |local_browser|
next if shutdown[ local_browser.browser ]
shutdown[ local_browser.browser ] = true
local_browser.quit local_browser.quit
} }
end end
@ -171,7 +175,7 @@ class TestCase < Test::Unit::TestCase
end end
def browser_element_action(test, action, instance) def browser_element_action(test, action, instance)
#puts "NOTICE: " + action.inspect puts "NOTICE: " + action.inspect
sleep 0.2 sleep 0.2
if action[:css] if action[:css]
if action[:css].match '###stack###' if action[:css].match '###stack###'