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
Adapt tests to new rails based routing of notification center
Henriette Dargef03a703ae5e6
diff --git a/app/components/work_packages/details/tab_component.html.erb b/app/components/work_packages/details/tab_component.html.erbindex b1ed9590c52..80381b7e1ef 100644--- a/app/components/work_packages/details/tab_component.html.erb+++ b/app/components/work_packages/details/tab_component.html.erb@@ -10,7 +10,7 @@) do |c|c.with_text { t("js.work_packages.tabs.#{node.name}") }count = node.badge(work_package:).to_i- c.with_counter(count:) if count > 0+ c.with_counter(count:, test_selector: "wp-details-tab-component--tab-counter") if count > 0endendend@@ -22,6 +22,7 @@href: work_package_path(work_package.id, full_screen_tab),target: "_top",scheme: :invisible,+ test_selector: "wp-details-tab-component--full-screen",aria: { label: I18n.t("js.button_show_fullscreen") }))end@@ -30,6 +31,7 @@tag: :a,href: url_helpers.send(base_route),scheme: :invisible,+ test_selector: "wp-details-tab-component--close",aria: { label: I18n.t(:button_close) }))endenddiff --git a/app/components/work_packages/split_view_component.html.erb b/app/components/work_packages/split_view_component.html.erbindex 2d11e4c2816..50d4b612881 100644--- a/app/components/work_packages/split_view_component.html.erb+++ b/app/components/work_packages/split_view_component.html.erb@@ -6,7 +6,7 @@render(Primer::Beta::Blankslate.new(spacious: true)) do |component|component.with_visual_icon(icon: :inbox)component.with_heading(tag: :h2).with_content(- I18n.t(:error_work_package_id_not_found, id: @id)+ I18n.t(:error_work_package_id_not_found))endenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 72765ccbcc1..86115107c72 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1687,7 +1687,7 @@ en:error_pdf_failed_to_export: "The PDF export could not be saved: %{error}"error_token_authenticity: "Unable to verify Cross-Site Request Forgery token. Did you try to submit data on multiple browsers or tabs? Please close all tabs and try again."error_work_package_not_found_in_project: "The work package was not found or does not belong to this project"- error_work_package_id_not_found: "The work package %{id} was not found."+ error_work_package_id_not_found: "The work package was not found."error_must_be_project_member: "must be project member"error_migrations_are_pending: "Your OpenProject installation has pending database migrations. You have likely missed running the migrations on your last upgrade. Please check the upgrade guide to properly upgrade your installation."error_migrations_visit_upgrade_guides: "Please visit our upgrade guide documentation"diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.tsindex 0be6bd5d877..c4a7bab5ac3 100644--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts@@ -250,10 +250,7 @@ export class IanCenterService extends UntilDestroyedMixin {.pipe(take(1)).subscribe((notifications:INotification[][]) => {if (notifications.length <= 0) {- void this.state.go(- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions- `${this.state.current.data.baseRoute}`,- );+ window.location.href = this.pathHelper.notificationsPath();return;}if (notifications[0][0]._links.resource || notifications[this.selectedNotificationIndex][0]._links.resource) {@@ -322,7 +319,7 @@ export class IanCenterService extends UntilDestroyedMixin {},});- if (!this.deviceService.isMobile && this.state.includes('**.details.*')) {+ if (!this.deviceService.isMobile && window.location.href.includes('details')) {this.showNextNotification();}diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.htmlindex 854e80de1b1..14868f1cb42 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html@@ -88,18 +88,16 @@<divclass="op-ian-item--bottom-line">- <ng-container *ngIf="{ showDateAlert: (showDateAlert$ | async) } as context">- <op-in-app-notification-date-alert- *ngIf="context.showDateAlert"- [workPackage]="workPackage"- [aggregatedNotifications]="aggregatedNotifications"- ></op-in-app-notification-date-alert>- <op-in-app-notification-actors-line- *ngIf="!context.showDateAlert"- [notification]="notification"- [aggregatedNotifications]="aggregatedNotifications"- ></op-in-app-notification-actors-line>- </ng-container>+ <op-in-app-notification-date-alert+ *ngIf="showDateAlert"+ [workPackage]="workPackage"+ [aggregatedNotifications]="aggregatedNotifications"+ ></op-in-app-notification-date-alert>+ <op-in-app-notification-actors-line+ *ngIf="!showDateAlert"+ [notification]="notification"+ [aggregatedNotifications]="aggregatedNotifications"+ ></op-in-app-notification-actors-line></div></ng-container><ng-template #workPackageLoading>diff --git a/spec/features/notifications/navigation_spec.rb b/spec/features/notifications/navigation_spec.rbindex 911aecde334..69438b1ad43 100644--- a/spec/features/notifications/navigation_spec.rb+++ b/spec/features/notifications/navigation_spec.rb@@ -49,9 +49,9 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do# Navigate to full view and backwp_full = split_screen.switch_to_fullscreen- expect(page).to have_current_path "/work_packages/#{work_package.id}/relations"+ expect(page).to have_current_path "/projects/#{project.identifier}/work_packages/#{work_package.id}/relations"- wp_full.go_back+ page.execute_script("window.history.back()")expect(page).to have_current_path "/notifications/details/#{work_package.id}/relations"# Close the split screen@@ -63,7 +63,8 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite doit "opening a notification that does not exist returns to the center" dovisit "/notifications/details/0"- expect(page).to have_current_path "/notifications"+ expect(page).to have_current_path "/notifications/details/0"+ expect(page).to have_text "The work package was not found."endit "deep linking to a notification details highlights it" dodiff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rbindex 5e3399abc6a..038ba8ef550 100644--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb@@ -249,21 +249,21 @@ RSpec.describe "Notification center date alerts", :js, :with_cuprite,# Opening a date alert opens in overviewcenter.click_item notification_wp_start_past- split_screen = Pages::SplitWorkPackage.new wp_start_past+ split_screen = Pages::PrimerizedSplitWorkPackage.new wp_start_pastsplit_screen.expect_tab :overviewwait_for_network_idle# We expect no badge count- activity_tab.expect_no_notification_badge+ split_screen.expect_no_notification_badge# The same is true for the mention item that is opened in date alerts filter- center.click_item notification_wp_double_date_alert- split_screen = Pages::SplitWorkPackage.new wp_double_notification+ center.click_item notification_wp_double_mention+ split_screen = Pages::PrimerizedSplitWorkPackage.new wp_double_notificationsplit_screen.expect_tab :overviewwait_for_network_idle# We expect one badge- activity_tab.expect_notification_count 1+ split_screen.expect_notification_count 1# When a work package is updated to a different datewp_double_notification.update_column(:due_date, time_zone.now + 5.days)diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rbindex 756c15d7659..806e74e2bb3 100644--- a/spec/features/notifications/notification_center/notification_center_spec.rb+++ b/spec/features/notifications/notification_center/notification_center_spec.rb@@ -424,7 +424,7 @@ RSpec.describe "Notification center", :js, :with_cuprite,describe "logging into deep link", with_settings: { login_required: true } doit "redirects to the notification deep link" do- visit notifications_center_path(state: "details/#{work_package.id}/activity")+ visit details_notifications_path(work_package.id, tab: :activity)expect(page).to have_current_path /login/diff --git a/spec/features/notifications/notification_center/split_screen_spec.rb b/spec/features/notifications/notification_center/split_screen_spec.rbindex b9f97a51eeb..f90aab591ab 100644--- a/spec/features/notifications/notification_center/split_screen_spec.rb+++ b/spec/features/notifications/notification_center/split_screen_spec.rb@@ -75,7 +75,7 @@ RSpec.describe "Split screen in the notification center", :js, :with_cuprite dowp_full = split_screen.switch_to_fullscreenwp_full.expect_tab :relations- wp_full.go_back+ page.execute_script("window.history.back()")split_screen.expect_tab :relations# The split screen can be closeddiff --git a/spec/support/pages/work_packages/primerized_split_work_package.rb b/spec/support/pages/work_packages/primerized_split_work_package.rbindex cd27ed03204..363ff21a6d3 100644--- a/spec/support/pages/work_packages/primerized_split_work_package.rb+++ b/spec/support/pages/work_packages/primerized_split_work_package.rb@@ -36,12 +36,21 @@ module Pagesdef switch_to_tab(tab:)in_split_view do- click_link_or_button tab+ page.find_test_selector(tab_selector(tab)).clickendend+ def switch_to_fullscreen+ page.find_test_selector("wp-details-tab-component--full-screen").click+ FullWorkPackage.new(work_package, project)+ end++ def close+ page.find_test_selector("wp-details-tab-component--close").click+ end+def expect_tab(tab)- within_test_selector("wp-details-tab-component--tab-#{tab.downcase}") do |link|+ within_test_selector(tab_selector(tab)) do |link|link["data-aria-current"] == "page"endend@@ -49,5 +58,19 @@ module Pagesdef within_active_tab(&)within(".work-packages--details-content", &)end++ def expect_notification_count(count)+ expect(page).to have_test_selector("wp-details-tab-component--tab-counter", text: count)+ end++ def expect_no_notification_badge+ expect(page).not_to have_test_selector("wp-details-tab-component--tab-counter")+ end++ private++ def tab_selector(tab)+ "wp-details-tab-component--tab-#{tab.downcase}"+ endendend