Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add notification center sidemenu feature specs

Kabiru Mwenjaa8537f34484e
diff --git a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
index faf5a6209aa..c2cd4a83248 100644
--- a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
@@ -24,6 +24,7 @@ RSpec.describe "Notification center sidemenu",
shared_let(:work_package4) { create(:work_package, project: project3, author: other_user) }
shared_let(:work_package5) { create(:work_package, :is_milestone, project: project3, author: other_user) }
shared_let(:work_package6) { create(:work_package, :is_milestone, project: project3, author: other_user) }
+ shared_let(:work_package7) { create(:work_package, project: project3, author: other_user) }
let(:notification_watched) do
create(:notification,
@@ -67,9 +68,19 @@ RSpec.describe "Notification center sidemenu",
reason: :shared)
end
+ let(:notification_reminder) do
+ reminder = create(:reminder, remindable: work_package7, creator: other_user, note: "This is an important reminder")
+ notification = create(:notification,
+ recipient:,
+ resource: work_package7,
+ reason: :reminder)
+ create(:reminder_notification, reminder:, notification:)
+ notification
+ end
+
let(:notifications) do
[notification_watched, notification_assigned, notification_responsible, notification_mentioned, notification_date,
- notification_shared]
+ notification_shared, notification_reminder]
end
let(:center) { Pages::Notifications::Center.new }
@@ -99,6 +110,7 @@ RSpec.describe "Notification center sidemenu",
side_menu.expect_item_with_no_count "Watcher"
side_menu.expect_item_with_no_count "Date alert"
side_menu.expect_item_with_no_count "Shared"
+ side_menu.expect_item_with_no_count "Reminder"
end
end
@@ -106,35 +118,37 @@ RSpec.describe "Notification center sidemenu",
side_menu.expect_open
# Expect standard filters
- side_menu.expect_item_with_count "Inbox", 6
+ side_menu.expect_item_with_count "Inbox", 7
side_menu.expect_item_with_count "Assignee", 1
side_menu.expect_item_with_count "Mentioned", 1
side_menu.expect_item_with_count "Accountable", 1
side_menu.expect_item_with_count "Watcher", 1
side_menu.expect_item_with_count "Date alert", 1
side_menu.expect_item_with_count "Shared", 1
+ side_menu.expect_item_with_count "Reminder", 1
# Expect project filters
side_menu.expect_item_with_count project.name, 1
side_menu.expect_item_with_count project2.name, 1
- side_menu.expect_item_with_count "... #{project3.name}", 4
+ side_menu.expect_item_with_count "... #{project3.name}", 5
# Reading a notification...
center.mark_notification_as_read notification_watched
# ... will change the filter counts
- side_menu.expect_item_with_count "Inbox", 5
+ side_menu.expect_item_with_count "Inbox", 6
side_menu.expect_item_with_count "Assignee", 1
side_menu.expect_item_with_count "Mentioned", 1
side_menu.expect_item_with_count "Accountable", 1
side_menu.expect_item_with_count "Date alert", 1
side_menu.expect_item_with_count "Shared", 1
+ side_menu.expect_item_with_count "Reminder", 1
side_menu.expect_item_with_no_count "Watcher"
# ... and show only those projects with a notification
side_menu.expect_no_item project.name
side_menu.expect_item_with_count project2.name, 1
- side_menu.expect_item_with_count "... #{project3.name}", 4
+ side_menu.expect_item_with_count "... #{project3.name}", 5
# Empty filter sets have a separate message
side_menu.click_item "Watcher"
@@ -152,6 +166,7 @@ RSpec.describe "Notification center sidemenu",
side_menu.expect_item_with_no_count "Watcher"
side_menu.expect_item_with_no_count "Date alert"
side_menu.expect_item_with_no_count "Shared"
+ side_menu.expect_item_with_no_count "Reminder"
side_menu.expect_no_item project.name
side_menu.expect_no_item project2.name
@@ -160,66 +175,74 @@ RSpec.describe "Notification center sidemenu",
it "updates the content when a filter is clicked" do
# All notifications are shown
- center.expect_work_package_item *notifications
+ center.expect_work_package_item(*notifications)
# Filter for "Watcher"
side_menu.click_item "Watcher"
side_menu.finished_loading
center.expect_work_package_item notification_watched
center.expect_no_item notification_assigned, notification_responsible, notification_mentioned, notification_date,
- notification_shared
+ notification_shared, notification_reminder
# Filter for "Assignee"
side_menu.click_item "Assignee"
side_menu.finished_loading
center.expect_work_package_item notification_assigned
center.expect_no_item notification_watched, notification_responsible, notification_mentioned, notification_date,
- notification_shared
+ notification_shared, notification_reminder
# Filter for "Accountable"
side_menu.click_item "Accountable"
side_menu.finished_loading
center.expect_work_package_item notification_responsible
center.expect_no_item notification_watched, notification_assigned, notification_mentioned, notification_date,
- notification_shared
+ notification_shared, notification_reminder
# Filter for "Mentioned"
side_menu.click_item "Mentioned"
side_menu.finished_loading
center.expect_work_package_item notification_mentioned
center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_date,
- notification_shared
+ notification_shared, notification_reminder
# Filter for "Date alert"
side_menu.click_item "Date alert"
side_menu.finished_loading
center.expect_work_package_item notification_date
center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_mentioned,
- notification_shared
+ notification_shared, notification_reminder
# Filter for "Shared"
side_menu.click_item "Shared"
side_menu.finished_loading
center.expect_work_package_item notification_shared
center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_mentioned,
- notification_date
+ notification_date, notification_reminder
+
+ # Filter for "Reminder"
+ side_menu.click_item "Reminder"
+ side_menu.finished_loading
+ center.expect_work_package_item notification_reminder
+ center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_mentioned,
+ notification_date, notification_shared
# Filter for project1
side_menu.click_item project.name
side_menu.finished_loading
center.expect_work_package_item notification_watched
center.expect_no_item notification_assigned, notification_responsible, notification_mentioned, notification_date,
- notification_shared
+ notification_shared, notification_reminder
# Filter for project3
side_menu.click_item "... #{project3.name}"
side_menu.finished_loading
- center.expect_work_package_item notification_responsible, notification_mentioned, notification_date, notification_shared
+ center.expect_work_package_item notification_responsible, notification_mentioned, notification_date, notification_shared,
+ notification_reminder
center.expect_no_item notification_watched, notification_assigned
# Reset by clicking on the Inbox
side_menu.click_item "Inbox"
side_menu.finished_loading
- center.expect_work_package_item *notifications
+ center.expect_work_package_item(*notifications)
end
end