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

Adapt notification spec to new split screen design

Henriette Darge7a00da991791
diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
index e01ff12a86e..528950d02a1 100644
--- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
+++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
@@ -1,5 +1,6 @@
<a
class="op-ian-bell op-app-menu--item-action"
+ data-qa-selector="op-ian-bell"
uiSref="notifications"
>
<op-icon icon-classes="icon-bell">
diff --git a/frontend/src/app/features/work-packages/components/back-routing/back-button.component.html b/frontend/src/app/features/work-packages/components/back-routing/back-button.component.html
index 4973c83ec83..d418c128b08 100644
--- a/frontend/src/app/features/work-packages/components/back-routing/back-button.component.html
+++ b/frontend/src/app/features/work-packages/components/back-routing/back-button.component.html
@@ -1,5 +1,6 @@
<button
class="op-back-button button hide-when-print"
+ data-qa-selector="op-back-button"
[ngClass]="linkClass"
[title]="text.goBack"
(click)="goBack()"
diff --git a/spec/features/notifications/notification_center_spec.rb b/spec/features/notifications/notification_center_spec.rb
index 3b686e6fc67..2539836c763 100644
--- a/spec/features/notifications/notification_center_spec.rb
+++ b/spec/features/notifications/notification_center_spec.rb
@@ -18,6 +18,8 @@ describe "Notification center", type: :feature, js: true do
end
let(:center) { ::Components::Notifications::Center.new }
+ let(:activity_tab) { ::Components::WorkPackages::Activities.new(work_package) }
+ let(:split_screen) { ::Pages::SplitWorkPackage.new work_package }
describe 'notification for a new journal' do
current_user { recipient }
@@ -30,11 +32,9 @@ describe "Notification center", type: :feature, js: true do
center.expect_work_package_item notification
center.click_item notification
- center.expect_expanded notification
+ split_screen.expect_open
- center.within_item(notification) do
- expect(page).to have_text "The work package was created."
- end
+ activity_tab.expect_activity_listed "created on #{work_package.created_at.strftime('%m/%d/%Y')}"
end
end
@@ -48,20 +48,19 @@ describe "Notification center", type: :feature, js: true do
center.expect_work_package_item notification
center.mark_all_read
- center.expect_closed
center.expect_bell_count 0
notification.reload
expect(notification.read_ian).to be_truthy
end
- it 'can expand the notification to mark it as read' do
+ it 'can open the split screen of the notification to mark it as read' do
visit home_path
center.expect_bell_count 1
center.open
center.click_item notification
- center.expect_expanded notification
+ split_screen.expect_open
center.expect_read_item notification
retry_block do
diff --git a/spec/support/components/notifications/center.rb b/spec/support/components/notifications/center.rb
index eecb1850bff..4e4faa70077 100644
--- a/spec/support/components/notifications/center.rb
+++ b/spec/support/components/notifications/center.rb
@@ -40,7 +40,7 @@ module Components
end
def close
- page.find('button[data-qa-selector="op-modal-close"]').click
+ page.find('button[data-qa-selector="op-back-button"]').click
expect_closed
end
@@ -70,12 +70,6 @@ module Components
.to have_selector("[data-qa-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")
end
- def expect_expanded(notification)
- within_item(notification) do
- expect(page).to have_selector('[data-qa-selector="op-ian-details"]')
- end
- end
-
def expect_work_package_item(notification)
work_package = notification.resource
raise(ArgumentError, "Expected work package") unless work_package.is_a?(WorkPackage)
@@ -105,7 +99,7 @@ module Components
end
def bell_element
- page.find('op-in-app-notification-bell button')
+ page.find('op-in-app-notification-bell [data-qa-selector="op-ian-bell"]')
end
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 4be0e3b8d6d..c258686f2e9 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -36,6 +36,13 @@ module Components
def initialize(work_package)
@work_package = work_package
+ @container = '.work-package-details-activities-list'
+ end
+
+ def expect_activity_listed(activity)
+ within @container do
+ expect(page).to have_content(activity)
+ end
end
def hover_action(journal_id, action)
diff --git a/spec/support/pages/work_packages/split_work_package.rb b/spec/support/pages/work_packages/split_work_package.rb
index 8590962b740..30ef22726d2 100644
--- a/spec/support/pages/work_packages/split_work_package.rb
+++ b/spec/support/pages/work_packages/split_work_package.rb
@@ -47,6 +47,14 @@ module Pages
expect(page).to have_no_selector(@selector)
end
+ def expect_open
+ expect(page).to have_selector(@selector)
+
+ within container do
+ expect(page).to have_selector('.work-packages--details--subject', text: work_package.subject)
+ end
+ end
+
def close
find('.work-packages--details-close-icon').click
end