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

IAN center: feature spec for notification aggregation

Wieland Lindenthal3b645c571afc
diff --git a/spec/features/notifications/notification_center_spec.rb b/spec/features/notifications/notification_center_spec.rb
index 0dd65541ef1..be59a99fd47 100644
--- a/spec/features/notifications/notification_center_spec.rb
+++ b/spec/features/notifications/notification_center_spec.rb
@@ -115,5 +115,48 @@ describe "Notification center", type: :feature, js: true do
center.open
center.expect_empty
end
+
+ context 'with mutliple notifications per work package' do
+ # In this context we have three notifications for two work packages.
+ shared_let(:second_work_package) { FactoryBot.create :work_package, project: project }
+ shared_let(:second_notification) do
+ FactoryBot.create :notification,
+ recipient: recipient,
+ project: project,
+ resource: second_work_package,
+ journal: work_package.journals.last
+ end
+ shared_let(:third_notification) do
+ FactoryBot.create :notification,
+ recipient: recipient,
+ project: project,
+ resource: work_package,
+ journal: work_package.journals.last
+ end
+ let(:second_split_screen) { ::Pages::SplitWorkPackage.new second_work_package }
+
+ it 'aggregates notifications per work package and sets all as read when opened' do
+ visit home_path
+ center.expect_bell_count 3
+ center.open
+
+ # Click on first list item, which should be the youngest notification
+ center.click_item third_notification
+
+ split_screen.expect_open
+ center.expect_read_item third_notification
+ expect(notification.reload.read_ian).to be_truthy
+ expect(second_notification.reload.read_ian).to be_falsey
+ expect(third_notification.reload.read_ian).to be_truthy
+
+ # Click on second list item, which should be the youngest notification that does
+ # not belong to the work package that represents the first list item.
+ center.click_item second_notification
+
+ second_split_screen.expect_open
+ center.expect_read_item second_notification
+ expect(second_notification.reload.read_ian).to be_truthy
+ end
+ end
end
end
diff --git a/spec/support/components/notifications/center.rb b/spec/support/components/notifications/center.rb
index b39ba76323d..9a9144745e6 100644
--- a/spec/support/components/notifications/center.rb
+++ b/spec/support/components/notifications/center.rb
@@ -108,4 +108,4 @@ module Components
end
end
end
-end
\ No newline at end of file
+end