From 18199419892257a4b6d1902f05e4316772653696 Mon Sep 17 00:00:00 2001 From: Ryan Lue Date: Mon, 23 Jul 2018 17:53:51 +0800 Subject: [PATCH 01/12] Add example for User callback spec (for #2057 fix) --- spec/models/user_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index f17817753..dfca9cfcc 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -691,6 +691,25 @@ RSpec.describe User do end end + context 'falsely added on update (change: [nil, ""])' do + let(:orig_number) { nil } + let(:new_number) { '' } + + before { subject } # create user + + it 'does not attempt to update CallerId record' do + allow(Cti::CallerId).to receive(:build).with(any_args) + + expect(Cti::CallerId.where(object: 'User', o_id: subject.id).count) + .to eq(0) + + expect { subject.update(phone: new_number) } + .to change { Cti::CallerId.where(object: 'User', o_id: subject.id).count }.by(0) + + expect(Cti::CallerId).not_to have_received(:build) + end + end + context 'removed on update' do let(:orig_number) { '1234567890' } let(:new_number) { nil } From 6b50097f95ae998cf2ade37d1d12770304bb9cec Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 20 Jul 2018 14:04:05 +0200 Subject: [PATCH 02/12] Added browser test helper to navigate to overview by name or link. --- test/browser_test_helper.rb | 61 +++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 3556a0d20..01a45f341 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -2497,6 +2497,53 @@ wait untill text in selector disabppears true end +=begin + + overview_open( + browser: browser2, + name: overview_name, + ) + + overview_open( + browser: browser2, + link: "#ticket/view/some_special_name", + ) + +=end + + def overview_open(params) + switch_window_focus(params) + log('overview_open', params) + + instance = params[:browser] || @browser + + # click on overview task in sidebar + instance.find_elements(css: '.js-overviewsMenuItem')[0].click + + # show larger overview selection list + sleep 0.5 + execute( + browser: instance, + js: '$(".content.active .sidebar").css("display", "block")', + ) + + link = if params[:link] + params[:link] + elsif params[:name] + "\#ticket/view/#{params[:name]}" + end + + # switch to overview + instance.find_elements(css: ".content.active .sidebar a[href=\"#{link}\"]")[0].click + + # hide larger overview selection list again + sleep 0.5 + execute( + browser: instance, + js: '$(".content.active .sidebar").css("display", "none")', + ) + end + =begin ticket_open_by_overview( @@ -2520,18 +2567,8 @@ wait untill text in selector disabppears instance = params[:browser] || @browser - instance.find_elements(css: '.js-overviewsMenuItem')[0].click - sleep 0.5 - execute( - browser: instance, - js: '$(".content.active .sidebar").css("display", "block")', - ) - instance.find_elements(css: ".content.active .sidebar a[href=\"#{params[:link]}\"]")[0].click - sleep 0.5 - execute( - browser: instance, - js: '$(".content.active .sidebar").css("display", "none")', - ) + overview_open(params) + if params[:title] element = instance.find_element(css: '.content.active').find_element(partial_link_text: params[:title]) if !element From 364f74f558fa42e9050d5c081ea3dc097c2208af Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 24 Jul 2018 17:32:32 +0200 Subject: [PATCH 03/12] Test stabilization: Updated overview push via the Scheduler to the frontend might take a bit longer. --- test/browser/admin_overview_test.rb | 45 ++++++++++------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/test/browser/admin_overview_test.rb b/test/browser/admin_overview_test.rb index e9cfe0b9c..a6bbae3f0 100644 --- a/test/browser/admin_overview_test.rb +++ b/test/browser/admin_overview_test.rb @@ -94,24 +94,11 @@ class AdminOverviewTest < TestCase } ) - click( - browser: instance, - css: 'a[href="#ticket/view"]', - mute_log: true, - ) - click( - browser: instance, - css: "div.overview-header a[href='#ticket/view/#{name}']", - mute_log: true, + overview_open( + name: name ) - # Sort the tickets according to their onscreen Y location - tickets_low_to_high = ticket_titles.map do |title| - [title, - get_location( css: "td[title='#{title}']").y] - end - tickets_low_to_high = tickets_low_to_high.sort_by { |x| -x[1] }.map { |x| x[0] } - assert_equal(ticket_titles, tickets_low_to_high) + assert_equal(ticket_titles.reverse, ordered_ticket_titles(ticket_titles)) # Update overview to sort groups from low to high overview_update( @@ -121,23 +108,21 @@ class AdminOverviewTest < TestCase } ) - click( - browser: instance, - css: 'a[href="#ticket/view"]', - mute_log: true, - ) - click( - browser: instance, - css: "div.overview-header a[href='#ticket/view/#{name}']", - mute_log: true, + overview_open( + name: name ) - # Sort the tickets according to their onscreen Y location - tickets_high_to_low = ticket_titles.map do |title| + # wait till the scheduler pushed + # the changes to the FE + sleep 5 + + assert_equal(ticket_titles, ordered_ticket_titles(ticket_titles)) + end + + def ordered_ticket_titles(ticket_titles) + ticket_titles.map do |title| [title, get_location( css: "td[title='#{title}']").y] - end - tickets_high_to_low = tickets_high_to_low.sort_by { |x| x[1] }.map { |x| x[0] } - assert_equal(ticket_titles, tickets_high_to_low) + end.sort_by { |x| x[1] }.map { |x| x[0] } end end From 5e4958e7acbb703e5c54fa46cebc0f2ef0e45ed8 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 20 Jul 2018 14:51:00 +0200 Subject: [PATCH 04/12] Test stabilization: Upload is sometimes faster than the button can be checked. --- test/browser/agent_ticket_attachment_test.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb index c23a7864d..d2f6c84b7 100644 --- a/test/browser/agent_ticket_attachment_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -329,14 +329,15 @@ class AgentTicketAttachmentTest < TestCase # First test the attachment uploading for new tickets file_upload( css: '.content.active .attachmentPlaceholder-inputHolder input', - files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], + files: [large_file], no_sleep: true, ) exists( css: '.content.active .js-submit:disabled', ) watch_for_disappear( - css: '.content.active .js-submit:disabled', + css: '.content.active .js-submit:disabled', + timeout: 4.minutes, ) exists( css: '.content.active .js-submit', @@ -355,14 +356,23 @@ class AgentTicketAttachmentTest < TestCase ) file_upload( css: '.content.active .attachmentPlaceholder-inputHolder input', - files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], + files: [large_file], no_sleep: true, ) exists( css: '.content.active .js-submit:disabled', ) watch_for_disappear( - css: '.content.active .js-submit:disabled', + css: '.content.active .js-submit:disabled', + timeout: 4.minutes, ) end + + def large_file + file = Tempfile.new + file.binmode + file.write(SecureRandom.random_bytes(6.megabyte)) + file.close + file.path + end end From 6998eb9be277e711de741ad0f8d57cffc66f9e6e Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 23 Jul 2018 19:35:44 +0200 Subject: [PATCH 05/12] Test stabilization: The combination of sleep and exists_not is slow and prone to timing issues. --- test/browser/signup_password_change_and_reset_test.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/browser/signup_password_change_and_reset_test.rb b/test/browser/signup_password_change_and_reset_test.rb index b174f2cb7..193268f5b 100644 --- a/test/browser/signup_password_change_and_reset_test.rb +++ b/test/browser/signup_password_change_and_reset_test.rb @@ -31,9 +31,11 @@ class SignupPasswordChangeAndResetTest < TestCase value: 'some-pass', ) click(css: 'button.js-submit') - sleep 5 - exists_not(css: '.signup') + watch_for_disappear( + css: '.signup', + timeout: 10, + ) match( css: '.user-menu .user a', From 53db2cfc8e17e62e98b27e6c4a8fa2ab46f59d77 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 23 Jul 2018 20:14:26 +0200 Subject: [PATCH 06/12] Test stabilization: Race condition between clicking and receiving a new article causes click to fail. --- test/browser/user_access_permissions_test.rb | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/test/browser/user_access_permissions_test.rb b/test/browser/user_access_permissions_test.rb index c3792b53a..de14f1fee 100644 --- a/test/browser/user_access_permissions_test.rb +++ b/test/browser/user_access_permissions_test.rb @@ -361,17 +361,25 @@ class AgentProfilePermissionsTest < TestCase exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') exists_not(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') - # scroll to the Avatar at the top of the zoom view and click it - # scrolling is needed because the browser might have scrolled down - # caused by a undeliverable email (of the created ticket) - zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar' - scroll_to( - position: 'botton', - css: zoom_top_avatar_selector, - ) - click(css: zoom_top_avatar_selector) + begin + retries ||= 0 - click(css: '.content.active .js-action .icon-arrow-down', fast: true) - exists_not(css: '.content.active .js-action [data-type="edit"]') + # scroll to the Avatar at the top of the zoom view and click it + # scrolling is needed because the browser might have scrolled down + # caused by a undeliverable email (of the created ticket) + zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar' + scroll_to( + position: 'botton', + css: zoom_top_avatar_selector, + ) + click(css: zoom_top_avatar_selector) + + click(css: '.content.active .js-action .icon-arrow-down', fast: true) + exists_not(css: '.content.active .js-action [data-type="edit"]') + rescue Selenium::WebDriver::Error::UnknownError + sleep retries + retries += 1 + retry if retries < 3 + end end end From 1795ffdb9e5a881d28b8a3f910e592113d8ccd48 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 24 Jul 2018 18:06:09 +0200 Subject: [PATCH 07/12] Improved modal_ready browser test helper to check for actual css class. --- test/browser_test_helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 01a45f341..0188eb46f 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -552,7 +552,12 @@ class TestCase < Test::Unit::TestCase log('modal_ready', params) instance = params[:browser] || @browser - sleep 3 + + watch_for( + browser: instance, + css: '.modal.in', + timeout: params[:timeout] || 4, + ) end =begin From 31af83e9e648396431279ef0272f9bc9f64e458d Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 24 Jul 2018 18:06:35 +0200 Subject: [PATCH 08/12] Test stabilization: Input fields in modal get filled before modal is faded into view and while focus is set to a different field. --- test/browser/user_access_permissions_test.rb | 32 +++++++------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/test/browser/user_access_permissions_test.rb b/test/browser/user_access_permissions_test.rb index de14f1fee..9dfc0fba2 100644 --- a/test/browser/user_access_permissions_test.rb +++ b/test/browser/user_access_permissions_test.rb @@ -38,10 +38,8 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action [data-type="edit"]') - watch_for( - css: '.content.active .modal', - value: 'note', - ) + modal_ready() + watch_for( css: '.content.active .modal', value: 'some note 123', @@ -71,10 +69,9 @@ class AgentProfilePermissionsTest < TestCase # change lastname back click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action [data-type="edit"]') - watch_for( - css: '.content.active .modal', - value: 'note', - ) + + modal_ready() + set( css: '.modal [name="lastname"]', value: 'Braun', @@ -190,6 +187,8 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') + modal_ready() + set( css: '.modal [name="lastname"]', value: 'B2', @@ -212,15 +211,11 @@ class AgentProfilePermissionsTest < TestCase value: 'Nicole B2', ) - sleep 2 # change lastname back click(css: '.content.active .sidebar[data-tab="customer"] .js-actions') click(css: 'li[data-type="customer-edit"]') - watch_for( - css: '.content.active .modal', - value: 'note', - ) + modal_ready() set( css: '.modal [name="lastname"]', @@ -283,10 +278,7 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action [data-type="edit"]') - watch_for( - css: '.content.active .modal', - value: 'note', - ) + modal_ready() set( css: '.modal [name="lastname"]', @@ -313,10 +305,8 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action [data-type="edit"]') - watch_for( - css: '.content.active .modal', - value: 'note', - ) + modal_ready() + set( css: '.modal [name="lastname"]', value: 'Braun', From 14afe747f94aa4853a72ece29280ef2933dce669 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 24 Jul 2018 20:12:48 +0200 Subject: [PATCH 09/12] Test stabilization: Macro execution and result checking lead to race condition. --- test/browser/agent_ticket_macro_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/browser/agent_ticket_macro_test.rb b/test/browser/agent_ticket_macro_test.rb index 3b2883ed7..da18df919 100644 --- a/test/browser/agent_ticket_macro_test.rb +++ b/test/browser/agent_ticket_macro_test.rb @@ -113,7 +113,10 @@ class AgentTicketMacroTest < TestCase perform_macro(name: macro_name) - exists_not(css: '.tasks > a') + watch_for_disappear( + css: '.tasks > a', + timeout: 5, + ) end def test_ux_flow_next_up_advance_to_next_ticket_from_overview From 5727c571ff24f42f40f3fd637697044c6201ea7e Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 24 Jul 2018 21:55:02 +0200 Subject: [PATCH 10/12] Test stabilization: Unjoined threads lead to stuck test suite. --- spec/lib/sessions/backend/activity_stream_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/lib/sessions/backend/activity_stream_spec.rb b/spec/lib/sessions/backend/activity_stream_spec.rb index 071cc28fd..c79419b95 100644 --- a/spec/lib/sessions/backend/activity_stream_spec.rb +++ b/spec/lib/sessions/backend/activity_stream_spec.rb @@ -17,8 +17,9 @@ RSpec.describe Sessions::Backend::ActivityStream do end it 'manages race condition' do - Thread.new { associated_tickets.each(&:destroy) } + thread = Thread.new { associated_tickets.each(&:destroy) } expect { subject.load }.not_to raise_error + thread.join end end end From 7a40517cb434451418eaa9ca462e435ee9010d70 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 25 Jul 2018 09:27:36 +0200 Subject: [PATCH 11/12] Test stabilization: Improved handling of modal dialogs. --- .../agent_organization_profile_test.rb | 13 ++--- test/browser/agent_ticket_attachment_test.rb | 8 +-- ...et_create_reset_customer_selection_test.rb | 4 +- test/browser/agent_ticket_link_test.rb | 3 +- test/browser/agent_ticket_merge_test.rb | 10 +--- .../agent_ticket_overview_level0_test.rb | 12 ++-- test/browser/agent_ticket_tag_test.rb | 12 +++- test/browser/agent_ticket_text_module_test.rb | 8 +-- .../agent_ticket_time_accounting_test.rb | 56 ++++--------------- test/browser/agent_ticket_zoom_hide_test.rb | 8 +-- test/browser/agent_user_manage_test.rb | 18 ++---- test/browser/agent_user_profile_test.rb | 13 ++--- test/browser/chat_test.rb | 2 + test/browser/first_steps_test.rb | 11 +++- test/browser/keyboard_shortcuts_test.rb | 18 +----- test/browser/maintenance_mode_test.rb | 14 ++--- .../maintenance_session_message_test.rb | 5 ++ test/browser/manage_test.rb | 6 +- test/browser/preferences_token_access_test.rb | 18 +++--- .../signup_password_change_and_reset_test.rb | 10 +--- test/browser/translation_test.rb | 7 ++- test/browser/user_access_permissions_test.rb | 14 ++--- 22 files changed, 105 insertions(+), 165 deletions(-) diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index 89826290d..1a91bf94e 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -47,10 +47,7 @@ class AgentOrganizationProfileTest < TestCase click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - watch_for( - css: '.active .modal', - value: 'note', - ) + modal_ready() watch_for( css: '.active .modal', value: note, @@ -65,6 +62,7 @@ class AgentOrganizationProfileTest < TestCase value: 'some note abc', ) click(css: '.active .modal button.js-submit') + modal_disappear() watch_for( css: '.active .profile-window', @@ -80,15 +78,14 @@ class AgentOrganizationProfileTest < TestCase # change lastname back click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - watch_for( - css: '.active .modal', - value: 'note', - ) + + modal_ready() set( css: '.modal [name="name"]', value: 'Zammad Foundation', ) click(css: '.active .modal button.js-submit') + modal_disappear() verify_task( data: { diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb index d2f6c84b7..abaf83d72 100644 --- a/test/browser/agent_ticket_attachment_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -162,15 +162,15 @@ class AgentTicketAttachmentTest < TestCase # submit form click(css: '.content.active .js-submit') - sleep 2 # check warning + modal_ready() match( css: '.content.active .modal', value: 'missing', ) click(css: '.content.active .modal .js-cancel') - sleep 2 + modal_disappear() ticket_update( data: { @@ -259,7 +259,7 @@ class AgentTicketAttachmentTest < TestCase # modify customer click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') - sleep 2 + modal_ready(browser: browser1) set(browser: browser1, css: '.modal [name="address"]', value: 'some new address') click(browser: browser1, css: '.modal .js-submit') modal_disappear(browser: browser1) @@ -279,7 +279,7 @@ class AgentTicketAttachmentTest < TestCase # change org of customer, check if org is shown in sidebar click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') - sleep 2 + modal_ready(browser: browser1) set(browser: browser1, css: '.modal .js-input', value: 'zammad') click(browser: browser1, css: '.modal .js-input') click(browser: browser1, css: '.modal .js-option') diff --git a/test/browser/agent_ticket_create_reset_customer_selection_test.rb b/test/browser/agent_ticket_create_reset_customer_selection_test.rb index 176499e3d..83cedd3d2 100644 --- a/test/browser/agent_ticket_create_reset_customer_selection_test.rb +++ b/test/browser/agent_ticket_create_reset_customer_selection_test.rb @@ -177,9 +177,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]') - watch_for( - css: '.content.active .modal', - ) + modal_ready() exists_not( css: '.content.active .modal .user_autocompletion.form-group.has-error', diff --git a/test/browser/agent_ticket_link_test.rb b/test/browser/agent_ticket_link_test.rb index 5eb964a11..19de03399 100644 --- a/test/browser/agent_ticket_link_test.rb +++ b/test/browser/agent_ticket_link_test.rb @@ -46,7 +46,8 @@ class AgentTicketLinkTest < TestCase click( css: '.content.active .links .js-add', ) - sleep 2 + + modal_ready() set( css: '.content.active .modal-body [name="ticket_number"]', diff --git a/test/browser/agent_ticket_merge_test.rb b/test/browser/agent_ticket_merge_test.rb index 27ed3b6eb..99d6c90e9 100644 --- a/test/browser/agent_ticket_merge_test.rb +++ b/test/browser/agent_ticket_merge_test.rb @@ -58,11 +58,8 @@ class AgentTicketMergeTest < TestCase # merge tickets click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) - watch_for( - css: '.modal', - value: 'merge', - ) + modal_ready() set( css: '.modal input[name="master_ticket_number"]', value: ticket1[:number], @@ -115,11 +112,8 @@ class AgentTicketMergeTest < TestCase # merge tickets click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) - watch_for( - css: '.modal', - value: 'merge', - ) + modal_ready() set( css: '.modal input[name="master_ticket_number"]', value: ticket3[:number], diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index 848cd17ff..1c72eef83 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -96,10 +96,8 @@ class AgentTicketOverviewLevel0Test < TestCase # click options and enable number and article count click(css: '.content.active [data-type="settings"]') - watch_for( - css: '.modal h1', - value: 'Edit', - ) + modal_ready() + check( css: '.modal input[value="number"]', ) @@ -156,10 +154,8 @@ class AgentTicketOverviewLevel0Test < TestCase # disable number and article count click(css: '.content.active [data-type="settings"]') - watch_for( - css: '.modal h1', - value: 'Edit', - ) + modal_ready() + uncheck( css: '.modal input[value="number"]', ) diff --git a/test/browser/agent_ticket_tag_test.rb b/test/browser/agent_ticket_tag_test.rb index bf7adf729..1013ff8ae 100644 --- a/test/browser/agent_ticket_tag_test.rb +++ b/test/browser/agent_ticket_tag_test.rb @@ -254,7 +254,11 @@ class AgentTicketTagTest < TestCase browser: browser2, js: "$('.content.active .js-name:contains(\"tag3\")').click()", ) - sleep 2 + + modal_ready( + browser: browser2, + ) + set( browser: browser2, css: '.modal [name="name"]', @@ -308,7 +312,11 @@ class AgentTicketTagTest < TestCase browser: browser2, js: "$('.content.active .js-name:contains(\"tag5\")').closest('tr').find('.js-delete').click()", ) - sleep 2 + + modal_ready( + browser: browser2, + ) + click( browser: browser2, css: '.modal .js-submit', diff --git a/test/browser/agent_ticket_text_module_test.rb b/test/browser/agent_ticket_text_module_test.rb index 27caa39b0..ca44ff399 100644 --- a/test/browser/agent_ticket_text_module_test.rb +++ b/test/browser/agent_ticket_text_module_test.rb @@ -227,7 +227,8 @@ class AgentTicketTextModuleTest < TestCase browser: browser2, css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]', ) - sleep 1 + + modal_ready(browser: browser2) ticket_customer_select( browser: browser2, @@ -240,10 +241,7 @@ class AgentTicketTextModuleTest < TestCase css: '.modal-content .js-submit', ) - watch_for_disappear( - browser: browser2, - css: '.modal', - ) + modal_disappear(browser: browser2) set( browser: browser2, diff --git a/test/browser/agent_ticket_time_accounting_test.rb b/test/browser/agent_ticket_time_accounting_test.rb index 3bfafb8df..2f047577d 100644 --- a/test/browser/agent_ticket_time_accounting_test.rb +++ b/test/browser/agent_ticket_time_accounting_test.rb @@ -41,11 +41,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - - watch_for( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_ready() set( css: '.content.active .modal [name=time_unit]', value: '4', @@ -53,10 +49,8 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - watch_for_disappear( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_disappear() + watch_for( css: '.content.active .js-timeUnit', value: '4', @@ -80,11 +74,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - - watch_for( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_ready() set( css: '.content.active .modal [name=time_unit]', value: '4,6', @@ -92,10 +82,8 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - watch_for_disappear( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_disappear() + watch_for( css: '.content.active .js-timeUnit', value: '4.6', @@ -111,10 +99,7 @@ class AgentTicketTimeAccountingTest < TestCase css: '.active .js-submit', ) - watch_for( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_ready() set( css: '.content.active .modal [name=time_unit]', value: '4abc', @@ -132,10 +117,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - watch_for_disappear( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_disappear() watch_for( css: '.content.active .js-timeUnit', value: '8.6', @@ -198,29 +180,18 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - - watch_for( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_ready() # Click outside the modal to make it disappear execute( js: 'document.elementFromPoint(300, 100).click();', ) - watch_for_disappear( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_disappear() click( css: '.active .js-submit', ) - watch_for( - css: '.content.active .modal', - value: 'Time Accounting', - ) - + modal_ready() set( css: '.content.active .modal [name=time_unit]', value: '4', @@ -228,10 +199,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - watch_for_disappear( - css: '.content.active .modal', - value: 'Time Accounting', - ) + modal_disappear() # disable time accounting click( diff --git a/test/browser/agent_ticket_zoom_hide_test.rb b/test/browser/agent_ticket_zoom_hide_test.rb index 984df91e0..2f1210124 100644 --- a/test/browser/agent_ticket_zoom_hide_test.rb +++ b/test/browser/agent_ticket_zoom_hide_test.rb @@ -52,18 +52,14 @@ class AgentTicketZoomHideTest < TestCase css: '.attachment-icon img', ) - watch_for( - css: 'body > .modal', - ) + modal_ready() # Now go to a previous ticket and confirm that the modal disappears location( url: browser_url + '/#ticket/zoom/1', ) sleep 2 - exists_not( - css: 'body > .modal', - ) + modal_disappear() end def teardown diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index 906427e0e..15555cc80 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -35,11 +35,7 @@ class AgentUserManageTest < TestCase sleep 0.5 click(css: '.content.active .newTicket .recipientList-entry.js-objectNew') - watch_for( - css: '.content.active .modal', - timeout: 1, - ) - + modal_ready() set( css: '.content.active .modal input[name="firstname"]', value: firstname, @@ -54,6 +50,8 @@ class AgentUserManageTest < TestCase ) click(css: '.content.active .modal button.js-submit') + modal_disappear() + sleep 4 # check is used to check selected @@ -170,10 +168,7 @@ class AgentUserManageTest < TestCase click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]') - watch_for( - css: '.content.active .modal', - ) - + modal_ready() click(css: '.content.active .modal [name="customer_id_completion"]') # check if pulldown is open, it's not working stable via selenium @@ -230,10 +225,7 @@ class AgentUserManageTest < TestCase ) click(css: '.content.active .modal button.js-submit') - - watch_for_disappear( - css: '.content.active .modal', - ) + modal_disappear() watch_for( css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index 664a03d0f..929502aa4 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -43,10 +43,7 @@ class AgentUserProfileTest < TestCase click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - watch_for( - css: '.active .modal', - value: 'note', - ) + modal_ready() watch_for( css: '.active .modal', value: 'some note 123', @@ -61,6 +58,7 @@ class AgentUserProfileTest < TestCase value: 'some note abc', ) click(css: '.active .modal button.js-submit') + modal_disappear() watch_for( css: '.active .profile-window', @@ -76,15 +74,14 @@ class AgentUserProfileTest < TestCase # change lastname back click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - watch_for( - css: '.active .modal', - value: 'note', - ) + + modal_ready() set( css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.active .modal button.js-submit') + modal_disappear() verify_task( data: { diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index 7350986ce..0d5b0b9d8 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -462,6 +462,8 @@ class ChatTest < TestCase browser: agent, css: '.active .js-settings', ) + + modal_ready(browser: agent) set( browser: agent, css: '.modal [name="chat::phrase::1"]', diff --git a/test/browser/first_steps_test.rb b/test/browser/first_steps_test.rb index 2506abbda..bd3f30012 100644 --- a/test/browser/first_steps_test.rb +++ b/test/browser/first_steps_test.rb @@ -23,7 +23,9 @@ class FirstStepsTest < TestCase # invite agent (with more then one group) click(css: '.active.content .js-inviteAgent') - sleep 4 + + modal_ready() + set( css: '.modal [name="firstname"]', value: 'Bob', @@ -49,10 +51,11 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Sending', ) + modal_disappear() # invite customer click(css: '.active.content .js-inviteCustomer') - sleep 4 + modal_ready() set( css: '.modal [name="firstname"]', value: 'Client', @@ -81,12 +84,14 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Sending', ) + modal_disappear() # test ticket click( css: '.active.content .js-testTicket', fast: true, ) + modal_ready() watch_for( css: 'body div.modal', value: 'A Test Ticket has been created', @@ -99,6 +104,8 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Test Ticket', ) + modal_disappear() + execute( js: '$(".active.content .sidebar").show()', ) diff --git a/test/browser/keyboard_shortcuts_test.rb b/test/browser/keyboard_shortcuts_test.rb index c266cb85d..0f971ef49 100644 --- a/test/browser/keyboard_shortcuts_test.rb +++ b/test/browser/keyboard_shortcuts_test.rb @@ -37,27 +37,15 @@ class KeyboardShortcutsTest < TestCase shortcut(key: 'h') end end - watch_for( - css: '.modal', - value: 'Keyboard Shortcuts', - timeout: 6, - ) + modal_ready() # hide shortkeys shortcut(key: 'h') - watch_for_disappear( - css: '.modal', - value: 'Keyboard Shortcuts', - timeout: 2, - ) + modal_disappear() # show shortkeys shortcut(key: 'h') - watch_for( - css: '.modal', - value: 'Keyboard Shortcuts', - timeout: 2, - ) + modal_ready() # show notifications shortcut(key: 'a') diff --git a/test/browser/maintenance_mode_test.rb b/test/browser/maintenance_mode_test.rb index f00952423..b617688ea 100644 --- a/test/browser/maintenance_mode_test.rb +++ b/test/browser/maintenance_mode_test.rb @@ -39,15 +39,12 @@ class MaintenanceModeTest < TestCase ) # check warning - watch_for( - browser: browser1, - css: '.content.active .modal .modal-header', - value: 'confirm', - ) + modal_ready(browser: browser1) click( browser: browser1, css: '.content.active .modal .js-submit', ) + modal_disappear(browser: browser1) watch_for( browser: browser2, @@ -127,15 +124,12 @@ class MaintenanceModeTest < TestCase ) # check warning - watch_for( - browser: browser1, - css: '.content.active .modal .modal-header', - value: 'confirm', - ) + modal_ready(browser: browser1) click( browser: browser1, css: '.content.active .modal .js-submit', ) + modal_disappear(browser: browser1) watch_for( browser: browser2, diff --git a/test/browser/maintenance_session_message_test.rb b/test/browser/maintenance_session_message_test.rb index 5ea58c808..8c7093a4c 100644 --- a/test/browser/maintenance_session_message_test.rb +++ b/test/browser/maintenance_session_message_test.rb @@ -50,6 +50,7 @@ class MaintenanceSessionMessageTest < TestCase css: '.content.active .js-Message button.js-submit', ) + modal_ready(browser: browser2) watch_for( browser: browser2, css: '.modal', @@ -71,6 +72,7 @@ class MaintenanceSessionMessageTest < TestCase browser: browser2, css: 'div.modal-header .js-close', ) + modal_disappear(browser: browser2) # check #2 click( @@ -98,6 +100,7 @@ class MaintenanceSessionMessageTest < TestCase css: '.content.active .js-Message button.js-submit', ) + modal_ready(browser: browser2) watch_for( browser: browser2, css: '.modal', @@ -119,6 +122,7 @@ class MaintenanceSessionMessageTest < TestCase browser: browser2, css: 'div.modal-header .js-close', ) + modal_disappear(browser: browser2) # check #3 click( @@ -149,6 +153,7 @@ class MaintenanceSessionMessageTest < TestCase css: '.content.active .js-Message button.js-submit', ) + modal_ready(browser: browser2) watch_for( browser: browser2, css: '.modal', diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index 0ecc13415..ba89f07bf 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -28,13 +28,14 @@ class ManageTest < TestCase ) click(css: '.table-overview tr:last-child td') - sleep 2 + modal_ready() set( css: '.modal input[name="lastname"]', value: "2Manage Lastname#{random}", ) click(css: '.modal button.js-submit') + modal_disappear() watch_for( css: 'body', @@ -55,8 +56,8 @@ class ManageTest < TestCase sleep 1 click(css: '.content:not(.hide) .action:last-child .js-edit') - sleep 1 + modal_ready() set( css: '.modal input[name=name]', value: "some sla update #{random}", @@ -66,6 +67,7 @@ class ManageTest < TestCase value: '2:01', ) click(css: '.modal button.js-submit') + modal_disappear() watch_for( css: 'body', diff --git a/test/browser/preferences_token_access_test.rb b/test/browser/preferences_token_access_test.rb index d6d97cfee..5329221d3 100644 --- a/test/browser/preferences_token_access_test.rb +++ b/test/browser/preferences_token_access_test.rb @@ -16,11 +16,8 @@ class PreferencesTokenAccessTest < TestCase click(css: 'a[href="#profile/token_access"]') click(css: '.content.active .js-create') - watch_for( - css: '.modal .modal-title', - value: 'Add a Personal Access Token' - ) + modal_ready() set( css: '.content.active .modal .js-input', value: 'Some App#1', @@ -37,6 +34,8 @@ class PreferencesTokenAccessTest < TestCase value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') + modal_disappear() + watch_for( css: '.content.active .js-tokenList', value: 'Some App#1' @@ -47,10 +46,8 @@ class PreferencesTokenAccessTest < TestCase ) click(css: '.content.active .js-create') - watch_for( - css: '.modal .modal-title', - value: 'Add a Personal Access Token' - ) + + modal_ready() set( css: '.content.active .modal .js-input', value: 'Some App#2', @@ -63,12 +60,16 @@ class PreferencesTokenAccessTest < TestCase value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') + modal_disappear() + watch_for( css: '.content.active .js-tokenList', value: 'Some App#2' ) click(css: '.content.active .js-tokenList a') + + modal_ready() watch_for( css: '.content.active .modal .modal-header', value: 'confirm', @@ -76,6 +77,7 @@ class PreferencesTokenAccessTest < TestCase click( css: '.content.active .modal .js-submit', ) + modal_disappear() watch_for_disappear( css: '.content.active .js-tokenList', value: 'Some App#2' diff --git a/test/browser/signup_password_change_and_reset_test.rb b/test/browser/signup_password_change_and_reset_test.rb index 193268f5b..c807e5fd7 100644 --- a/test/browser/signup_password_change_and_reset_test.rb +++ b/test/browser/signup_password_change_and_reset_test.rb @@ -63,11 +63,9 @@ class SignupPasswordChangeAndResetTest < TestCase execute( js: 'App.Event.trigger("user_signup_verify", App.Session.get())', ) - watch_for( - css: '.modal', - value: 'Account not verified', - ) + modal_ready() click(css: '.modal .js-submit') + execute( js: 'App.Auth.logout()', ) @@ -83,9 +81,7 @@ class SignupPasswordChangeAndResetTest < TestCase css: '#content', value: 'Your email address has been verified', ) - exists_not( - css: '.modal', - ) + modal_disappear() sleep 2 # change password diff --git a/test/browser/translation_test.rb b/test/browser/translation_test.rb index be17b75b5..6efcd617b 100644 --- a/test/browser/translation_test.rb +++ b/test/browser/translation_test.rb @@ -283,13 +283,14 @@ class TranslationTest < TestCase ) click(css: '.content.active .js-syncChanges') + + modal_ready() watch_for( css: '.content.active .modal', value: 'Letzte Übersetzung laden', ) - watch_for_disappear( - css: '.content.active .modal', - timeout: 6 * 60, + modal_disappear( + timeout: 6.minutes, ) click(css: 'a[href="#current_user"]') diff --git a/test/browser/user_access_permissions_test.rb b/test/browser/user_access_permissions_test.rb index 9dfc0fba2..605ca3177 100644 --- a/test/browser/user_access_permissions_test.rb +++ b/test/browser/user_access_permissions_test.rb @@ -39,7 +39,6 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action [data-type="edit"]') modal_ready() - watch_for( css: '.content.active .modal', value: 'some note 123', @@ -54,6 +53,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') + modal_disappear() watch_for( css: '.content.active .profile-window', @@ -71,12 +71,12 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action [data-type="edit"]') modal_ready() - set( css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.content.active .modal button.js-submit') + modal_disappear() verify_task( data: { @@ -188,18 +188,16 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') modal_ready() - set( css: '.modal [name="lastname"]', value: 'B2', ) - set( css: '.modal [data-name="note"]', value: 'some note abc', ) - click(css: '.content.active .modal button.js-submit') + modal_disappear() watch_for( css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', @@ -216,7 +214,6 @@ class AgentProfilePermissionsTest < TestCase click(css: 'li[data-type="customer-edit"]') modal_ready() - set( css: '.modal [name="lastname"]', value: 'Braun', @@ -226,6 +223,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') + modal_disappear() watch_for( css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', @@ -279,7 +277,6 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action [data-type="edit"]') modal_ready() - set( css: '.modal [name="lastname"]', value: 'B2', @@ -289,6 +286,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') + modal_disappear() watch_for( css: '.content.active .profile-window', @@ -306,7 +304,6 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action [data-type="edit"]') modal_ready() - set( css: '.modal [name="lastname"]', value: 'Braun', @@ -316,6 +313,7 @@ class AgentProfilePermissionsTest < TestCase value: 'note', ) click(css: '.content.active .modal button.js-submit') + modal_disappear() verify_task( data: { From cab0d43d5e583cc409ecd9a69444940d211e752b Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 25 Jul 2018 10:11:45 +0200 Subject: [PATCH 12/12] Test stabilization: Applied required changes for HTTPS migration of VZ 'test' server. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7353601b4..bfe5b71b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -302,7 +302,7 @@ test:integration:otrs_6_mysql: - mysql script: - export RAILS_ENV=test - - export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" + - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - rake db:create - rake db:migrate - ruby -I test/ test/integration/otrs_import_test.rb @@ -315,7 +315,7 @@ test:integration:otrs_6_postgresql: - postgresql script: - export RAILS_ENV=test - - export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" + - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - rake db:create - rake db:migrate - ruby -I test/ test/integration/otrs_import_test.rb