Timing enhancements.

This commit is contained in:
Martin Edenhofer 2014-12-03 11:01:04 +01:00
parent 1d162c5da3
commit 776e60f3a2
2 changed files with 51 additions and 34 deletions

View file

@ -50,14 +50,13 @@ class AgentTicketActionLevel5Test < TestCase
:css => '.modal button.js-submit',
},
{
:execute => 'wait',
:value => 3,
:execute => 'watch_for',
:area => '#content table',
:value => 'some name' + random,
},
{
:execute => 'match',
:css => 'body',
:value => random,
:match_result => true,
:execute => 'watch_for_disappear',
:area => '.modal',
},
],
},
@ -100,14 +99,13 @@ class AgentTicketActionLevel5Test < TestCase
:css => '.modal button.js-submit',
},
{
:execute => 'wait',
:value => 3,
:execute => 'watch_for',
:area => '#content table',
:value => 'some name' + random2,
},
{
:execute => 'match',
:css => 'body',
:value => random2,
:match_result => true,
:execute => 'watch_for_disappear',
:area => '.modal',
},
],
},
@ -132,14 +130,9 @@ class AgentTicketActionLevel5Test < TestCase
:value => 'test ::' + random,
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'match',
:css => 'body',
:execute => 'watch_for',
:area => '.active .shortcut',
:value => random,
:match_result => true,
},
{
:execute => 'sendkey',
@ -249,18 +242,17 @@ class AgentTicketActionLevel5Test < TestCase
:css => '.modal button.js-submit',
},
{
:execute => 'wait',
:value => 3,
:where => :instance1,
:execute => 'watch_for',
:area => '#content table',
:value => random,
},
{
:where => :instance1,
:execute => 'match',
:css => 'body',
:value => random,
:match_result => true,
:execute => 'watch_for_disappear',
:area => '.modal',
},
],
},

View file

@ -277,6 +277,31 @@ class TestCase < Test::Unit::TestCase
}
assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
return
elsif action[:execute] == 'watch_for_disappear'
timeout = 16
if action[:timeout]
timeout = action[:timeout]
end
loops = (timeout / 0.5).to_i
text = ''
(1..loops).each { |loop|
begin
element = instance.find_element( { :css => action[:area] } )
if !element || !element.displayed?
assert( true, "(#{test[:name]}) not found" )
sleep 0.4
return
end
rescue => e
puts e.message
assert( true, "(#{test[:name]}) not found" )
sleep 0.4
return
end
sleep 0.5
}
assert( false, "(#{test[:name]} / #{test[:area]}) still exsists" )
return
elsif action[:execute] == 'create_user'
instance.find_element( { :css => 'a[href="#manage"]' } ).click