Maintenance: Drop unneeded waits to stabilize capybara tests.

This commit is contained in:
Martin Gruner 2022-01-25 10:36:20 +01:00 committed by Dominik Klein
parent 344d647079
commit e8259758b8
17 changed files with 211 additions and 212 deletions

View file

@ -164,8 +164,7 @@ module CommonActions
route = Regexp.new(Regexp.quote("/##{route}")) route = Regexp.new(Regexp.quote("/##{route}"))
end end
# wait 1 sec by default because Firefox is slow options.reverse_merge!(url: true)
options.reverse_merge!(wait: 1, url: true)
have_current_path(route, **options) have_current_path(route, **options)
end end

View file

@ -34,7 +34,7 @@ RSpec.describe 'Authentication', type: :system do
expect(cookie[:expires]).to be_truthy expect(cookie[:expires]).to be_truthy
logout logout
expect_current_route 'login', wait: 10 expect_current_route 'login'
# Check that cookies has no longer a expire date after logout. # Check that cookies has no longer a expire date after logout.
cookie = cookie('^_zammad.+?') cookie = cookie('^_zammad.+?')
@ -43,12 +43,12 @@ RSpec.describe 'Authentication', type: :system do
it 'Logout' do it 'Logout' do
logout logout
expect_current_route 'login', wait: 10 expect_current_route 'login'
end end
it 'will unset user attributes after logout' do it 'will unset user attributes after logout' do
logout logout
expect_current_route 'login', wait: 10 expect_current_route 'login'
visit '/#signup' visit '/#signup'
@ -59,20 +59,20 @@ RSpec.describe 'Authentication', type: :system do
it 'Login and redirect to requested url', authenticated_as: false do it 'Login and redirect to requested url', authenticated_as: false do
visit 'ticket/zoom/1' visit 'ticket/zoom/1'
expect_current_route 'login', wait: 10 expect_current_route 'login'
login( login(
username: 'admin@example.com', username: 'admin@example.com',
password: 'test', password: 'test',
) )
expect_current_route 'ticket/zoom/1', wait: 10 expect_current_route 'ticket/zoom/1'
end end
it 'Login and redirect to requested url via external authentication', authenticated_as: false do it 'Login and redirect to requested url via external authentication', authenticated_as: false do
visit 'ticket/zoom/1' visit 'ticket/zoom/1'
expect_current_route 'login', wait: 10 expect_current_route 'login'
# simulate jump to external ressource # simulate jump to external ressource
visit 'https://www.zammad.org' 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 # jump back and check if origin requested url is shown
visit '' visit ''
expect_current_route 'ticket/zoom/1', wait: 10 expect_current_route 'ticket/zoom/1'
expect(current_login).to eq('admin@example.com') expect(current_login).to eq('admin@example.com')
end end

View file

