From f4f216802c09a9a46e12c0794c9b4e073e7b2f84 Mon Sep 17 00:00:00 2001 From: Kabiru Mwenja Date: Thu, 5 Dec 2024 16:52:03 +0300 Subject: [PATCH] Add basic notification reminder feature spec --- .../notification_center_reminder_spec.rb | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 spec/features/notifications/notification_center/notification_center_reminder_spec.rb diff --git a/spec/features/notifications/notification_center/notification_center_reminder_spec.rb b/spec/features/notifications/notification_center/notification_center_reminder_spec.rb new file mode 100644 index 000000000000..d1f3cf3c04bd --- /dev/null +++ b/spec/features/notifications/notification_center/notification_center_reminder_spec.rb @@ -0,0 +1,58 @@ +require "spec_helper" +require "features/page_objects/notification" + +RSpec.describe "Notification center reminder, mention and date alert", + :js, + :with_cuprite, + with_settings: { journal_aggregation_time_minutes: 0 } do + shared_let(:project) { create(:project) } + shared_let(:actor) { create(:user, firstname: "Actor", lastname: "User") } + shared_let(:user) do + create(:user, + member_with_permissions: { project => %w[view_work_packages] }) + end + shared_let(:work_package) { create(:work_package, project:, due_date: 1.day.ago) } + + shared_let(:notification_mention) do + create(:notification, + reason: :mentioned, + recipient: user, + resource: work_package, + actor:) + end + + shared_let(:notification_date_alert) do + create(:notification, + reason: :date_alert_due_date, + recipient: user, + resource: work_package) + end + + shared_let(:notification_reminder) do + reminder = create(:reminder, remindable: work_package, creator: user, note: "This is an important reminder") + notification = create(:notification, + reason: :reminder, + recipient: user, + resource: work_package) + create(:reminder_notification, reminder:, notification:) + notification + end + + let(:center) { Pages::Notifications::Center.new } + + before do + login_as user + visit notifications_center_path + wait_for_reload + end + + context "with reminders", with_ee: %i[date_alerts] do + it "shows only the reminder alert time and note" do + center.within_item(notification_reminder) do + expect(page).to have_text("Date alert, Mentioned, Reminder") + expect(page).to have_no_text("Actor user") + expect(page).to have_text("a few seconds ago\nNote: “This is an important reminder”") + end + end + end +end