From 7d475b1ac4e816849a90f9a2892191a9d447418e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 15 Mar 2016 12:47:26 +0100 Subject: [PATCH 1/2] Improved error handling. --- test/browser/agent_organization_profile_test.rb | 11 +++++------ test/browser/agent_user_profile_test.rb | 15 +++++++-------- test/browser_test_helper.rb | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index c273de8e7..de8e0403c 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -33,12 +33,12 @@ class AgentOrganizationProfileTest < TestCase css: '.active .profile [data-name="note"]', value: note, ) - click( css: '.empty-search' ) + empty_search() sleep 2 # check and change note again in edit screen - click( css: '.active .js-action .icon-arrow-down', fast: true ) - click( css: '.active .js-action [data-type="edit"]' ) + click(css: '.active .js-action .icon-arrow-down', fast: true) + click(css: '.active .js-action [data-type="edit"]') watch_for( css: '.active .modal', @@ -53,7 +53,7 @@ class AgentOrganizationProfileTest < TestCase css: '.active .modal [data-name="note"]', value: 'some note abc', ) - click( css: '.active .modal button.js-submit' ) + click(css: '.active .modal button.js-submit') watch_for( css: '.active .profile-window', @@ -112,9 +112,8 @@ class AgentOrganizationProfileTest < TestCase css: '.active .profile [data-name="note"]', value: message, ) - click( + empty_search( browser: browser1, - css: '.empty-search', ) # verify diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index 7468cde67..0ac2850f9 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -14,7 +14,7 @@ class AgentUserProfileTest < TestCase tasks_close_all() # search and open user - user_open_by_search( value: 'Braun' ) + user_open_by_search(value: 'Braun') watch_for( css: '.active .profile-window', @@ -30,12 +30,12 @@ class AgentUserProfileTest < TestCase css: '.active [data-name="note"]', value: 'some note 123', ) - click( css: '.empty-search' ) + empty_search() sleep 2 # check and change note again in edit screen - click( css: '.active .js-action .icon-arrow-down' ) - click( css: '.active .js-action [data-type="edit"]' ) + click(css: '.active .js-action .icon-arrow-down') + click(css: '.active .js-action [data-type="edit"]') watch_for( css: '.active .modal', @@ -50,7 +50,7 @@ class AgentUserProfileTest < TestCase css: '.modal [data-name="note"]', value: 'some note abc', ) - click( css: '.active .modal button.js-submit' ) + click(css: '.active .modal button.js-submit') watch_for( css: '.active .profile-window', @@ -68,7 +68,7 @@ class AgentUserProfileTest < TestCase ) # switch to org tab, verify if ticket is shown - user_open_by_search( value: 'Braun' ) + user_open_by_search(value: 'Braun') watch_for( css: '.active .profile-window', value: 'user profile check ' + message, @@ -107,9 +107,8 @@ class AgentUserProfileTest < TestCase css: '.active [data-name="note"]', value: message, ) - click( + empty_search( browser: browser1, - css: '.empty-search', ) watch_for( diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index d7c4d3085..6e15d4924 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -2353,7 +2353,7 @@ wait untill text in selector disabppears @last_used_browser = instance end - def log(method, params) + def log(method, params = {}) return if !@@debug return if params[:mute_log] puts "#{Time.zone.now}/#{method}: #{params.inspect}" From d8d6081bcc3c9b499cb9b62501a9458480182e8f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 15 Mar 2016 16:01:28 +0100 Subject: [PATCH 2/2] Improved timing. --- test/browser_test_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 6e15d4924..c9386f327 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -1891,6 +1891,7 @@ wait untill text in selector disabppears # open ticket #instance.find_element(partial_link_text: params[:number] } ).click instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()") + sleep 1 number = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0].text if number !~ /#{params[:number]}/ screenshot(browser: instance, comment: 'ticket_open_by_search_failed') @@ -1925,6 +1926,7 @@ wait untill text in selector disabppears # open ticket #instance.find_element(partial_link_text: params[:title] } ).click instance.execute_script("$(\"#global-search-result a:contains('#{params[:title]}') .nav-tab-icon\").click()") + sleep 1 title = instance.find_elements(css: '.active .ticketZoom-header .ticket-title-update')[0].text if title !~ /#{params[:title]}/ screenshot(browser: instance, comment: 'ticket_open_by_title_failed') @@ -2012,6 +2014,7 @@ wait untill text in selector disabppears sleep 2 #instance.find_element(partial_link_text: params[:value] } ).click instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()") + sleep 1 name = instance.find_elements(css: '.active h1')[0].text if name !~ /#{params[:value]}/ screenshot(browser: instance, comment: 'organization_open_by_search_failed') @@ -2044,6 +2047,7 @@ wait untill text in selector disabppears sleep 3 #instance.find_element(partial_link_text: params[:value]).click instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()") + sleep 1 name = instance.find_elements(css: '.active h1')[0].text if name !~ /#{params[:value]}/ screenshot(browser: instance, comment: 'user_open_by_search_failed')