@ -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', visible: :all)
expect(page).to have_css('.zammad-chat-is-hidden', 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
end end
@ -196,7 +196,7 @@ RSpec.describe 'Chat Handling', type: :system do
# No customer action, hide the widget. # No customer action, hide the widget.
expect(page).to have_css('.zammad-chat') 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 refresh
@ -204,7 +204,7 @@ RSpec.describe 'Chat Handling', type: :system do
open_chat_dialog open_chat_dialog
check_content('.zammad-chat-modal-text', %r{(waiting|Warte)}) 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 refresh

View file

@ -51,8 +51,8 @@ RSpec.describe 'Dashboard', type: :system do
end end
it 'does logout user' do 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 will be automatically logged out within the next 30 seconds.')
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
it 'does not logout user', authenticated_as: :admin do it 'does not logout user', authenticated_as: :admin do
@ -65,7 +65,7 @@ RSpec.describe 'Dashboard', type: :system do
it 'does logout user' do it 'does logout user' do
expect(page).to have_no_text('Due to inactivity, you have been automatically logged out.') expect(page).to have_no_text('Due to inactivity, you have been automatically logged out.')
Setting.set('session_timeout', { default: '1' }) 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
end end
@ -76,7 +76,7 @@ RSpec.describe 'Dashboard', type: :system do
end end
it 'does logout user' do 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
end end
@ -87,7 +87,7 @@ RSpec.describe 'Dashboard', type: :system do
end end
it 'does logout user' do 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
end end
@ -98,7 +98,7 @@ RSpec.describe 'Dashboard', type: :system do
end end
it 'does logout user' do 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
end end
@ -112,7 +112,7 @@ RSpec.describe 'Dashboard', type: :system do
# backend tests for the reset # backend tests for the reset
session = ActiveRecord::SessionStore::Session.all.detect { |s| s.data['user_id'] == admin.id } session = ActiveRecord::SessionStore::Session.all.detect { |s| s.data['user_id'] == admin.id }
SessionTimeoutJob::Session.new(session).frontend_timeout 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
end end

View file

@ -22,15 +22,15 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a
click '.js-new' click '.js-new'
find(:css, '.js-input').send_keys(customer.firstname) 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' click '.searchableSelect-option-text'
fill_in 'Are you sure?', with: 'DELETE' 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' click '.js-submit'
expect(page).to have_text('in process', wait: 5) expect(page).to have_text('in process')
DataPrivacyTaskJob.perform_now DataPrivacyTaskJob.perform_now
expect(page).to have_text('completed', wait: 5) expect(page).to have_text('completed')
end end
context 'when customer is the single user of the organization' do 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' click '.js-new'
find(:css, '.js-input').send_keys(customer.firstname) 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' click '.searchableSelect-option-text'
fill_in 'Are you sure?', with: 'DELETE' 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' click '.js-submit'
expect(page).to have_text('in process', wait: 5) expect(page).to have_text('in process')
DataPrivacyTaskJob.perform_now DataPrivacyTaskJob.perform_now
expect(page).to have_text('completed', wait: 5) expect(page).to have_text('completed')
end end
it 'deletes customer by email' do it 'deletes customer by email' do
@ -65,15 +65,15 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a
click '.js-new' click '.js-new'
find(:css, '.js-input').send_keys(customer.email) 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' click '.searchableSelect-option-text'
fill_in 'Are you sure?', with: 'DELETE' 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' click '.js-submit'
expect(page).to have_text('in process', wait: 5) expect(page).to have_text('in process')
DataPrivacyTaskJob.perform_now DataPrivacyTaskJob.perform_now
expect(page).to have_text('completed', wait: 5) expect(page).to have_text('completed')
end end
end end
end end
@ -88,9 +88,9 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a
fill_in 'Are you sure?', with: 'DELETE' fill_in 'Are you sure?', with: 'DELETE'
click '.js-submit' click '.js-submit'
expect(page).to have_text('in process', wait: 5) expect(page).to have_text('in process')
DataPrivacyTaskJob.perform_now DataPrivacyTaskJob.perform_now
expect(page).to have_text('completed', wait: 5) expect(page).to have_text('completed')
end end
end end
@ -105,9 +105,9 @@ RSpec.describe 'Data Privacy', type: :system, searchindex: true, authenticated_a
fill_in 'Are you sure?', with: 'DELETE' fill_in 'Are you sure?', with: 'DELETE'
click '.js-submit' click '.js-submit'
expect(page).to have_text('in process', wait: 5) expect(page).to have_text('in process')
DataPrivacyTaskJob.perform_now DataPrivacyTaskJob.perform_now
expect(page).to have_text('completed', wait: 5) expect(page).to have_text('completed')
end end
end end
end end

View file

@ -46,7 +46,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -64,7 +64,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -82,7 +82,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -100,7 +100,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -118,7 +118,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -136,7 +136,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -154,7 +154,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -172,7 +172,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -191,7 +191,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -217,7 +217,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -244,7 +244,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -262,7 +262,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -280,7 +280,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -298,7 +298,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -316,7 +316,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -334,7 +334,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -352,7 +352,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -370,7 +370,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -389,7 +389,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -415,7 +415,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -442,7 +442,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -460,7 +460,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -478,7 +478,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -496,7 +496,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -514,7 +514,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -532,7 +532,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -550,7 +550,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -568,9 +568,9 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call before_it.call
expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']", 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']", wait: 10) 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']", wait: 10) expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']")
end end
end end
@ -588,7 +588,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -614,7 +614,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -640,7 +640,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -658,7 +658,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -676,7 +676,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -694,7 +694,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -712,7 +712,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -730,7 +730,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -748,7 +748,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -766,9 +766,9 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call before_it.call
expect(page).to have_selector("select[name='#{field_name}'] option[value='key_1']", 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']", wait: 10) 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']", wait: 10) expect(page).to have_selector("select[name='#{field_name}'] option[value='key_3']")
end end
end end
@ -786,7 +786,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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']) expect(page.find("select[name='#{field_name}']").value).to eq(['key_3'])
end end
end end
@ -813,7 +813,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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']) expect(page.find("select[name='#{field_name}']").value).to eq(['key_3'])
end end
end end
@ -840,7 +840,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -858,7 +858,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -876,7 +876,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -894,7 +894,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -912,7 +912,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -930,8 +930,8 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call before_it.call
expect(page).to have_selector("select[name='#{field_name}'] option[value='false']", 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']", wait: 10) expect(page).to have_no_selector("select[name='#{field_name}'] option[value='true']")
end end
end end
@ -949,7 +949,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -975,7 +975,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -1001,7 +1001,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1019,7 +1019,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1037,7 +1037,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1055,7 +1055,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1073,7 +1073,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1091,7 +1091,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1109,7 +1109,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
@ -1127,11 +1127,11 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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: 'Incident', visible: :all)
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: 'Hardware', visible: :all)
expect(page).to have_selector('span.searchableSelect-option-text', text: 'Monitor', visible: :all, wait: 10) 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, wait: 10) 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, wait: 10) expect(page).to have_no_selector('span.searchableSelect-option-text', text: 'Softwareproblem', visible: :all)
end end
end end
@ -1149,7 +1149,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1175,7 +1175,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -1201,7 +1201,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1219,7 +1219,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1237,7 +1237,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1255,7 +1255,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1273,7 +1273,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1291,7 +1291,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1309,7 +1309,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -1335,7 +1335,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1353,7 +1353,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1371,7 +1371,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1389,7 +1389,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1407,7 +1407,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1425,7 +1425,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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
end end
@ -1443,7 +1443,7 @@ RSpec.shared_examples 'core workflow' do
it 'does perform' do it 'does perform' do
before_it.call 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 end
end end
@ -1476,7 +1476,7 @@ RSpec.shared_examples 'core workflow' do
it 'does not display hidden fields as mandatory' do it 'does not display hidden fields as mandatory' do
before_it.call 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 end
end end

