mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Add a helper to dismiss a specific toast message
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user