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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add test case for switching between different split screens
Henriette Dargee1e8665a8433
diff --git a/spec/features/notifications/notification_center_spec.rb b/spec/features/notifications/notification_center_spec.rbindex 2539836c763..0dd65541ef1 100644--- a/spec/features/notifications/notification_center_spec.rb+++ b/spec/features/notifications/notification_center_spec.rb@@ -4,6 +4,7 @@ require 'support/components/notifications/center'describe "Notification center", type: :feature, js: true doshared_let(:project) { FactoryBot.create :project }shared_let(:work_package) { FactoryBot.create :work_package, project: project }+ shared_let(:work_package2) { FactoryBot.create :work_package, project: project }shared_let(:recipient) doFactoryBot.create :user,member_in_project: project,@@ -17,6 +18,14 @@ describe "Notification center", type: :feature, js: true dojournal: work_package.journals.lastend+ shared_let(:notification2) do+ FactoryBot.create :notification,+ recipient: recipient,+ project: project,+ resource: work_package2,+ journal: work_package.journals.last+ end+let(:center) { ::Components::Notifications::Center.new }let(:activity_tab) { ::Components::WorkPackages::Activities.new(work_package) }let(:split_screen) { ::Pages::SplitWorkPackage.new work_package }@@ -27,10 +36,11 @@ describe "Notification center", type: :feature, js: true doit 'will not show all details of the journal' doallow(notification.journal).to receive(:initial?).and_return truevisit home_path- center.expect_bell_count 1+ center.expect_bell_count 2center.opencenter.expect_work_package_item notification+ center.expect_work_package_item notification2center.click_item notificationsplit_screen.expect_open@@ -43,31 +53,62 @@ describe "Notification center", type: :feature, js: true doit 'can see the notification and dismiss it' dovisit home_path- center.expect_bell_count 1+ center.expect_bell_count 2center.opencenter.expect_work_package_item notification+ center.expect_work_package_item notification2center.mark_all_readcenter.expect_bell_count 0notification.reloadexpect(notification.read_ian).to be_truthy++ center.expect_no_item notification+ center.expect_no_item notification2endit 'can open the split screen of the notification to mark it as read' dovisit home_path- center.expect_bell_count 1+ center.expect_bell_count 2center.opencenter.click_item notificationsplit_screen.expect_opencenter.expect_read_item notification+ center.expect_work_package_item notification2retry_block donotification.reloadraise "Expected notification to be marked read" unless notification.read_ianend+ center.close+ center.expect_bell_count 1++ center.open+ center.expect_no_item notification+ center.expect_work_package_item notification2+ end++ it 'can switch between multiple notifications and the split screen remains open and updates accordingly' do+ visit home_path+ center.expect_bell_count 2+ center.open++ center.click_item notification+ split_screen.expect_open+ center.expect_read_item notification+ center.expect_work_package_item notification2++ center.click_item notification2+ split_screen = ::Pages::SplitWorkPackage.new(work_package2, project)+ split_screen.expect_open+ center.expect_read_item notification2++ split_screen.close+ split_screen.expect_closed+center.closecenter.expect_bell_count 0diff --git a/spec/support/components/notifications/center.rb b/spec/support/components/notifications/center.rbindex 4e4faa70077..b39ba76323d 100644--- a/spec/support/components/notifications/center.rb+++ b/spec/support/components/notifications/center.rb@@ -65,6 +65,11 @@ module Componentsendend+ def expect_no_item(notification)+ expect(page)+ .to have_no_selector("[data-qa-selector='op-ian-notification-item-#{notification.id}']")+ end+def expect_read_item(notification)expect(page).to have_selector("[data-qa-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")