View file

@ -10,38 +10,38 @@ RSpec.shared_examples 'pagination' do |model:, klass:, path:, sort_by: :name|
it 'does paginate', authenticated_as: :authenticate do it 'does paginate', authenticated_as: :authenticate do
visit path 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 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') 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 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') 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 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') 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 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') 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 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') expect(page).to have_css('.js-page.is-selected', text: '1')
page.first('.js-tableHead[data-column-key=name]').click page.first('.js-tableHead[data-column-key=name]').click
class_last = klass.order(sort_by => :desc).first 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
end end

View file

@ -85,7 +85,7 @@ RSpec.describe 'Keyboard Shortcuts', type: :system do
context 'for list of shortcuts' do context 'for list of shortcuts' do
before do before do
send_keys([*hot_keys, 'h']) send_keys([*hot_keys, 'h'])
wait(5).until_exists { find :active_modal_content } wait.until_exists { find :active_modal_content }
end end
it 'shows list of shortcuts' do it 'shows list of shortcuts' do

View file

@ -197,7 +197,7 @@ RSpec.describe 'Manage > Trigger', type: :system do
it 'updates the ticket with the trigger condition' do it 'updates the ticket with the trigger condition' do
wait.until { ticket.multiselect_previously_changed? && ticket.articles.present? } wait.until { ticket.multiselect_previously_changed? && ticket.articles.present? }
expect(ticket.articles).not_to be_empty 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
end end

View file

@ -42,12 +42,12 @@ RSpec.describe 'Manage > Users', type: :system do
visit 'manage/users' visit 'manage/users'
within(:active_content) do 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-action').click
row.find('.js-switchTo').click row.find('.js-switchTo').click
end 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
end end

View file

@ -10,11 +10,11 @@ RSpec.describe 'Profile > Out of Office', type: :system do
it 'does find agents' do it 'does find agents' do
find(:css, '.js-objectSelect').send_keys('Agent') 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 end
it 'does not find customers' do it 'does not find customers' do
find(:css, '.js-objectSelect').send_keys('Nicole') 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
end end

View file

@ -114,7 +114,7 @@ RSpec.describe 'Search', type: :system, authenticated: true, searchindex: true d
end end
expect do 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.not_to raise_error
end end
end end

View file

