diff --git a/test/browser/agent_ticket_actions_level5_test.rb b/test/browser/agent_ticket_actions_level5_test.rb index 77b57b2dc..06f537bea 100644 --- a/test/browser/agent_ticket_actions_level5_test.rb +++ b/test/browser/agent_ticket_actions_level5_test.rb @@ -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', - :value => random, - :match_result => true, + :execute => 'watch_for', + :area => '.active .shortcut', + :value => random, }, { :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', }, - ], }, @@ -269,13 +261,13 @@ class AgentTicketActionLevel5Test < TestCase :name => 'create user', :action => [ { - :where => :instance1, - :execute => 'create_user', - :login => login, - :firstname => firstname, - :lastname => lastname, - :email => email, - :password => password, + :where => :instance1, + :execute => 'create_user', + :login => login, + :firstname => firstname, + :lastname => lastname, + :email => email, + :password => password, }, ], }, diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index e349228ac..f76b1768f 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -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