diff --git a/modules/overviews/spec/features/managing_dashboard_page_spec.rb b/modules/overviews/spec/features/managing_dashboard_page_spec.rb index 8910061f404..54cc1fff4c5 100644 --- a/modules/overviews/spec/features/managing_dashboard_page_spec.rb +++ b/modules/overviews/spec/features/managing_dashboard_page_spec.rb @@ -114,7 +114,7 @@ RSpec.describe "Dashboard page managing", :js do # We cannot use expect_and_dismiss_toaster for the first toast because its internal # expect_no_toaster check races with the second toast appearing immediately after dismiss. dashboard_page.expect_toast message: I18n.t("js.notice_successful_update") - dashboard_page.dismiss_toaster! + dashboard_page.dismiss_specific_toaster!(message: I18n.t("js.notice_successful_update")) # Fixing flaky spec: for some reason, the second request to load the table is not executed until # some activity happens on the page. Sending an enter key to trigger the second request. diff --git a/spec/support/toasts/expectations.rb b/spec/support/toasts/expectations.rb index 3b6c1a08246..a2b7d407461 100644 --- a/spec/support/toasts/expectations.rb +++ b/spec/support/toasts/expectations.rb @@ -17,6 +17,11 @@ module Toasts page.find(".op-toast--close").click end + def dismiss_specific_toaster!(message:, type: :success) + sleep 0.1 + page.find(".op-toast.-#{type}", text: message).find(".op-toast--close").click + end + # Clears a toaster if there is one waiting 1 second max, but do not fail if there is none def clear_any_toasters if has_button?(I18n.t("js.close_popup_title"), wait: 1)