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 navigation spec

Oliver Güntherc8768c51345a
diff --git a/spec/features/notifications/turbo_angular_navigation_spec.rb b/spec/features/notifications/turbo_angular_navigation_spec.rb
new file mode 100644
index 00000000000..d2de0bfb98a
--- /dev/null
+++ b/spec/features/notifications/turbo_angular_navigation_spec.rb
@@ -0,0 +1,95 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+require "spec_helper"
+
+RSpec.describe "Turbo and Angular navigation integration", :js do
+ shared_let(:project) { create(:project) }
+ shared_let(:user) { create(:admin) }
+
+ shared_let(:work_package) do
+ create(:work_package, project:, author: user, subject: "Test Work Package")
+ end
+
+ shared_let(:notification) { create(:notification, resource: work_package, recipient: user) }
+
+ let(:center) { Pages::Notifications::Center.new }
+ let(:split_screen) { Pages::SplitWorkPackage.new work_package }
+ let(:full_screen) { Pages::FullWorkPackage.new work_package }
+
+ before do
+ login_as user
+ end
+
+ describe "navigation between notification center and work package views" do
+ it "reproduces the Turbo/Angular navigation issue with work package sidebar" do
+ # Step 1: Open notification center
+ center.visit!
+ wait_for_reload
+
+ # Wait for notification to be available
+ expect(notification).to be_present
+ expect(notification.resource).to eq(work_package)
+
+ center.expect_bell_count 1
+ center.open
+
+ # Step 2: Click a notification so that the work package opens on the side
+ center.click_item notification
+ split_screen.expect_open
+ center.expect_item_selected notification
+
+ # Step 3: Click on the work package #id from the notifications list
+ # This should open the work package in full view
+ center.click_id notification
+ full_screen.expect_subject
+
+ # Step 4: Click back once
+ # Expected: Should go back to the notification center with split screen open
+ # Bug: The same work package page is displayed again
+ page.go_back
+
+ # This assertion will fail with the current bug - it should show the split screen
+ # but instead shows the full work package view again
+ expect(page).to have_current_path(/notifications/)
+ split_screen.expect_open
+
+ # Step 5: Click back a second time
+ # Expected: Should go back to the notification center, but the work package sidebar is hidden
+ # Bug: The work package sidebar should be visible but is hidden
+ page.go_back
+
+ # Sidebar should remain open
+ expect(page).to have_current_path(/notifications/)
+ center.expect_open
+ split_screen.expect_open
+ end
+ end
+end
diff --git a/spec/support/pages/notifications/center.rb b/spec/support/pages/notifications/center.rb
index 3a95b121523..a9b6bfb1fba 100644
--- a/spec/support/pages/notifications/center.rb
+++ b/spec/support/pages/notifications/center.rb
@@ -68,6 +68,12 @@ module Pages
item_title(notification).click
end
+ def click_id(notification)
+ within_item(notification) do
+ click_on("##{notification.resource.id}")
+ end
+ end
+
def double_click_item(notification)
item_title(notification).double_click
end