diff --git a/modules/backlogs/spec/features/resolved_status_spec.rb b/modules/backlogs/spec/features/resolved_status_spec.rb index 656177f3f3d7..ce72102dc5ed 100644 --- a/modules/backlogs/spec/features/resolved_status_spec.rb +++ b/modules/backlogs/spec/features/resolved_status_spec.rb @@ -54,7 +54,7 @@ check status.name click_button "Save" - settings_page.expect_toast(message: "Successful update") + expect_flash(type: :success, message: "Successful update") expect(page) .to have_checked_field(status.name) diff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rb index 2fb2ee4ebc71..c6800118012a 100644 --- a/modules/backlogs/spec/support/pages/backlogs.rb +++ b/modules/backlogs/spec/support/pages/backlogs.rb @@ -290,9 +290,5 @@ def backlog_selector(backlog) def story_selector(story) "#story_#{story.id}" end - - def toast_type - :ruby - end end end diff --git a/modules/budgets/spec/support/pages/budget_form.rb b/modules/budgets/spec/support/pages/budget_form.rb index af534598cab2..a57c6056cb45 100644 --- a/modules/budgets/spec/support/pages/budget_form.rb +++ b/modules/budgets/spec/support/pages/budget_form.rb @@ -179,9 +179,5 @@ def unit_rows def labor_rows @labor_rows ||= 0 end - - def toast_type - :rails - end end end diff --git a/modules/meeting/spec/features/meetings_participants_spec.rb b/modules/meeting/spec/features/meetings_participants_spec.rb index df46446df81a..a0a744778835 100644 --- a/modules/meeting/spec/features/meetings_participants_spec.rb +++ b/modules/meeting/spec/features/meetings_participants_spec.rb @@ -72,7 +72,8 @@ edit_page.uninvite(viewer_user) show_page = edit_page.click_save - show_page.expect_toast(message: "Successful update") + + expect_flash(message: "Successful update") show_page.expect_uninvited(viewer_user) end diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb index c8f92c517370..cf8452870d03 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb @@ -86,7 +86,7 @@ end it "can create a structured meeting and add agenda items" do - show_page.expect_toast(message: "Successful creation") + expect_flash(type: :success, message: "Successful creation") # Does not send invitation mails by default perform_enqueued_jobs @@ -248,7 +248,7 @@ end it "shows an error toast trying to update an outdated item" do - show_page.expect_toast(message: "Successful creation") + expect_flash(type: :success, message: "Successful creation") # Can add and edit a single item show_page.add_agenda_item do @@ -271,7 +271,7 @@ end it "can copy the meeting" do - show_page.expect_toast(message: "Successful creation") + expect_flash(type: :success, message: "Successful creation") # Can add and edit a single item show_page.add_agenda_item do @@ -327,7 +327,7 @@ context "when starting with empty sections" do it "can add, edit and delete sections" do - show_page.expect_toast(message: "Successful creation") + expect_flash(type: :success, message: "Successful creation") # create the first section show_page.add_section do diff --git a/modules/meeting/spec/support/pages/meetings/base.rb b/modules/meeting/spec/support/pages/meetings/base.rb index 87d935388b5c..d24b5b7c2447 100644 --- a/modules/meeting/spec/support/pages/meetings/base.rb +++ b/modules/meeting/spec/support/pages/meetings/base.rb @@ -33,9 +33,5 @@ class Base < Pages::Page def initialize(project) self.project = project end - - def toast_type - :rails - end end end diff --git a/spec/features/forums/message_spec.rb b/spec/features/forums/message_spec.rb index 8f21988a9ea5..4a5dbc0214c9 100644 --- a/spec/features/forums/message_spec.rb +++ b/spec/features/forums/message_spec.rb @@ -74,7 +74,7 @@ create_page.set_subject "The message is" create_page.click_save - create_page.expect_toast(type: :error, message: "Content can't be blank") + expect_flash(type: :error, message: "Content can't be blank") SeleniumHubWaiter.wait create_page.add_text "There is no message here" diff --git a/spec/features/projects/modules_spec.rb b/spec/features/projects/modules_spec.rb index f6df8dbcb020..7366239f900d 100644 --- a/spec/features/projects/modules_spec.rb +++ b/spec/features/projects/modules_spec.rb @@ -55,7 +55,7 @@ check "Activity" click_button "Save" - settings_page.expect_toast message: I18n.t(:notice_successful_update) + expect_flash type: :success, message: I18n.t(:notice_successful_update) expect(page).to have_checked_field "Activity" expect(page).to have_unchecked_field "Calendar" diff --git a/spec/support/pages/admin/system_settings/page.rb b/spec/support/pages/admin/system_settings/page.rb index 64d10b576707..6041329f0840 100644 --- a/spec/support/pages/admin/system_settings/page.rb +++ b/spec/support/pages/admin/system_settings/page.rb @@ -32,10 +32,6 @@ module Pages::Admin::SystemSettings class Page < ::Pages::Page - def toast_type - :rails - end - def press_save_button scroll_to(:bottom) click_button("Save") diff --git a/spec/support/pages/messages/base.rb b/spec/support/pages/messages/base.rb index 9e4a16145398..33a1eda46dc6 100644 --- a/spec/support/pages/messages/base.rb +++ b/spec/support/pages/messages/base.rb @@ -30,8 +30,5 @@ module Pages::Messages class Base < ::Pages::Page - def toast_type - :rails - end end end diff --git a/spec/support/pages/my/password_page.rb b/spec/support/pages/my/password_page.rb index 227db085f509..aeade3f0566c 100644 --- a/spec/support/pages/my/password_page.rb +++ b/spec/support/pages/my/password_page.rb @@ -45,24 +45,18 @@ def change_password(old_password, new_password, confirmation = new_password) end def expect_password_reuse_error_message(count) - expect_toast(type: :error, + expect_flash(type: :error, message: I18n.t(:"activerecord.errors.models.user.attributes.password.reused", count:)) end def expect_password_weak_error_message - expect_toast(type: :error, + expect_flash(type: :error, message: "Password Must contain characters of the following classes (at least 2 of 3): lowercase (e.g. 'a'), uppercase (e.g. 'A'), numeric (e.g. '1')") end def expect_password_updated_message expect_and_dismiss_flash(type: :info, message: I18n.t(:notice_account_password_updated)) end - - private - - def toast_type - :rails - end end end end diff --git a/spec/support/pages/projects/settings.rb b/spec/support/pages/projects/settings.rb index 1482c6e1e990..7b698f23e05e 100644 --- a/spec/support/pages/projects/settings.rb +++ b/spec/support/pages/projects/settings.rb @@ -83,10 +83,6 @@ def fieldset_label private - def toast_type - :rails - end - def path project_settings_general_path(project) end diff --git a/spec/support/pages/projects/show.rb b/spec/support/pages/projects/show.rb index 16e38f09e1a1..7e1ea638a052 100644 --- a/spec/support/pages/projects/show.rb +++ b/spec/support/pages/projects/show.rb @@ -47,10 +47,6 @@ def within_sidebar(&) within("#menu-sidebar", &) end - def toast_type - :rails - end - def visit_page visit path end diff --git a/spec/support/pages/types/index.rb b/spec/support/pages/types/index.rb index 6cb9d3a734ea..2f7077ba4344 100644 --- a/spec/support/pages/types/index.rb +++ b/spec/support/pages/types/index.rb @@ -82,10 +82,6 @@ def within_row(type) def canonical_name(type) type.respond_to?(:name) ? type.name : type end - - def toast_type - :rails - end end end end diff --git a/spec/support/toasts/expectations.rb b/spec/support/toasts/expectations.rb index 4ed7f4fd9455..dba43f746a1b 100644 --- a/spec/support/toasts/expectations.rb +++ b/spec/support/toasts/expectations.rb @@ -1,21 +1,7 @@ module Toasts module Expectations def expect_toast(message:, type: :success, wait: 20) - if toast_type == :angular - expect(page).to have_css(".op-toast.-#{type}", text: message, wait:) - elsif type == :error - ActiveSupport::Deprecation.warn( - "Use `expect_flash(type: :error, message: message)` instead of expect_toast with type: :error" - ) - expect_flash(type: :error, message:) - elsif type == :success - ActiveSupport::Deprecation.warn( - "Use `expect_flash(type: :success, message:)` instead of expect_toast with type: :success" - ) - expect_flash(message:) - else - raise NotImplementedError - end + expect(page).to have_css(".op-toast.-#{type}", text: message, wait:) end def expect_and_dismiss_toaster(message: nil, type: :success, wait: 20) @@ -43,9 +29,5 @@ def expect_no_toaster(type: :success, message: nil, wait: 10) expect(page).to have_no_css(".op-toast.-#{type}", text: message, wait:) end end - - def toast_type - :angular - end end end