From 7ab49f94202031b575ab1c7c0331585ad18860c5 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Wed, 13 Dec 2023 16:00:41 +0100 Subject: [PATCH 1/2] Add settings for the notification polling interval for tests that rely on it --- .../spec/features/onboarding/boards_onboarding_tour_spec.rb | 5 ++--- .../features/onboarding/team_planner_onboarding_tour_spec.rb | 5 ++--- .../notification_center/notification_center_spec.rb | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb index 3d1784085b0c..20109c9fe3fe 100644 --- a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb +++ b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb @@ -27,10 +27,9 @@ #++ require 'spec_helper' -require_relative './../support/onboarding_steps' +require_relative '../support/onboarding_steps' -RSpec.describe 'boards onboarding tour', - js: true do +RSpec.describe 'boards onboarding tour', :js, with_settings: { notifications_polling_interval: 10_000 } do let(:next_button) { find('.enjoyhint_next_btn') } let(:user) do create(:admin, diff --git a/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb index 172796218173..14503a62df88 100644 --- a/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb +++ b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb @@ -29,9 +29,8 @@ require 'spec_helper' require_relative '../../support/onboarding/onboarding_steps' -RSpec.describe 'team planner onboarding tour', :js, - with_cuprite: false, - with_ee: %i[team_planner_view] do +RSpec.describe 'team planner onboarding tour', :js, with_cuprite: false, with_ee: %i[team_planner_view], + with_settings: { notifications_polling_interval: 10_000 } do let(:next_button) { find('.enjoyhint_next_btn') } let(:demo_project) do diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rb index 62ef6289aea2..71c35f60c735 100644 --- a/spec/features/notifications/notification_center/notification_center_spec.rb +++ b/spec/features/notifications/notification_center/notification_center_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "Notification center", :js, :with_cuprite, with_ee: %i[date_alerts], - with_settings: { journal_aggregation_time_minutes: 0 } do + with_settings: { journal_aggregation_time_minutes: 0, notifications_polling_interval: 10_000 } do # Notice that the setup in this file here is not following the normal rules as # it also tests notification creation. let!(:project1) { create(:project) } From 624fd262155092af2e841b220b6818de0756c6c0 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Wed, 13 Dec 2023 16:32:22 +0100 Subject: [PATCH 2/2] decrease polling interval and add a note why we add it --- .../features/onboarding/boards_onboarding_tour_spec.rb | 4 +++- .../storages/spec/features/manage_project_storage_spec.rb | 7 ++++--- .../onboarding/team_planner_onboarding_tour_spec.rb | 5 ++++- .../notification_center/notification_center_spec.rb | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb index 20109c9fe3fe..307177ffc459 100644 --- a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb +++ b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb @@ -29,7 +29,9 @@ require 'spec_helper' require_relative '../support/onboarding_steps' -RSpec.describe 'boards onboarding tour', :js, with_settings: { notifications_polling_interval: 10_000 } do +# We decrease the notification polling interval because some portions of the JS code rely on something triggering +# the Angular change detection. This is usually done by the notification polling, but we don't want to wait +RSpec.describe 'boards onboarding tour', :js, with_settings: { notifications_polling_interval: 1_000 } do let(:next_button) { find('.enjoyhint_next_btn') } let(:user) do create(:admin, diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rb index 389cb4563474..07366706877e 100644 --- a/modules/storages/spec/features/manage_project_storage_spec.rb +++ b/modules/storages/spec/features/manage_project_storage_spec.rb @@ -34,9 +34,10 @@ # Setup storages in Project -> Settings -> File Storages # This tests assumes that a Storage has already been setup # in the Admin section, tested by admin_storage_spec.rb. -RSpec.describe( - 'Activation of storages in projects', :js, :webmock -) do + +# We decrease the notification polling interval because some portions of the JS code rely on something triggering +# the Angular change detection. This is usually done by the notification polling, but we don't want to wait +RSpec.describe 'Activation of storages in projects', :js, :webmock, with_settings: { notifications_polling_interval: 1_000 } do let(:user) { create(:user) } # The first page is the Project -> Settings -> General page, so we need # to provide the user with the edit_project permission in the role. diff --git a/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb index 14503a62df88..a74a56d7f511 100644 --- a/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb +++ b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb @@ -30,7 +30,10 @@ require_relative '../../support/onboarding/onboarding_steps' RSpec.describe 'team planner onboarding tour', :js, with_cuprite: false, with_ee: %i[team_planner_view], - with_settings: { notifications_polling_interval: 10_000 } do + # We decrease the notification polling interval because some portions + # of the JS code rely on something triggering the Angular change detection. + # This is usually done by the notification polling, but we don't want to wait + with_settings: { notifications_polling_interval: 1_000 } do let(:next_button) { find('.enjoyhint_next_btn') } let(:demo_project) do diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rb index 71c35f60c735..eb260d66cc6f 100644 --- a/spec/features/notifications/notification_center/notification_center_spec.rb +++ b/spec/features/notifications/notification_center/notification_center_spec.rb @@ -2,7 +2,9 @@ RSpec.describe "Notification center", :js, :with_cuprite, with_ee: %i[date_alerts], - with_settings: { journal_aggregation_time_minutes: 0, notifications_polling_interval: 10_000 } do + # We decrease the notification polling interval because some portions of the JS code rely on something triggering + # the Angular change detection. This is usually done by the notification polling, but we don't want to wait + with_settings: { journal_aggregation_time_minutes: 0, notifications_polling_interval: 1_000 } do # Notice that the setup in this file here is not following the normal rules as # it also tests notification creation. let!(:project1) { create(:project) }