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', :css => '.modal button.js-submit',
}, },
{ {
:execute => 'wait', :execute => 'watch_for',
:value => 3, :area => '#content table',
:value => 'some name' + random,
}, },
{ {
:execute => 'match', :execute => 'watch_for_disappear',
:css => 'body', :area => '.modal',
:value => random,
:match_result => true,
}, },
], ],
}, },
@ -100,14 +99,13 @@ class AgentTicketActionLevel5Test < TestCase
:css => '.modal button.js-submit', :css => '.modal button.js-submit',
}, },
{ {
:execute => 'wait', :execute => 'watch_for',
:value => 3, :area => '#content table',
:value => 'some name' + random2,
}, },
{ {
:execute => 'match', :execute => 'watch_for_disappear',
:css => 'body', :area => '.modal',
:value => random2,
:match_result => true,
}, },
], ],
}, },
@ -132,14 +130,9 @@ class AgentTicketActionLevel5Test < TestCase
:value => 'test ::' + random, :value => 'test ::' + random,
}, },
{ {
:execute => 'wait', :execute => 'watch_for',
:value => 2, :area => '.active .shortcut',
}, :value => random,
{
:execute => 'match',
:css => 'body',
:value => random,
:match_result => true,
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
@ -249,18 +242,17 @@ class AgentTicketActionLevel5Test < TestCase
:css => '.modal button.js-submit', :css => '.modal button.js-submit',
}, },
{ {
:execute => 'wait', :where => :instance1,
:value => 3, :execute => 'watch_for',
:area => '#content table',
:value => random,
}, },
{ {
:where => :instance1, :where => :instance1,
:execute => 'match', :execute => 'watch_for_disappear',
:css => 'body', :area => '.modal',
:value => random,
:match_result => true,
}, },
], ],
}, },
@ -269,13 +261,13 @@ class AgentTicketActionLevel5Test < TestCase
:name => 'create user', :name => 'create user',
:action => [ :action => [
{ {
:where => :instance1, :where => :instance1,
:execute => 'create_user', :execute => 'create_user',
:login => login, :login => login,
:firstname => firstname, :firstname => firstname,
:lastname => lastname, :lastname => lastname,
:email => email, :email => email,
:password => password, :password => password,
}, },
], ],
}, },

View file

@ -277,6 +277,31 @@ class TestCase < Test::Unit::TestCase
} }
assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" ) assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
return 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' elsif action[:execute] == 'create_user'
instance.find_element( { :css => 'a[href="#manage"]' } ).click instance.find_element( { :css => 'a[href="#manage"]' } ).click