From f40c5ea01eae1a453048f706b26a59f7125f5e27 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Fri, 18 Feb 2022 09:12:37 +0100 Subject: [PATCH] Maintenance: Stabilize capybara tests. --- spec/system/profile/preferences_language_spec.rb | 12 ++++++++++-- spec/system/system/translations_spec.rb | 4 ++-- spec/system/ticket/history_spec.rb | 2 +- spec/system/ticket/zoom_spec.rb | 5 ++++- .../agent_ticket_email_reply_keep_body_test.rb | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/spec/system/profile/preferences_language_spec.rb b/spec/system/profile/preferences_language_spec.rb index 2d65997c0..c72e78945 100644 --- a/spec/system/profile/preferences_language_spec.rb +++ b/spec/system/profile/preferences_language_spec.rb @@ -60,7 +60,11 @@ RSpec.describe 'Profile > Language', type: :system do let(:priority) { 'PRIORITY' } let(:owner) { 'OWNER' } - before { visit path } + before do + visit path + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. + page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" + end it_behaves_like 'displaying the current language' @@ -150,7 +154,11 @@ RSpec.describe 'Profile > Language', type: :system do let(:priority) { 'PRIORITÄT' } let(:owner) { 'BESITZER' } - before { visit path } + before do + visit path + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. + page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" + end it_behaves_like 'displaying the current language' diff --git a/spec/system/system/translations_spec.rb b/spec/system/system/translations_spec.rb index c61e58981..2b8241065 100644 --- a/spec/system/system/translations_spec.rb +++ b/spec/system/system/translations_spec.rb @@ -50,7 +50,7 @@ RSpec.describe 'System > Translations', type: :system do let(:admin) { create(:admin, preferences: { locale: 'de-de' }) } before do - # Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de. + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" end @@ -102,7 +102,7 @@ RSpec.describe 'System > Translations', type: :system do let(:admin) { create(:admin, preferences: { locale: 'de-de' }) } before do - # Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de. + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" end diff --git a/spec/system/ticket/history_spec.rb b/spec/system/ticket/history_spec.rb index b50fec009..27c60c88c 100644 --- a/spec/system/ticket/history_spec.rb +++ b/spec/system/ticket/history_spec.rb @@ -35,7 +35,7 @@ RSpec.describe 'Ticket history', type: :system, time_zone: 'Europe/London', auth travel_back - # Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de. + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" refresh diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 36490d761..b18655dec 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -1935,6 +1935,9 @@ RSpec.describe 'Ticket zoom', type: :system do it 'does setup the last behaviour' do click '.js-attributeBar .dropup div' click 'span[data-type=stayOnTab]' + wait.until do + User.find_by(email: 'admin@example.com').preferences['secondaryAction'] == 'stayOnTab' + end visit "ticket/zoom/#{ticket1.id}" expect(page).to have_text('Stay on tab') end @@ -2014,7 +2017,7 @@ RSpec.describe 'Ticket zoom', type: :system do def switch_language_german visit '#profile/language' - # Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de. + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. page.evaluate_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" page.find('.js-input').click page.find('.js-input').set('Deutsch') diff --git a/test/browser/agent_ticket_email_reply_keep_body_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb index b69747ecd..8ef0cdb8d 100644 --- a/test/browser/agent_ticket_email_reply_keep_body_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -198,7 +198,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]', ) - # Suppress the modal dialog that invites to contributions for translations that are < 95% as this breaks the tests for de-de. + # Suppress the modal dialog that invites to contributions for translations that are < 90% as this breaks the tests for de-de. @browser.execute_script "App.LocalStorage.set('translation_support_no', true, App.Session.get('id'))" # switch user profile language to German