From 20523a7bd8a154837484cf6f5315e49cea1b0abe Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 23 Feb 2015 23:58:05 +0100 Subject: [PATCH] Some timing improvements. --- test/browser/agent_organization_profile_test.rb | 3 --- .../browser/agent_ticket_actions_level0_test.rb | 17 ++--------------- .../agent_ticket_overview_level1_test.rb | 3 --- test/browser/agent_user_profile_test.rb | 1 - test/browser_test_helper.rb | 11 +++++++++-- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index 1ebf068e9..8dd231a91 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -13,7 +13,6 @@ class AgentOrganizationProfileTest < TestCase :url => browser_url, ) tasks_close_all() - sleep 1 # search and open org organization_open_by_search( @@ -34,7 +33,6 @@ class AgentOrganizationProfileTest < TestCase :value => 'some note 123' ) click( :css => '.active .profile' ) - sleep 1 # check and change note again in edit screen click( :css => '.active .js-action .select-arrow' ) @@ -69,7 +67,6 @@ class AgentOrganizationProfileTest < TestCase :body => 'org profile check ' + message, }, ) - sleep 1 # switch to org tab, verify if ticket is shown organization_open_by_search( diff --git a/test/browser/agent_ticket_actions_level0_test.rb b/test/browser/agent_ticket_actions_level0_test.rb index 3b6d5e5e5..4c8110737 100644 --- a/test/browser/agent_ticket_actions_level0_test.rb +++ b/test/browser/agent_ticket_actions_level0_test.rb @@ -46,7 +46,6 @@ class AgentTicketActionLevel0Test < TestCase sendkey( :value => :arrow_down, ) - sleep 1 click( :css => '.active .shortcut > ul> li > a' ) watch_for( @@ -136,7 +135,6 @@ class AgentTicketActionLevel0Test < TestCase :browser => browser2, :value => :arrow_down, ) - sleep 1 click( :browser => browser2, :css => '.active .shortcut > ul> li > a', @@ -160,25 +158,21 @@ class AgentTicketActionLevel0Test < TestCase :browser => browser2, :value => :arrow_down, ) - sleep 1 click( :browser => browser2, :css => '.active .newTicket .recipientList-entry.js-user.is-active', ) - sleep 1 set( :browser => browser2, :css => '.active div[data-name=body]', :value => '::' + random, ) - sleep 1 sendkey( :browser => browser2, :value => :arrow_down, ) - sleep 1 click( :browser => browser2, :css => '.active .shortcut > ul> li > a', @@ -210,19 +204,18 @@ class AgentTicketActionLevel0Test < TestCase :css => '.active div[data-name=body]', :value => 'test', ) - sleep 1 set( :browser => browser2, :css => '.active div[data-name=body]', :value => '::' + random, ) - sleep 1 + sendkey( :browser => browser2, :value => :arrow_down, ) - sleep 1 + click( :browser => browser2, :css => '.active .shortcut > ul> li > a', @@ -259,13 +252,10 @@ class AgentTicketActionLevel0Test < TestCase :browser => browser2, :value => :arrow_down, ) - sleep 1 - click( :browser => browser2, :css => '.modal .recipientList-entry.js-user.is-active', ) - sleep 1 click( :browser => browser2, :css => '.modal-content .js-submit', @@ -275,20 +265,17 @@ class AgentTicketActionLevel0Test < TestCase :browser => browser2, :css => '.modal', ) - sleep 1 watch_for( :browser => browser2, :css => '.active div[data-name=body]', :value => '::' + random, ) - sleep 1 sendkey( :browser => browser2, :value => :arrow_down, ) - sleep 1 click( :browser => browser2, diff --git a/test/browser/agent_ticket_overview_level1_test.rb b/test/browser/agent_ticket_overview_level1_test.rb index f20d261c1..83d011c9f 100644 --- a/test/browser/agent_ticket_overview_level1_test.rb +++ b/test/browser/agent_ticket_overview_level1_test.rb @@ -34,7 +34,6 @@ class AgentTicketOverviewLevel1Test < TestCase 'order::direction' => 'down', } ) - sleep 1 # create tickets ticket1 = ticket_create( @@ -46,7 +45,6 @@ class AgentTicketOverviewLevel1Test < TestCase :body => 'overview #1', } ) - sleep 1 # keep connection alive click( @@ -63,7 +61,6 @@ class AgentTicketOverviewLevel1Test < TestCase :body => 'overview #2', } ) - sleep 1 ticket3 = ticket_create( :browser => browser1, diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index 04d7785db..ae517ff25 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -67,7 +67,6 @@ class AgentUserProfileTest < TestCase :body => 'user profile check ' + message, }, ) - sleep 1 # switch to org tab, verify if ticket is shown user_open_by_search( :value => 'Braun' ) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 137a1c665..c25b607f7 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -195,6 +195,7 @@ class TestCase < Test::Unit::TestCase def click(params) instance = params[:browser] || @browser instance.find_elements( { :css => params[:css] } )[0].click + sleep 0.5 end =begin @@ -258,7 +259,7 @@ class TestCase < Test::Unit::TestCase instance.action.send_keys(key).perform } end - sleep 0.1 + sleep 0.5 end =begin @@ -335,6 +336,7 @@ class TestCase < Test::Unit::TestCase return end instance.action.send_keys(params[:value]).perform + sleep 0.5 end =begin @@ -405,6 +407,7 @@ class TestCase < Test::Unit::TestCase raise "not matching '#{params[:value]}' in content '#{text}' but should!" end end + sleep 0.8 return match end @@ -507,6 +510,7 @@ class TestCase < Test::Unit::TestCase text = element.text if text =~ /#{params[:value]}/i assert( true, "'#{params[:value]}' found in '#{text}'" ) + sleep 0.5 return true end rescue @@ -541,6 +545,7 @@ class TestCase < Test::Unit::TestCase element = instance.find_elements( { :css => params[:css] } )[0] if !element #|| element.displayed? assert( true, "not found" ) + sleep 1 return true end sleep 1 @@ -585,6 +590,7 @@ class TestCase < Test::Unit::TestCase # just try again end end + sleep 1 assert( true, "all tasks closed" ) end @@ -732,7 +738,7 @@ class TestCase < Test::Unit::TestCase (1..16).each {|loop| if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ assert( true, "ticket created" ) - sleep 1 + sleep 0.5 id = instance.current_url id.gsub!(//, ) id.gsub!(/^.+?\/(\d+)$/, "\\1") @@ -742,6 +748,7 @@ class TestCase < Test::Unit::TestCase :id => id, :number => number, } + sleep 1 return ticket end sleep 0.5