@ -22,13 +22,13 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do
fill_in 'proxy_password', with: proxy_password fill_in 'proxy_password', with: proxy_password
click_on 'Test Connection' click_on 'Test Connection'
expect(page).to have_button('Test Connection', visible: :hidden, wait: 5) expect(page).to have_button('Test Connection', visible: :hidden)
expect(page).to have_button('Submit', visible: :visible, wait: 5) expect(page).to have_button('Submit', visible: :visible)
find('.js-submit:not(.hide)').click find('.js-submit:not(.hide)').click
expect(page).to have_button('Submit', visible: :hidden, wait: 5) expect(page).to have_button('Submit', visible: :hidden)
expect(page).to have_button('Test Connection', visible: :visible, wait: 5) expect(page).to have_button('Test Connection', visible: :visible)
end end
end end
@ -44,10 +44,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do
fill_in 'proxy_password', with: proxy_password fill_in 'proxy_password', with: proxy_password
click_on 'Test Connection' click_on 'Test Connection'
expect(page).to have_css('h1.modal-title', text: 'Error', 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}, wait: 5) expect(page).to have_css('div.modal-body', text: %r{Invalid proxy address})
expect(page).to have_button('Test Connection', visible: :visible, wait: 5) expect(page).to have_button('Test Connection', visible: :visible)
expect(page).to have_button('Submit', visible: :hidden, wait: 5) expect(page).to have_button('Submit', visible: :hidden)
end end
end end
@ -62,10 +62,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do
fill_in 'proxy_password', with: proxy_password fill_in 'proxy_password', with: proxy_password
click_on 'Test Connection' click_on 'Test Connection'
expect(page).to have_css('h1.modal-title', text: 'Error', 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}, wait: 5) expect(page).to have_css('div.modal-body', text: %r{Failed to open TCP connection})
expect(page).to have_button('Test Connection', visible: :visible, wait: 5) expect(page).to have_button('Test Connection', visible: :visible)
expect(page).to have_button('Submit', visible: :hidden, wait: 5) expect(page).to have_button('Submit', visible: :hidden)
end end
end end
@ -80,10 +80,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do
fill_in 'proxy_password', with: proxy_password fill_in 'proxy_password', with: proxy_password
click_on 'Test Connection' click_on 'Test Connection'
expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) expect(page).to have_css('h1.modal-title', text: 'Error')
expect(page).to have_css('div.modal-body', text: %r{Access Denied}, wait: 5) expect(page).to have_css('div.modal-body', text: %r{Access Denied})
expect(page).to have_button('Test Connection', visible: :visible, wait: 5) expect(page).to have_button('Test Connection', visible: :visible)
expect(page).to have_button('Submit', visible: :hidden, wait: 5) expect(page).to have_button('Submit', visible: :hidden)
end end
end end
@ -98,10 +98,10 @@ RSpec.describe 'Manage > Settings > System > Network', type: :system do
fill_in 'proxy_password', with: 'invalid_password' fill_in 'proxy_password', with: 'invalid_password'
click_on 'Test Connection' click_on 'Test Connection'
expect(page).to have_css('h1.modal-title', text: 'Error', wait: 5) expect(page).to have_css('h1.modal-title', text: 'Error')
expect(page).to have_css('div.modal-body', text: %r{Access Denied}, wait: 5) expect(page).to have_css('div.modal-body', text: %r{Access Denied})
expect(page).to have_button('Test Connection', visible: :visible, wait: 5) expect(page).to have_button('Test Connection', visible: :visible)
expect(page).to have_button('Submit', visible: :hidden, wait: 5) expect(page).to have_button('Submit', visible: :hidden)
end end
end end

View file

@ -70,7 +70,7 @@ RSpec.describe 'System setup process', type: :system, set_up: false, authenticat
end end
# wait for verification process to start # 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 # wait for verification process to finish
expect(page).to have_css('.js-agent h2', text: 'Invite Colleagues', wait: 2.minutes) 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 Dashboard of a fresh system
expect(page).to have_css('body', text: 'My Stats') expect(page).to have_css('body', text: 'My Stats')
expect_current_route 'clues' expect_current_route 'clues'
find(:clues_close, wait: 4).in_fixed_position.click find(:clues_close).in_fixed_position.click
# verify organization and fqdn # verify organization and fqdn
click(:manage) click(:manage)

View file

