From e8259758b81287768d1c96050e0e12c9325e17d2 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Tue, 25 Jan 2022 10:36:20 +0100 Subject: [PATCH] Maintenance: Drop unneeded waits to stabilize capybara tests. --- spec/support/capybara/common_actions.rb | 3 +- spec/system/basic/authentication_spec.rb | 14 +- spec/system/chat_spec.rb | 6 +- spec/system/dashboard_spec.rb | 14 +- spec/system/data_privacy_spec.rb | 32 ++-- .../system/examples/core_workflow_examples.rb | 164 +++++++++--------- spec/system/examples/pagination_examples.rb | 22 +-- spec/system/keyboard_shortcuts_spec.rb | 2 +- spec/system/manage/trigger_spec.rb | 2 +- spec/system/manage/users_spec.rb | 4 +- spec/system/profile/out_of_office_spec.rb | 4 +- spec/system/search_spec.rb | 2 +- spec/system/settings/proxy_spec.rb | 40 ++--- spec/system/setup/system_spec.rb | 4 +- spec/system/ticket/create_spec.rb | 26 +-- spec/system/ticket/update_spec.rb | 18 +- spec/system/ticket/zoom_spec.rb | 66 +++---- 17 files changed, 211 insertions(+), 212 deletions(-) diff --git a/spec/support/capybara/common_actions.rb b/spec/support/capybara/common_actions.rb index 3de493978..b8d695f21 100644 --- a/spec/support/capybara/common_actions.rb +++ b/spec/support/capybara/common_actions.rb @@ -164,8 +164,7 @@ module CommonActions route = Regexp.new(Regexp.quote("/##{route}")) end - # wait 1 sec by default because Firefox is slow - options.reverse_merge!(wait: 1, url: true) + options.reverse_merge!(url: true) have_current_path(route, **options) end diff --git a/spec/system/basic/authentication_spec.rb b/spec/system/basic/authentication_spec.rb index 4721590dc..56edcc8d8 100644 --- a/spec/system/basic/authentication_spec.rb +++ b/spec/system/basic/authentication_spec.rb @@ -34,7 +34,7 @@ RSpec.describe 'Authentication', type: :system do expect(cookie[:expires]).to be_truthy logout - expect_current_route 'login', wait: 10 + expect_current_route 'login' # Check that cookies has no longer a expire date after logout. cookie = cookie('^_zammad.+?') @@ -43,12 +43,12 @@ RSpec.describe 'Authentication', type: :system do it 'Logout' do logout - expect_current_route 'login', wait: 10 + expect_current_route 'login' end it 'will unset user attributes after logout' do logout - expect_current_route 'login', wait: 10 + expect_current_route 'login' visit '/#signup' @@ -59,20 +59,20 @@ RSpec.describe 'Authentication', type: :system do it 'Login and redirect to requested url', authenticated_as: false do visit 'ticket/zoom/1' - expect_current_route 'login', wait: 10 + expect_current_route 'login' login( username: 'admin@example.com', password: 'test', ) - expect_current_route 'ticket/zoom/1', wait: 10 + expect_current_route 'ticket/zoom/1' end it 'Login and redirect to requested url via external authentication', authenticated_as: false do visit 'ticket/zoom/1' - expect_current_route 'login', wait: 10 + expect_current_route 'login' # simulate jump to external ressource visit 'https://www.zammad.org' @@ -87,7 +87,7 @@ RSpec.describe 'Authentication', type: :system do # jump back and check if origin requested url is shown visit '' - expect_current_route 'ticket/zoom/1', wait: 10 + expect_current_route 'ticket/zoom/1' expect(current_login).to eq('admin@example.com') end diff --git a/spec/system/chat_spec.rb b/spec/system/chat_spec.rb index c4270da51..9660bd246 100644 --- a/spec/system/chat_spec.rb +++ b/spec/system/chat_spec.rb @@ -51,7 +51,7 @@ RSpec.describe 'Chat Handling', type: :system do expect(page).to have_css('.zammad-chat', visible: :all) expect(page).to have_css('.zammad-chat-is-hidden', visible: :all) - expect(page).to have_no_css('.open-zammad-chat:not([style*="display: none"]', visible: :all, wait: 20) + expect(page).to have_no_css('.open-zammad-chat:not([style*="display: none"]', visible: :all) end end @@ -196,7 +196,7 @@ RSpec.describe 'Chat Handling', type: :system do # No customer action, hide the widget. expect(page).to have_css('.zammad-chat') - expect(page).to have_no_css('.zammad-chat', wait: 20) + expect(page).to have_no_css('.zammad-chat') refresh @@ -204,7 +204,7 @@ RSpec.describe 'Chat Handling', type: :system do open_chat_dialog check_content('.zammad-chat-modal-text', %r{(waiting|Warte)}) - check_content('.zammad-chat-modal-text', %r{(takes longer|dauert länger)}, wait: 20) + check_content('.zammad-chat-modal-text', %r{(takes longer|dauert länger)}) refresh diff --git a/spec/system/dashboard_spec.rb b/spec/system/dashboard_spec.rb index 7177fa99b..f43e604a3 100644 --- a/spec/system/dashboard_spec.rb +++ b/spec/system/dashboard_spec.rb @@ -51,8 +51,8 @@ RSpec.describe 'Dashboard', type: :system do end it 'does logout user' do - expect(page).to have_text('Due to inactivity, you will be automatically logged out within the next 30 seconds.', wait: 20) - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you will be automatically logged out within the next 30 seconds.') + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end it 'does not logout user', authenticated_as: :admin do @@ -65,7 +65,7 @@ RSpec.describe 'Dashboard', type: :system do it 'does logout user' do expect(page).to have_no_text('Due to inactivity, you have been automatically logged out.') Setting.set('session_timeout', { default: '1' }) - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end end @@ -76,7 +76,7 @@ RSpec.describe 'Dashboard', type: :system do end it 'does logout user' do - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end end @@ -87,7 +87,7 @@ RSpec.describe 'Dashboard', type: :system do end it 'does logout user' do - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end end @@ -98,7 +98,7 @@ RSpec.describe 'Dashboard', type: :system do end it 'does logout user' do - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end end @@ -112,7 +112,7 @@ RSpec.describe 'Dashboard', type: :system do # backend tests for the reset session = ActiveRecord::SessionStore::Session.all.detect { |s| s.data['user_id'] == admin.id } SessionTimeoutJob::Session.new(session).frontend_timeout - expect(page).to have_text('Due to inactivity, you have been automatically logged out.', wait: 20) + expect(page).to have_text('Due to inactivity, you have been automatically logged out.') end end diff --git a/spec/system/data_privacy_spec.rb b/spec/system/data_privacy_spec.rb index e2837112e..038ae7359 100644 --- a/spec/system/data_privacy_spec.rb +++ b/spec/system/data_privacy_spec.rb @@ -22,15 +22,15 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a click '.js-new' find(:css, '.js-input').send_keys(customer.firstname) - expect(page).to have_css('.searchableSelect-option-text', wait: 5) + expect(page).to have_css('.searchableSelect-option-text') click '.searchableSelect-option-text' fill_in 'Are you sure?', with: 'DELETE' - expect(page).to have_no_text('DELETE ORGANIZATION?', wait: 5) + expect(page).to have_no_text('DELETE ORGANIZATION?') click '.js-submit' - expect(page).to have_text('in process', wait: 5) + expect(page).to have_text('in process') DataPrivacyTaskJob.perform_now - expect(page).to have_text('completed', wait: 5) + expect(page).to have_text('completed') end context 'when customer is the single user of the organization' do @@ -49,15 +49,15 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a click '.js-new' find(:css, '.js-input').send_keys(customer.firstname) - expect(page).to have_css('.searchableSelect-option-text', wait: 5) + expect(page).to have_css('.searchableSelect-option-text') click '.searchableSelect-option-text' fill_in 'Are you sure?', with: 'DELETE' - expect(page).to have_text('DELETE ORGANIZATION?', wait: 5) + expect(page).to have_text('DELETE ORGANIZATION?') click '.js-submit' - expect(page).to have_text('in process', wait: 5) + expect(page).to have_text('in process') DataPrivacyTaskJob.perform_now - expect(page).to have_text('completed', wait: 5) + expect(page).to have_text('completed') end it 'deletes customer by email' do @@ -65,15 +65,15 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a click '.js-new' find(:css, '.js-input').send_keys(customer.email) - expect(page).to have_css('.searchableSelect-option-text', wait: 5) + expect(page).to have_css('.searchableSelect-option-text') click '.searchableSelect-option-text' fill_in 'Are you sure?', with: 'DELETE' - expect(page).to have_text('DELETE ORGANIZATION?', wait: 5) + expect(page).to have_text('DELETE ORGANIZATION?') click '.js-submit' - expect(page).to have_text('in process', wait: 5) + expect(page).to have_text('in process') DataPrivacyTaskJob.perform_now - expect(page).to have_text('completed', wait: 5) + expect(page).to have_text('completed') end end end @@ -88,9 +88,9 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a fill_in 'Are you sure?', with: 'DELETE' click '.js-submit' - expect(page).to have_text('in process', wait: 5) + expect(page).to have_text('in process') DataPrivacyTaskJob.perform_now - expect(page).to have_text('completed', wait: 5) + expect(page).to have_text('completed') end end @@ -105,9 +105,9 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a fill_in 'Are you sure?', with: 'DELETE' click '.js-submit' - expect(page).to have_text('in process', wait: 5) + expect(page).to have_text('in process') DataPrivacyTaskJob.perform_now - expect(page).to have_text('completed', wait: 5) + expect(page).to have_text('completed') end end end diff --git a/spec/system/examples/core_workflow_examples.rb b/spec/system/examples/core_workflow_examples.rb index d7a45bfeb..b1ee0fa91 100644 --- a/spec/system/examples/core_workflow_examples.rb +++ b/spec/system/examples/core_workflow_examples.rb @@ -46,7 +46,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("input[name='#{field_name}']", wait: 10) + expect(page).to have_selector("input[name='#{field_name}']") end end @@ -64,7 +64,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -82,7 +82,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -100,7 +100,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -118,7 +118,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -136,7 +136,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -154,7 +154,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -172,7 +172,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_field(field_name, with: '4cddb2twza', wait: 10) + expect(page).to have_field(field_name, with: '4cddb2twza') end end @@ -191,7 +191,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_field(field_name, with: '9999', wait: 10) + expect(page).to have_field(field_name, with: '9999') end end @@ -217,7 +217,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_field(field_name, with: '9999', wait: 10) + expect(page).to have_no_field(field_name, with: '9999') end end end @@ -244,7 +244,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("textarea[name='#{field_name}']", wait: 10) + expect(page).to have_selector("textarea[name='#{field_name}']") end end @@ -262,7 +262,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -280,7 +280,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -298,7 +298,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -316,7 +316,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -334,7 +334,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -352,7 +352,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -370,7 +370,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_field(field_name, with: '4cddb2twza', wait: 10) + expect(page).to have_field(field_name, with: '4cddb2twza') end end @@ -389,7 +389,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_field(field_name, with: '9999', wait: 10) + expect(page).to have_field(field_name, with: '9999') end end @@ -415,7 +415,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_field(field_name, with: '9999', wait: 10) + expect(page).to have_no_field(field_name, with: '9999') end end end @@ -442,7 +442,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}']") end end @@ -460,7 +460,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -478,7 +478,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -496,7 +496,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -514,7 +514,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -532,7 +532,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -550,7 +550,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -568,9 +568,9 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']", wait: 10) - expect(page).to have_no_selector("select[name='#{field_name}'] option[value='key_2']", wait: 10) - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']") + expect(page).to have_no_selector("select[name='#{field_name}'] option[value='key_2']") + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']") end end @@ -588,7 +588,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3'][selected]", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3'][selected]") end end @@ -614,7 +614,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3'][selected]", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3'][selected]") end end end @@ -640,7 +640,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}']") end end @@ -658,7 +658,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -676,7 +676,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -694,7 +694,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -712,7 +712,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -730,7 +730,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -748,7 +748,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -766,9 +766,9 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']", wait: 10) - expect(page).to have_no_selector("select[name='#{field_name}'] option[value='key_2']", wait: 10) - expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']") + expect(page).to have_no_selector("select[name='#{field_name}'] option[value='key_2']") + expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']") end end @@ -786,7 +786,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - wait(5).until { page.find("select[name='#{field_name}']").value == ['key_3'] } + wait.until { page.find("select[name='#{field_name}']").value == ['key_3'] } expect(page.find("select[name='#{field_name}']").value).to eq(['key_3']) end end @@ -813,7 +813,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - wait(5).until { page.find("select[name='#{field_name}']").value == ['key_3'] } + wait.until { page.find("select[name='#{field_name}']").value == ['key_3'] } expect(page.find("select[name='#{field_name}']").value).to eq(['key_3']) end end @@ -840,7 +840,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}']") end end @@ -858,7 +858,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -876,7 +876,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -894,7 +894,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -912,7 +912,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -930,8 +930,8 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='false']", wait: 10) - expect(page).to have_no_selector("select[name='#{field_name}'] option[value='true']", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='false']") + expect(page).to have_no_selector("select[name='#{field_name}'] option[value='true']") end end @@ -949,7 +949,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='true'][selected]", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='true'][selected]") end end @@ -975,7 +975,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("select[name='#{field_name}'] option[value='false'][selected]", wait: 10) + expect(page).to have_selector("select[name='#{field_name}'] option[value='false'][selected]") end end end @@ -1001,7 +1001,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("input[name='#{field_name}']", visible: :all, wait: 10) + expect(page).to have_selector("input[name='#{field_name}']", visible: :all) end end @@ -1019,7 +1019,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :all, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :all) end end @@ -1037,7 +1037,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -1055,7 +1055,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -1073,7 +1073,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -1091,7 +1091,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -1109,7 +1109,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -1127,11 +1127,11 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector('span.searchableSelect-option-text', text: 'Incident', visible: :all, wait: 10) - expect(page).to have_selector('span.searchableSelect-option-text', text: 'Hardware', visible: :all, wait: 10) - expect(page).to have_selector('span.searchableSelect-option-text', text: 'Monitor', visible: :all, wait: 10) - expect(page).to have_no_selector('span.searchableSelect-option-text', text: 'Mouse', visible: :all, wait: 10) - expect(page).to have_no_selector('span.searchableSelect-option-text', text: 'Softwareproblem', visible: :all, wait: 10) + expect(page).to have_selector('span.searchableSelect-option-text', text: 'Incident', visible: :all) + expect(page).to have_selector('span.searchableSelect-option-text', text: 'Hardware', visible: :all) + expect(page).to have_selector('span.searchableSelect-option-text', text: 'Monitor', visible: :all) + expect(page).to have_no_selector('span.searchableSelect-option-text', text: 'Mouse', visible: :all) + expect(page).to have_no_selector('span.searchableSelect-option-text', text: 'Softwareproblem', visible: :all) end end @@ -1149,7 +1149,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("input[name='#{field_name}'][value='Incident::Hardware::Monitor']", visible: :all, wait: 10) + expect(page).to have_selector("input[name='#{field_name}'][value='Incident::Hardware::Monitor']", visible: :all) end end @@ -1175,7 +1175,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("input[name='#{field_name}'][value='Incident']", visible: :all, wait: 10) + expect(page).to have_selector("input[name='#{field_name}'][value='Incident']", visible: :all) end end end @@ -1201,7 +1201,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}']", wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}']") end end @@ -1219,7 +1219,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -1237,7 +1237,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -1255,7 +1255,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -1273,7 +1273,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -1291,7 +1291,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -1309,7 +1309,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end end @@ -1335,7 +1335,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}']", wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}']") end end @@ -1353,7 +1353,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden) end end @@ -1371,7 +1371,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10) + expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden) end end @@ -1389,7 +1389,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*') end end @@ -1407,7 +1407,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10) + expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*') end end @@ -1425,7 +1425,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_no_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end @@ -1443,7 +1443,7 @@ RSpec.shared_examples 'core workflow' do it 'does perform' do before_it.call - expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly", wait: 10) + expect(page).to have_selector("div[data-attribute-name='#{field_name}'].is-readonly") end end end @@ -1476,7 +1476,7 @@ RSpec.shared_examples 'core workflow' do it 'does not display hidden fields as mandatory' do before_it.call - expect(page.find("input[name='#{field_name}']", visible: :hidden, wait: 10)[:required]).not_to eq('true') + expect(page.find("input[name='#{field_name}']", visible: :hidden)[:required]).not_to eq('true') end end end diff --git a/spec/system/examples/pagination_examples.rb b/spec/system/examples/pagination_examples.rb index ac80dacab..962c103ee 100644 --- a/spec/system/examples/pagination_examples.rb +++ b/spec/system/examples/pagination_examples.rb @@ -10,38 +10,38 @@ RSpec.shared_examples 'pagination' do |model:, klass:, path:, sort_by: :name| it 'does paginate', authenticated_as: :authenticate do visit path - expect(page).to have_css('.js-pager', wait: 10) + expect(page).to have_css('.js-pager') class_page1 = klass.order(sort_by => :asc, id: :asc).offset(50).first - expect(page).to have_text(class_page1.name, wait: 10) + expect(page).to have_text(class_page1.name) expect(page).to have_css('.js-page.is-selected', text: '1') - page.first('.js-page', text: '2', wait: 10).click + page.first('.js-page', text: '2').click class_page2 = klass.order(sort_by => :asc, id: :asc).offset(175).first - expect(page).to have_text(class_page2.name, wait: 10) + expect(page).to have_text(class_page2.name) expect(page).to have_css('.js-page.is-selected', text: '2') - page.first('.js-page', text: '3', wait: 10).click + page.first('.js-page', text: '3').click class_page3 = klass.order(sort_by => :asc, id: :asc).offset(325).first - expect(page).to have_text(class_page3.name, wait: 10) + expect(page).to have_text(class_page3.name) expect(page).to have_css('.js-page.is-selected', text: '3') - page.first('.js-page', text: '4', wait: 10).click + page.first('.js-page', text: '4').click class_page4 = klass.order(sort_by => :asc, id: :asc).offset(475).first - expect(page).to have_text(class_page4.name, wait: 10) + expect(page).to have_text(class_page4.name) expect(page).to have_css('.js-page.is-selected', text: '4') - page.first('.js-page', text: '1', wait: 10).click + page.first('.js-page', text: '1').click page.first('.js-tableHead[data-column-key=name]').click - expect(page).to have_text(class_page1.name, wait: 10) + expect(page).to have_text(class_page1.name) expect(page).to have_css('.js-page.is-selected', text: '1') page.first('.js-tableHead[data-column-key=name]').click class_last = klass.order(sort_by => :desc).first - expect(page).to have_text(class_last.name, wait: 10) + expect(page).to have_text(class_last.name) end end diff --git a/spec/system/keyboard_shortcuts_spec.rb b/spec/system/keyboard_shortcuts_spec.rb index d78b10b4b..49f76dede 100644 --- a/spec/system/keyboard_shortcuts_spec.rb +++ b/spec/system/keyboard_shortcuts_spec.rb @@ -85,7 +85,7 @@ RSpec.describe 'Keyboard Shortcuts', type: :system do context 'for list of shortcuts' do before do send_keys([*hot_keys, 'h']) - wait(5).until_exists { find :active_modal_content } + wait.until_exists { find :active_modal_content } end it 'shows list of shortcuts' do diff --git a/spec/system/manage/trigger_spec.rb b/spec/system/manage/trigger_spec.rb index 108ed290b..87bb43266 100644 --- a/spec/system/manage/trigger_spec.rb +++ b/spec/system/manage/trigger_spec.rb @@ -197,7 +197,7 @@ RSpec.describe 'Manage > Trigger', type: :system do it 'updates the ticket with the trigger condition' do wait.until { ticket.multiselect_previously_changed? && ticket.articles.present? } expect(ticket.articles).not_to be_empty - expect(page).to have_text 'Test body note', wait: 5 + expect(page).to have_text 'Test body note' end end diff --git a/spec/system/manage/users_spec.rb b/spec/system/manage/users_spec.rb index caf0198cf..ce675c977 100644 --- a/spec/system/manage/users_spec.rb +++ b/spec/system/manage/users_spec.rb @@ -42,12 +42,12 @@ RSpec.describe 'Manage > Users', type: :system do visit 'manage/users' within(:active_content) do - row = find("tr[data-id=\"#{user.id}\"]", wait: 10) + row = find("tr[data-id=\"#{user.id}\"]") row.find('.js-action').click row.find('.js-switchTo').click end - expect(page).to have_text("Zammad looks like this for \"#{user.firstname} #{user.lastname}\"", wait: 10) + expect(page).to have_text("Zammad looks like this for \"#{user.firstname} #{user.lastname}\"") end end diff --git a/spec/system/profile/out_of_office_spec.rb b/spec/system/profile/out_of_office_spec.rb index 19b496800..84de1a158 100644 --- a/spec/system/profile/out_of_office_spec.rb +++ b/spec/system/profile/out_of_office_spec.rb @@ -10,11 +10,11 @@ RSpec.describe 'Profile > Out of Office', type: :system do it 'does find agents' do find(:css, '.js-objectSelect').send_keys('Agent') - expect(page).to have_text('Agent 1 Test', wait: 20) + expect(page).to have_text('Agent 1 Test') end it 'does not find customers' do find(:css, '.js-objectSelect').send_keys('Nicole') - expect(page).to have_no_text('Nicole Braun', wait: 20) + expect(page).to have_no_text('Nicole Braun') end end diff --git a/spec/system/search_spec.rb b/spec/system/search_spec.rb index 1875a7731..3fbd14804 100644 --- a/spec/system/search_spec.rb +++ b/spec/system/search_spec.rb @@ -114,7 +114,7 @@ RSpec.describe 'Search', type: :system, authenticated: true, searchindex: true d end expect do - wait(10, interval: 0.1).until { ticket_1.articles.last&.body == note } + wait.until { ticket_1.articles.last&.body == note } end.not_to raise_error end end diff --git a/spec/system/settings/proxy_spec.rb b/spec/system/settings/proxy_spec.rb index 3f15cb6d3..4a9c3923c 100644 --- a/spec/system/settings/proxy_spec.rb +++ b/spec/system/settings/proxy_spec.rb @@ -22,13 +22,13 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do fill_in 'proxy_password', with: proxy_password click_on 'Test Connection' - expect(page).to have_button('Test Connection', visible: :hidden, wait: 5) - expect(page).to have_button('Submit', visible: :visible, wait: 5) + expect(page).to have_button('Test Connection', visible: :hidden) + expect(page).to have_button('Submit', visible: :visible) find('.js-submit:not(.hide)').click - expect(page).to have_button('Submit', visible: :hidden, wait: 5) - expect(page).to have_button('Test Connection', visible: :visible, wait: 5) + expect(page).to have_button('Submit', visible: :hidden) + expect(page).to have_button('Test Connection', visible: :visible) end end @@ -44,10 +44,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do fill_in 'proxy_password', with: proxy_password click_on 'Test Connection' - expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) - expect(page).to have_css('div.modal-body', text: %r{Invalid proxy address}, wait: 5) - expect(page).to have_button('Test Connection', visible: :visible, wait: 5) - expect(page).to have_button('Submit', visible: :hidden, wait: 5) + expect(page).to have_css('h1.modal-title', text: 'Error') + expect(page).to have_css('div.modal-body', text: %r{Invalid proxy address}) + expect(page).to have_button('Test Connection', visible: :visible) + expect(page).to have_button('Submit', visible: :hidden) end end @@ -62,10 +62,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do fill_in 'proxy_password', with: proxy_password click_on 'Test Connection' - expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) - expect(page).to have_css('div.modal-body', text: %r{Failed to open TCP connection}, wait: 5) - expect(page).to have_button('Test Connection', visible: :visible, wait: 5) - expect(page).to have_button('Submit', visible: :hidden, wait: 5) + expect(page).to have_css('h1.modal-title', text: 'Error') + expect(page).to have_css('div.modal-body', text: %r{Failed to open TCP connection}) + expect(page).to have_button('Test Connection', visible: :visible) + expect(page).to have_button('Submit', visible: :hidden) end end @@ -80,10 +80,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do fill_in 'proxy_password', with: proxy_password click_on 'Test Connection' - expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) - expect(page).to have_css('div.modal-body', text: %r{Access Denied}, wait: 5) - expect(page).to have_button('Test Connection', visible: :visible, wait: 5) - expect(page).to have_button('Submit', visible: :hidden, wait: 5) + expect(page).to have_css('h1.modal-title', text: 'Error') + expect(page).to have_css('div.modal-body', text: %r{Access Denied}) + expect(page).to have_button('Test Connection', visible: :visible) + expect(page).to have_button('Submit', visible: :hidden) end end @@ -98,10 +98,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do fill_in 'proxy_password', with: 'invalid_password' click_on 'Test Connection' - expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) - expect(page).to have_css('div.modal-body', text: %r{Access Denied}, wait: 5) - expect(page).to have_button('Test Connection', visible: :visible, wait: 5) - expect(page).to have_button('Submit', visible: :hidden, wait: 5) + expect(page).to have_css('h1.modal-title', text: 'Error') + expect(page).to have_css('div.modal-body', text: %r{Access Denied}) + expect(page).to have_button('Test Connection', visible: :visible) + expect(page).to have_button('Submit', visible: :hidden) end end diff --git a/spec/system/setup/system_spec.rb b/spec/system/setup/system_spec.rb index 6a208f67d..4eec99938 100644 --- a/spec/system/setup/system_spec.rb +++ b/spec/system/setup/system_spec.rb @@ -70,7 +70,7 @@ RSpec.describe 'System setup process', type: :system, set_up: false, authenticat end # wait for verification process to start - expect(page).to have_css('body', text: 'Verify sending and receiving', wait: 20) + expect(page).to have_css('body', text: 'Verify sending and receiving') # wait for verification process to finish expect(page).to have_css('.js-agent h2', text: 'Invite Colleagues', wait: 2.minutes) @@ -95,7 +95,7 @@ RSpec.describe 'System setup process', type: :system, set_up: false, authenticat # expect Dashboard of a fresh system expect(page).to have_css('body', text: 'My Stats') expect_current_route 'clues' - find(:clues_close, wait: 4).in_fixed_position.click + find(:clues_close).in_fixed_position.click # verify organization and fqdn click(:manage) diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index e5a219453..005dece37 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -91,8 +91,8 @@ RSpec.describe 'Ticket Create', type: :system do use_template(template) # wait till S/MIME check AJAX call is ready - expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('div.js-securityEncrypt.btn--active') + expect(page).to have_css('div.js-securitySign.btn--active') # deactivate encryption and signing click '.js-securityEncrypt' @@ -120,8 +120,8 @@ RSpec.describe 'Ticket Create', type: :system do use_template(template) # wait till S/MIME check AJAX call is ready - expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('div.js-securityEncrypt.btn--active') + expect(page).to have_css('div.js-securitySign.btn--active') # deactivate encryption click '.js-securityEncrypt' @@ -148,8 +148,8 @@ RSpec.describe 'Ticket Create', type: :system do use_template(template) # wait till S/MIME check AJAX call is ready - expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('div.js-securityEncrypt.btn--active') + expect(page).to have_css('div.js-securitySign.btn--active') # deactivate signing click '.js-securitySign' @@ -176,8 +176,8 @@ RSpec.describe 'Ticket Create', type: :system do use_template(template) # wait till S/MIME check AJAX call is ready - expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('div.js-securityEncrypt.btn--active') + expect(page).to have_css('div.js-securitySign.btn--active') click '.js-submit' @@ -202,12 +202,12 @@ RSpec.describe 'Ticket Create', type: :system do it "security defaults sign: #{sign}, encrypt: #{encrypt}" do within(:active_content) do - encrypt_button = find('.js-securityEncrypt', wait: 5) - sign_button = find('.js-securitySign', wait: 5) + encrypt_button = find('.js-securityEncrypt') + sign_button = find('.js-securitySign') active_button_class = '.btn--active' - expect(encrypt_button.matches_css?(active_button_class, wait: 2)).to be(encrypt) - expect(sign_button.matches_css?(active_button_class, wait: 2)).to be(sign) + expect(encrypt_button.matches_css?(active_button_class)).to be(encrypt) + expect(sign_button.matches_css?(active_button_class)).to be(sign) end end end @@ -781,7 +781,7 @@ RSpec.describe 'Ticket Create', type: :system do wait.until { page.all("ul.recipientList-organizationMembers[organization-id='#{organization.id}'] li", visible: :all).count == 52 } # 50 users + back + show more button scroll_into_view('li.js-showMoreMembers') - expect(page).to have_selector("ul.recipientList-organizationMembers[organization-id='#{organization.id}'] li.js-showMoreMembers.hidden", visible: :all, wait: 20) + expect(page).to have_selector("ul.recipientList-organizationMembers[organization-id='#{organization.id}'] li.js-showMoreMembers.hidden", visible: :all) end end end diff --git a/spec/system/ticket/update_spec.rb b/spec/system/ticket/update_spec.rb index 15faef248..784d61e8c 100644 --- a/spec/system/ticket/update_spec.rb +++ b/spec/system/ticket/update_spec.rb @@ -35,7 +35,7 @@ RSpec.describe 'Ticket Update', type: :system do select('closed', from: 'state_id') click('.js-attributeBar .js-submit') - expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]', wait: 10) + expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]') end # the update should have failed and thus the ticket is still in the new state @@ -45,7 +45,7 @@ RSpec.describe 'Ticket Update', type: :system do # update should work now find(".edit [name=#{attribute.name}]").select('name 2') click('.js-attributeBar .js-submit') - expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]', wait: 10) + expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]') end ticket.reload @@ -96,7 +96,7 @@ RSpec.describe 'Ticket Update', type: :system do set_date_field_value(date_attribute.name, '') click('.js-attributeBar .js-submit') - expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]', wait: 10) + expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]') ticket.reload expect(ticket[date_attribute.name]).to eq(nil) @@ -235,21 +235,21 @@ RSpec.describe 'Ticket Update', type: :system do it 'tickets history of both tickets should show the merge event' do visit "#ticket/zoom/#{origin_ticket.id}" within(:active_content) do - expect(page).to have_css('.js-actions .dropdown-toggle', wait: 10) + expect(page).to have_css('.js-actions .dropdown-toggle') click '.js-actions .dropdown-toggle' click '.js-actions .dropdown-menu [data-type="ticket-history"]' - expect(page).to have_css('.modal', wait: 3) + expect(page).to have_css('.modal') modal = find('.modal') expect(modal).to have_content "This ticket was merged into ticket ##{target_ticket.number}" expect(modal).to have_link "##{target_ticket.number}", href: "#ticket/zoom/#{target_ticket.id}" visit "#ticket/zoom/#{target_ticket.id}" - expect(page).to have_css('.js-actions .dropdown-toggle', wait: 3) + expect(page).to have_css('.js-actions .dropdown-toggle') click '.js-actions .dropdown-toggle' click '.js-actions .dropdown-menu [data-type="ticket-history"]' - expect(page).to have_css('.modal', wait: 3) + expect(page).to have_css('.modal') modal = find('.modal') expect(modal).to have_content("Ticket ##{origin_ticket.number} was merged into this ticket") expect(modal).to have_link "##{origin_ticket.number}", href: "#ticket/zoom/#{origin_ticket.id}" @@ -265,7 +265,7 @@ RSpec.describe 'Ticket Update', type: :system do it 'shows the target ticket history' do visit "#ticket/zoom/#{target_ticket.id}" within(:active_content) do - expect(page).to have_css('.js-actions .dropdown-toggle', wait: 3) + expect(page).to have_css('.js-actions .dropdown-toggle') click '.js-actions .dropdown-toggle' click '.js-actions .dropdown-menu [data-type="ticket-history"]' end @@ -287,7 +287,7 @@ RSpec.describe 'Ticket Update', type: :system do it 'shows the origin history' do visit "#ticket/zoom/#{origin_ticket.id}" within(:active_content) do - expect(page).to have_css('.js-actions .dropdown-toggle', wait: 3) + expect(page).to have_css('.js-actions .dropdown-toggle') click '.js-actions .dropdown-toggle' click '.js-actions .dropdown-menu [data-type="ticket-history"]' end diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index bf828643e..fe4b16f67 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -644,8 +644,8 @@ RSpec.describe 'Ticket zoom', type: :system do all('a[data-type=emailReply]').last.click find('.articleNewEdit-body').send_keys('Test') - expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('.js-securityEncrypt.btn--active') + expect(page).to have_css('.js-securitySign.btn--active') click '.js-securityEncrypt' click '.js-securitySign' @@ -663,8 +663,8 @@ RSpec.describe 'Ticket zoom', type: :system do all('a[data-type=emailReply]').last.click find('.articleNewEdit-body').send_keys('Test') - expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('.js-securityEncrypt.btn--active') + expect(page).to have_css('.js-securitySign.btn--active') click '.js-securityEncrypt' @@ -681,8 +681,8 @@ RSpec.describe 'Ticket zoom', type: :system do all('a[data-type=emailReply]').last.click find('.articleNewEdit-body').send_keys('Test') - expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('.js-securityEncrypt.btn--active') + expect(page).to have_css('.js-securitySign.btn--active') click '.js-securitySign' @@ -699,8 +699,8 @@ RSpec.describe 'Ticket zoom', type: :system do all('a[data-type=emailReply]').last.click find('.articleNewEdit-body').send_keys('Test') - expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) - expect(page).to have_css('.js-securitySign.btn--active', wait: 5) + expect(page).to have_css('.js-securityEncrypt.btn--active') + expect(page).to have_css('.js-securitySign.btn--active') click '.js-submit' expect(page).to have_css('.ticket-article-item', count: 2) @@ -731,12 +731,12 @@ RSpec.describe 'Ticket zoom', type: :system do it "security defaults sign: #{sign}, encrypt: #{encrypt}" do within(:active_content) do - encrypt_button = find('.js-securityEncrypt', wait: 5) - sign_button = find('.js-securitySign', wait: 5) + encrypt_button = find('.js-securityEncrypt') + sign_button = find('.js-securitySign') active_button_class = '.btn--active' - expect(encrypt_button.matches_css?(active_button_class, wait: 2)).to be(encrypt) - expect(sign_button.matches_css?(active_button_class, wait: 2)).to be(sign) + expect(encrypt_button.matches_css?(active_button_class)).to be(encrypt) + expect(sign_button.matches_css?(active_button_class)).to be(sign) end end end @@ -1018,7 +1018,7 @@ RSpec.describe 'Ticket zoom', type: :system do visit "ticket/zoom/#{ticket.id}" refresh # refresh to have assets generated for ticket - expect(page).to have_select('state_id', options: %w[new open closed], wait: 10) + expect(page).to have_select('state_id', options: %w[new open closed]) expect(page).to have_no_select('priority_id') expect(page).to have_no_select('owner_id') expect(page).to have_no_css('div.tabsSidebar-tab[data-tab=customer]') @@ -1154,7 +1154,7 @@ RSpec.describe 'Ticket zoom', type: :system do ticket_note.update!(internal: false) - expect(page).to have_selector(:active_ticket_article, ticket_note, wait: 10) + expect(page).to have_selector(:active_ticket_article, ticket_note) end end end @@ -1281,7 +1281,7 @@ RSpec.describe 'Ticket zoom', type: :system do within :active_content do click_on ticket_a.title - expect(page).to have_css('.pagination-counter', wait: 10) + expect(page).to have_css('.pagination-counter') end end @@ -1291,7 +1291,7 @@ RSpec.describe 'Ticket zoom', type: :system do visit 'dashboard' visit "ticket/zoom/#{ticket_a.id}" - expect(page).to have_css('.pagination-counter', wait: 10) + expect(page).to have_css('.pagination-counter') end end end @@ -1337,7 +1337,7 @@ RSpec.describe 'Ticket zoom', type: :system do ) # wait for article to be added to the page - expect(page).to have_css('.ticket-article-item', count: 2, wait: 10) + expect(page).to have_css('.ticket-article-item', count: 2) # click on forward of created article within :active_ticket_article, article1 do @@ -1375,21 +1375,21 @@ RSpec.describe 'Ticket zoom', type: :system do visit "ticket/zoom/#{ticket.id}" click '.js-subscriptions .js-subscribe input' - expect(page).to have_selector('.js-subscriptions .js-unsubscribe input', wait: 10) - expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10) + expect(page).to have_selector('.js-subscriptions .js-unsubscribe input') + expect(page).to have_selector('.js-subscriptions span.avatar') click '.js-subscriptions .js-unsubscribe input' - expect(page).to have_selector('.js-subscriptions .js-subscribe input', wait: 10) - expect(page).to have_no_selector('.js-subscriptions span.avatar', wait: 10) + expect(page).to have_selector('.js-subscriptions .js-subscribe input') + expect(page).to have_no_selector('.js-subscriptions span.avatar') create(:mention, mentionable: ticket, user: other_agent) - expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10) + expect(page).to have_selector('.js-subscriptions span.avatar') # check history for mention entries click 'h2.sidebar-header-headline.js-headline' click 'li[data-type=ticket-history] a' - expect(page).to have_text('created Mention', wait: 10) - expect(page).to have_text('removed Mention', wait: 10) + expect(page).to have_text('created Mention') + expect(page).to have_text('removed Mention') end end end @@ -1718,11 +1718,11 @@ RSpec.describe 'Ticket zoom', type: :system do visit "#ticket/zoom/#{ticket_open.id}" click '.tabsSidebar-tab[data-tab=customer]' click '.user-tickets[data-type=open]' - expect(page).to have_text(ticket_open.title, wait: 20) + expect(page).to have_text(ticket_open.title) visit "#ticket/zoom/#{ticket_open.id}" click '.user-tickets[data-type=closed]' - expect(page).to have_text(ticket_closed.title, wait: 20) + expect(page).to have_text(ticket_closed.title) end end @@ -2162,7 +2162,7 @@ RSpec.describe 'Ticket zoom', type: :system do it 'does show up the saved value if it would not be possible because of the restriction' do expect(page.find("select[name='#{field_name}']").value).to eq('false') ticket.update(field_name => true) - wait(10, interval: 0.5).until { page.find("select[name='#{field_name}']").value == 'true' } + wait.until { page.find("select[name='#{field_name}']").value == 'true' } expect(page.find("select[name='#{field_name}']").value).to eq('true') end end @@ -2179,7 +2179,7 @@ RSpec.describe 'Ticket zoom', type: :system do it 'does show up the saved value if it would not be possible because of the restriction' do expect(page.find("select[name='#{field_name}']").value).to eq('false') ticket.update(field_name => true) - wait(10, interval: 0.5).until { page.find("select[name='#{field_name}']").value == 'true' } + wait.until { page.find("select[name='#{field_name}']").value == 'true' } expect(page.find("select[name='#{field_name}']").value).to eq('true') end end @@ -2196,21 +2196,21 @@ RSpec.describe 'Ticket zoom', type: :system do it 'does show up the new priority' do high_prio = Ticket::Priority.find_by(name: '3 high') ticket.update(priority: high_prio) - wait(10, interval: 0.5).until { page.find("select[name='priority_id']").value == high_prio.id.to_s } + wait.until { page.find("select[name='priority_id']").value == high_prio.id.to_s } expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s) end it 'does show up the new group (different case because it will also trigger a full rerender because of potential permission changes)' do group = Group.find_by(name: 'some group1') ticket.update(group: group) - wait(10, interval: 0.5).until { page.find("select[name='group_id']").value == group.id.to_s } + wait.until { page.find("select[name='group_id']").value == group.id.to_s } expect(page.find("select[name='group_id']").value).to eq(group.id.to_s) end it 'does show up the new state and pending time' do pending_state = Ticket::State.find_by(name: 'pending reminder') ticket.update(state: pending_state, pending_time: 1.day.from_now) - wait(10, interval: 0.5).until { page.find("select[name='state_id']").value == pending_state.id.to_s } + wait.until { page.find("select[name='state_id']").value == pending_state.id.to_s } expect(page.find("select[name='state_id']").value).to eq(pending_state.id.to_s) expect(page).to have_selector("div[data-name='pending_time']") end @@ -2220,7 +2220,7 @@ RSpec.describe 'Ticket zoom', type: :system do high_prio = Ticket::Priority.find_by(name: '3 high') closed_state = Ticket::State.find_by(name: 'closed') ticket.update(priority: high_prio) - wait(10, interval: 0.5).until { page.find("select[name='priority_id']").value == high_prio.id.to_s } + wait.until { page.find("select[name='priority_id']").value == high_prio.id.to_s } expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s) expect(page.find("select[name='state_id']").value).to eq(closed_state.id.to_s) end @@ -2421,7 +2421,7 @@ RSpec.describe 'Ticket zoom', type: :system do it 'does show values properly and can save values also' do # check ticket state rendering - wait(5).until { multiselect_value == %w[key_2 key_3] } + wait.until { multiselect_value == %w[key_2 key_3] } expect(multiselect_value).to eq(%w[key_2 key_3]) # save 2 values