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 shared notification feature specs

Dombi Attilaeddf5446fc9b
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 1a99b09da43..92e5a4b05e4 100644
--- a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
@@ -21,8 +21,9 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
shared_let(:work_package3) { create(:work_package, project: project3, author: other_user) }
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) }
- let(:notification) do
+ let(:notification_watched) do
create(:notification,
recipient:,
project:,
@@ -30,7 +31,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
reason: :watched)
end
- let(:notification2) do
+ let(:notification_assigned) do
create(:notification,
recipient:,
project: project2,
@@ -38,7 +39,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
reason: :assigned)
end
- let(:notification3) do
+ let(:notification_responsible) do
create(:notification,
recipient:,
project: project3,
@@ -46,7 +47,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
reason: :responsible)
end
- let(:notification4) do
+ let(:notification_mentioned) do
create(:notification,
recipient:,
project: project3,
@@ -54,7 +55,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
reason: :mentioned)
end
- let(:notification5) do
+ let(:notification_date) do
create(:notification,
recipient:,
project: project3,
@@ -62,8 +63,17 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
reason: :date_alert_start_date)
end
+ let(:notification_shared) do
+ create(:notification,
+ recipient:,
+ project: project3,
+ resource: work_package6,
+ reason: :shared)
+ end
+
let(:notifications) do
- [notification, notification2, notification3, notification4, notification5]
+ [notification_watched, notification_assigned, notification_responsible, notification_mentioned, notification_date,
+ notification_shared]
end
let(:center) { Pages::Notifications::Center.new }
@@ -92,6 +102,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
side_menu.expect_item_with_no_count 'Accountable'
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'
end
end
@@ -99,33 +110,35 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
side_menu.expect_open
# Expect standard filters
- 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 'Watcher', 1
side_menu.expect_item_with_count 'Date alert', 1
+ side_menu.expect_item_with_count 'Shared', 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}", 3
+ side_menu.expect_item_with_count "... #{project3.name}", 4
# Reading a notification...
- center.mark_notification_as_read notification
+ center.mark_notification_as_read notification_watched
# ... will change the filter counts
- side_menu.expect_item_with_count 'Inbox', 4
+ side_menu.expect_item_with_count 'Inbox', 5
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_no_count 'Watcher'
# ... and show only those projects with a notification
side_menu.expect_item_not_visible project.name
side_menu.expect_item_with_count project2.name, 1
- side_menu.expect_item_with_count "... #{project3.name}", 3
+ side_menu.expect_item_with_count "... #{project3.name}", 4
# Empty filter sets have a separate message
side_menu.click_item 'Watcher'
@@ -142,6 +155,7 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
side_menu.expect_item_with_no_count 'Accountable'
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_not_visible project.name
side_menu.expect_item_not_visible project2.name
@@ -155,44 +169,57 @@ RSpec.describe "Notification center sidemenu", :js, :with_cuprite,
# Filter for "Watcher"
side_menu.click_item 'Watcher'
side_menu.finished_loading
- center.expect_work_package_item notification
- center.expect_no_item notification2, notification3, notification4, notification5
+ center.expect_work_package_item notification_watched
+ center.expect_no_item notification_assigned, notification_responsible, notification_mentioned, notification_date,
+ notification_shared
# Filter for "Assignee"
side_menu.click_item 'Assignee'
side_menu.finished_loading
- center.expect_work_package_item notification2
- center.expect_no_item notification, notification3, notification4, notification5
+ center.expect_work_package_item notification_assigned
+ center.expect_no_item notification_watched, notification_responsible, notification_mentioned, notification_date,
+ notification_shared
# Filter for "Accountable"
side_menu.click_item 'Accountable'
side_menu.finished_loading
- center.expect_work_package_item notification3
- center.expect_no_item notification, notification2, notification4, notification5
+ center.expect_work_package_item notification_responsible
+ center.expect_no_item notification_watched, notification_assigned, notification_mentioned, notification_date,
+ notification_shared
# Filter for "Mentioned"
side_menu.click_item 'Mentioned'
side_menu.finished_loading
- center.expect_work_package_item notification4
- center.expect_no_item notification, notification2, notification3, notification5
+ center.expect_work_package_item notification_mentioned
+ center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_date,
+ notification_shared
# Filter for "Date alert"
side_menu.click_item 'Date alert'
side_menu.finished_loading
- center.expect_work_package_item notification5
- center.expect_no_item notification, notification2, notification3, notification4
+ center.expect_work_package_item notification_date
+ center.expect_no_item notification_watched, notification_assigned, notification_responsible, notification_mentioned,
+ notification_shared
+
+ # 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
# Filter for project1
side_menu.click_item project.name
side_menu.finished_loading
- center.expect_work_package_item notification
- center.expect_no_item notification2, notification3, notification4, notification5
+ center.expect_work_package_item notification_watched
+ center.expect_no_item notification_assigned, notification_responsible, notification_mentioned, notification_date,
+ notification_shared
# Filter for project3
side_menu.click_item "... #{project3.name}"
side_menu.finished_loading
- center.expect_work_package_item notification3, notification4, notification5
- center.expect_no_item notification, notification2
+ center.expect_work_package_item notification_responsible, notification_mentioned, notification_date, notification_shared
+ center.expect_no_item notification_watched, notification_assigned
# Reset by clicking on the Inbox
side_menu.click_item 'Inbox'