Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/my_page/spec/features/my/work_package_table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@
assigned_to_me_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)")
expect(assigned_to_me_area.area)
.to have_css(".subject", text: other_type_work_package.subject)
my_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
my_page.expect_and_dismiss_all_toasters message: I18n.t("js.notice_successful_update")

my_page.add_widget(1, 3, :column, "Work packages table")
my_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
my_page.expect_and_dismiss_all_toasters message: I18n.t("js.notice_successful_update")

created_by_me_area.remove
my_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
my_page.expect_and_dismiss_all_toasters message: I18n.t("js.notice_successful_update")
assigned_to_me_area.remove
my_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
my_page.expect_and_dismiss_all_toasters message: I18n.t("js.notice_successful_update")

filter_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)")
filter_area.expect_to_span(1, 1, 2, 2)
Expand Down
14 changes: 14 additions & 0 deletions spec/support/toasts/expectations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ def expect_and_dismiss_toaster(message: nil, type: :success, wait: 20)
expect_no_toaster(type:, message:, wait: 0.1)
end

# Like #expect_and_dismiss_toaster, but tolerant of a single user action raising
# several identical toasts (e.g. a grid change that persists in multiple steps).
# Dismisses every matching toast, allowing late ones to still appear, before
# asserting that none remain.
def expect_and_dismiss_all_toasters(message: nil, type: :success, wait: 20)
expect_toast(type:, message:, wait:)

while page.has_css?(".op-toast.-#{type}", wait: 1)
page.first(".op-toast.-#{type} .op-toast--close", wait: 1).click
end

expect_no_toaster(type:, message:, wait: 2)
end

def dismiss_toaster!
sleep 0.1
page.find(".op-toast--close").click
Expand Down
Loading