@ -91,8 +91,8 @@ RSpec.describe 'Ticket Create', type: :system do
use_template(template) use_template(template)
# wait till S/MIME check AJAX call is ready # 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-securityEncrypt.btn--active')
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) expect(page).to have_css('div.js-securitySign.btn--active')
# deactivate encryption and signing # deactivate encryption and signing
click '.js-securityEncrypt' click '.js-securityEncrypt'
@ -120,8 +120,8 @@ RSpec.describe 'Ticket Create', type: :system do
use_template(template) use_template(template)
# wait till S/MIME check AJAX call is ready # 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-securityEncrypt.btn--active')
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) expect(page).to have_css('div.js-securitySign.btn--active')
# deactivate encryption # deactivate encryption
click '.js-securityEncrypt' click '.js-securityEncrypt'
@ -148,8 +148,8 @@ RSpec.describe 'Ticket Create', type: :system do
use_template(template) use_template(template)
# wait till S/MIME check AJAX call is ready # 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-securityEncrypt.btn--active')
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) expect(page).to have_css('div.js-securitySign.btn--active')
# deactivate signing # deactivate signing
click '.js-securitySign' click '.js-securitySign'
@ -176,8 +176,8 @@ RSpec.describe 'Ticket Create', type: :system do
use_template(template) use_template(template)
# wait till S/MIME check AJAX call is ready # 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-securityEncrypt.btn--active')
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5) expect(page).to have_css('div.js-securitySign.btn--active')
click '.js-submit' click '.js-submit'
@ -202,12 +202,12 @@ RSpec.describe 'Ticket Create', type: :system do
it "security defaults sign: #{sign}, encrypt: #{encrypt}" do it "security defaults sign: #{sign}, encrypt: #{encrypt}" do
within(:active_content) do within(:active_content) do
encrypt_button = find('.js-securityEncrypt', wait: 5) encrypt_button = find('.js-securityEncrypt')
sign_button = find('.js-securitySign', wait: 5) sign_button = find('.js-securitySign')
active_button_class = '.btn--active' active_button_class = '.btn--active'
expect(encrypt_button.matches_css?(active_button_class, wait: 2)).to be(encrypt) expect(encrypt_button.matches_css?(active_button_class)).to be(encrypt)
expect(sign_button.matches_css?(active_button_class, wait: 2)).to be(sign) expect(sign_button.matches_css?(active_button_class)).to be(sign)
end end
end 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 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') 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 end
end end

View file

@ -35,7 +35,7 @@ RSpec.describe 'Ticket Update', type: :system do
select('closed', from: 'state_id') select('closed', from: 'state_id')
click('.js-attributeBar .js-submit') 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 end
# the update should have failed and thus the ticket is still in the new state # 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 # update should work now
find(".edit [name=#{attribute.name}]").select('name 2') find(".edit [name=#{attribute.name}]").select('name 2')
click('.js-attributeBar .js-submit') 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 end
ticket.reload ticket.reload
@ -96,7 +96,7 @@ RSpec.describe 'Ticket Update', type: :system do
set_date_field_value(date_attribute.name, '') set_date_field_value(date_attribute.name, '')
click('.js-attributeBar .js-submit') 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 ticket.reload
expect(ticket[date_attribute.name]).to eq(nil) 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 it 'tickets history of both tickets should show the merge event' do
visit "#ticket/zoom/#{origin_ticket.id}" visit "#ticket/zoom/#{origin_ticket.id}"
within(:active_content) do 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-toggle'
click '.js-actions .dropdown-menu [data-type="ticket-history"]' 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') modal = find('.modal')
expect(modal).to have_content "This ticket was merged into ticket ##{target_ticket.number}" 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}" expect(modal).to have_link "##{target_ticket.number}", href: "#ticket/zoom/#{target_ticket.id}"
visit "#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-toggle'
click '.js-actions .dropdown-menu [data-type="ticket-history"]' 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') modal = find('.modal')
expect(modal).to have_content("Ticket ##{origin_ticket.number} was merged into this ticket") 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}" 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 it 'shows the target ticket history' do
visit "#ticket/zoom/#{target_ticket.id}" visit "#ticket/zoom/#{target_ticket.id}"
within(:active_content) do 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-toggle'
click '.js-actions .dropdown-menu [data-type="ticket-history"]' click '.js-actions .dropdown-menu [data-type="ticket-history"]'
end end
@ -287,7 +287,7 @@ RSpec.describe 'Ticket Update', type: :system do
it 'shows the origin history' do it 'shows the origin history' do
visit "#ticket/zoom/#{origin_ticket.id}" visit "#ticket/zoom/#{origin_ticket.id}"
within(:active_content) do 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-toggle'
click '.js-actions .dropdown-menu [data-type="ticket-history"]' click '.js-actions .dropdown-menu [data-type="ticket-history"]'
end end

View file

@ -644,8 +644,8 @@ RSpec.describe 'Ticket zoom', type: :system do
all('a[data-type=emailReply]').last.click all('a[data-type=emailReply]').last.click
find('.articleNewEdit-body').send_keys('Test') find('.articleNewEdit-body').send_keys('Test')
expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) expect(page).to have_css('.js-securityEncrypt.btn--active')
expect(page).to have_css('.js-securitySign.btn--active', wait: 5) expect(page).to have_css('.js-securitySign.btn--active')
click '.js-securityEncrypt' click '.js-securityEncrypt'
click '.js-securitySign' click '.js-securitySign'
@ -663,8 +663,8 @@ RSpec.describe 'Ticket zoom', type: :system do
all('a[data-type=emailReply]').last.click all('a[data-type=emailReply]').last.click
find('.articleNewEdit-body').send_keys('Test') find('.articleNewEdit-body').send_keys('Test')
expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) expect(page).to have_css('.js-securityEncrypt.btn--active')
expect(page).to have_css('.js-securitySign.btn--active', wait: 5) expect(page).to have_css('.js-securitySign.btn--active')
click '.js-securityEncrypt' click '.js-securityEncrypt'
@ -681,8 +681,8 @@ RSpec.describe 'Ticket zoom', type: :system do
all('a[data-type=emailReply]').last.click all('a[data-type=emailReply]').last.click
find('.articleNewEdit-body').send_keys('Test') find('.articleNewEdit-body').send_keys('Test')
expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) expect(page).to have_css('.js-securityEncrypt.btn--active')
expect(page).to have_css('.js-securitySign.btn--active', wait: 5) expect(page).to have_css('.js-securitySign.btn--active')
click '.js-securitySign' click '.js-securitySign'
@ -699,8 +699,8 @@ RSpec.describe 'Ticket zoom', type: :system do
all('a[data-type=emailReply]').last.click all('a[data-type=emailReply]').last.click
find('.articleNewEdit-body').send_keys('Test') find('.articleNewEdit-body').send_keys('Test')
expect(page).to have_css('.js-securityEncrypt.btn--active', wait: 5) expect(page).to have_css('.js-securityEncrypt.btn--active')
expect(page).to have_css('.js-securitySign.btn--active', wait: 5) expect(page).to have_css('.js-securitySign.btn--active')
click '.js-submit' click '.js-submit'
expect(page).to have_css('.ticket-article-item', count: 2) 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 it "security defaults sign: #{sign}, encrypt: #{encrypt}" do
within(:active_content) do within(:active_content) do
encrypt_button = find('.js-securityEncrypt', wait: 5) encrypt_button = find('.js-securityEncrypt')
sign_button = find('.js-securitySign', wait: 5) sign_button = find('.js-securitySign')
active_button_class = '.btn--active' active_button_class = '.btn--active'
expect(encrypt_button.matches_css?(active_button_class, wait: 2)).to be(encrypt) expect(encrypt_button.matches_css?(active_button_class)).to be(encrypt)
expect(sign_button.matches_css?(active_button_class, wait: 2)).to be(sign) expect(sign_button.matches_css?(active_button_class)).to be(sign)
end end
end end
end end
@ -1018,7 +1018,7 @@ RSpec.describe 'Ticket zoom', type: :system do
visit "ticket/zoom/#{ticket.id}" visit "ticket/zoom/#{ticket.id}"
refresh # refresh to have assets generated for ticket 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('priority_id')
expect(page).to have_no_select('owner_id') expect(page).to have_no_select('owner_id')
expect(page).to have_no_css('div.tabsSidebar-tab[data-tab=customer]') 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) 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 end
end end
@ -1281,7 +1281,7 @@ RSpec.describe 'Ticket zoom', type: :system do
within :active_content do within :active_content do
click_on ticket_a.title click_on ticket_a.title
expect(page).to have_css('.pagination-counter', wait: 10) expect(page).to have_css('.pagination-counter')
end end
end end
@ -1291,7 +1291,7 @@ RSpec.describe 'Ticket zoom', type: :system do
visit 'dashboard' visit 'dashboard'
visit "ticket/zoom/#{ticket_a.id}" 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 end
end end
@ -1337,7 +1337,7 @@ RSpec.describe 'Ticket zoom', type: :system do
) )
# wait for article to be added to the page # 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 # click on forward of created article
within :active_ticket_article, article1 do within :active_ticket_article, article1 do
@ -1375,21 +1375,21 @@ RSpec.describe 'Ticket zoom', type: :system do
visit "ticket/zoom/#{ticket.id}" visit "ticket/zoom/#{ticket.id}"
click '.js-subscriptions .js-subscribe input' 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 .js-unsubscribe input')
expect(page).to have_selector('.js-subscriptions span.avatar', wait: 10) expect(page).to have_selector('.js-subscriptions span.avatar')
click '.js-subscriptions .js-unsubscribe input' click '.js-subscriptions .js-unsubscribe input'
expect(page).to have_selector('.js-subscriptions .js-subscribe input', wait: 10) expect(page).to have_selector('.js-subscriptions .js-subscribe input')
expect(page).to have_no_selector('.js-subscriptions span.avatar', wait: 10) expect(page).to have_no_selector('.js-subscriptions span.avatar')
create(:mention, mentionable: ticket, user: other_agent) 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 # check history for mention entries
click 'h2.sidebar-header-headline.js-headline' click 'h2.sidebar-header-headline.js-headline'
click 'li[data-type=ticket-history] a' click 'li[data-type=ticket-history] a'
expect(page).to have_text('created Mention', wait: 10) expect(page).to have_text('created Mention')
expect(page).to have_text('removed Mention', wait: 10) expect(page).to have_text('removed Mention')
end end
end end
end end
@ -1718,11 +1718,11 @@ RSpec.describe 'Ticket zoom', type: :system do
visit "#ticket/zoom/#{ticket_open.id}" visit "#ticket/zoom/#{ticket_open.id}"
click '.tabsSidebar-tab[data-tab=customer]' click '.tabsSidebar-tab[data-tab=customer]'
click '.user-tickets[data-type=open]' 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}" visit "#ticket/zoom/#{ticket_open.id}"
click '.user-tickets[data-type=closed]' 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
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 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') expect(page.find("select[name='#{field_name}']").value).to eq('false')
ticket.update(field_name => true) 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') expect(page.find("select[name='#{field_name}']").value).to eq('true')
end end
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 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') expect(page.find("select[name='#{field_name}']").value).to eq('false')
ticket.update(field_name => true) 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') expect(page.find("select[name='#{field_name}']").value).to eq('true')
end end
end end
@ -2196,21 +2196,21 @@ RSpec.describe 'Ticket zoom', type: :system do
it 'does show up the new priority' do it 'does show up the new priority' do
high_prio = Ticket::Priority.find_by(name: '3 high') high_prio = Ticket::Priority.find_by(name: '3 high')
ticket.update(priority: high_prio) 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='priority_id']").value).to eq(high_prio.id.to_s)
end end
it 'does show up the new group (different case because it will also trigger a full rerender because of potential permission changes)' do 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') group = Group.find_by(name: 'some group1')
ticket.update(group: group) 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) expect(page.find("select[name='group_id']").value).to eq(group.id.to_s)
end end
it 'does show up the new state and pending time' do it 'does show up the new state and pending time' do
pending_state = Ticket::State.find_by(name: 'pending reminder') pending_state = Ticket::State.find_by(name: 'pending reminder')
ticket.update(state: pending_state, pending_time: 1.day.from_now) 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.find("select[name='state_id']").value).to eq(pending_state.id.to_s)
expect(page).to have_selector("div[data-name='pending_time']") expect(page).to have_selector("div[data-name='pending_time']")
end end
@ -2220,7 +2220,7 @@ RSpec.describe 'Ticket zoom', type: :system do
high_prio = Ticket::Priority.find_by(name: '3 high') high_prio = Ticket::Priority.find_by(name: '3 high')
closed_state = Ticket::State.find_by(name: 'closed') closed_state = Ticket::State.find_by(name: 'closed')
ticket.update(priority: high_prio) 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='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) expect(page.find("select[name='state_id']").value).to eq(closed_state.id.to_s)
end end
@ -2421,7 +2421,7 @@ RSpec.describe 'Ticket zoom', type: :system do
it 'does show values properly and can save values also' do it 'does show values properly and can save values also' do
# check ticket state rendering # 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]) expect(multiselect_value).to eq(%w[key_2 key_3])
# save 2 values # save 2 values