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 specs

Oliver Güntherd18f9da17041
diff --git a/spec/features/notifications/navigation_spec.rb b/spec/features/notifications/navigation_spec.rb
index 31dcff23a42..911aecde334 100644
--- a/spec/features/notifications/navigation_spec.rb
+++ b/spec/features/notifications/navigation_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
let(:center) { Pages::Notifications::Center.new }
let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }
- let(:split_screen) { Pages::Notifications::SplitScreen.new work_package }
+ let(:split_screen) { Pages::PrimerizedSplitWorkPackage.new work_package }
current_user { recipient }
@@ -44,7 +44,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
expect(page).to have_current_path "/notifications/details/#{work_package.id}/activity"
# Switch to the relations tab
- split_screen.switch_to_tab tab: "relations"
+ split_screen.switch_to_tab tab: "Relations"
expect(page).to have_current_path "/notifications/details/#{work_package.id}/relations"
# Navigate to full view and back
@@ -69,7 +69,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
it "deep linking to a notification details highlights it" do
visit "/notifications/details/#{work_package.id}"
- expect(page).to have_current_path "/notifications/details/#{work_package.id}/overview"
+ expect(page).to have_current_path "/notifications/details/#{work_package.id}"
split_screen.expect_open
@@ -84,7 +84,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
it "can link to that parent from notifications (Regression #42984)" do
visit "/notifications/details/#{work_package.id}"
- expect(page).to have_current_path "/notifications/details/#{work_package.id}/overview"
+ expect(page).to have_current_path "/notifications/details/#{work_package.id}"
split_screen.expect_open
@@ -92,7 +92,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
page.find_test_selector("op-wp-breadcrumb-parent").click
- expect(page).to have_current_path "/work_packages/#{second_work_package.id}/activity"
+ expect(page).to have_current_path /\/work_packages\/#{second_work_package.id}/
# Works with another tab as well
visit "/notifications/details/#{work_package.id}/relations"
@@ -101,7 +101,7 @@ RSpec.describe "Notification center navigation", :js, :with_cuprite do
page.find_test_selector("op-wp-breadcrumb-parent").click
- expect(page).to have_current_path "/work_packages/#{second_work_package.id}/relations"
+ expect(page).to have_current_path /\/work_packages\/#{second_work_package.id}/
end
end
end
diff --git a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
index eabb80abcb7..c2b6f491d2f 100644
--- a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
@@ -145,7 +145,7 @@ RSpec.describe "Notification center sidemenu",
# Empty filter sets have a separate message
side_menu.click_item "Watcher"
side_menu.finished_loading
- expect(page).to have_text "Looks like you are all caught up for Watcher filter"
+ expect(page).to have_text "Looks like you are all caught up for this filter"
# Marking all as read
side_menu.click_item "Inbox"
diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rb
index 040fea93b4f..756c15d7659 100644
--- a/spec/features/notifications/notification_center/notification_center_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_spec.rb
@@ -430,7 +430,7 @@ RSpec.describe "Notification center", :js, :with_cuprite,
login_with recipient.login, "adminADMIN!", visit_signin_path: false
- expect(page).to have_current_path /notifications\/details\/#{work_package.id}\/activity/
+ expect(page).to have_current_path /notifications\/details\/#{work_package.id}/
end
end
end
diff --git a/spec/features/notifications/notification_center/split_screen_spec.rb b/spec/features/notifications/notification_center/split_screen_spec.rb
index f5a2c8bd407..b9f97a51eeb 100644
--- a/spec/features/notifications/notification_center/split_screen_spec.rb
+++ b/spec/features/notifications/notification_center/split_screen_spec.rb
@@ -3,7 +3,7 @@ require "spec_helper"
RSpec.describe "Split screen in the notification center", :js, :with_cuprite do
let(:global_html_title) { Components::HtmlTitle.new }
let(:center) { Pages::Notifications::Center.new }
- let(:split_screen) { Pages::Notifications::SplitScreen.new work_package }
+ let(:split_screen) { Pages::PrimerizedSplitWorkPackage.new work_package }
shared_let(:project) { create(:project) }
shared_let(:work_package) { create(:work_package, project:) }
@@ -61,7 +61,7 @@ RSpec.describe "Split screen in the notification center", :js, :with_cuprite do
split_screen.expect_open
# Activity is selected as default
- split_screen.expect_tab :activity
+ split_screen.expect_tab "Activity"
activity_tab = Components::WorkPackages::Activities.new(work_package)
activity_tab.expect_wp_has_been_created_activity work_package
diff --git a/spec/support/pages/notifications/center.rb b/spec/support/pages/notifications/center.rb
index c0e7cc906c3..d250a450e7c 100644
--- a/spec/support/pages/notifications/center.rb
+++ b/spec/support/pages/notifications/center.rb
@@ -40,7 +40,7 @@ module Pages
end
def mark_all_read
- click_button "Mark all as read"
+ click_link_or_button "Mark all as read"
end
def mark_notification_as_read(notification)
diff --git a/spec/support/pages/work_packages/primerized_split_work_package.rb b/spec/support/pages/work_packages/primerized_split_work_package.rb
index e0d5fe868b5..d66b0cf81fb 100644
--- a/spec/support/pages/work_packages/primerized_split_work_package.rb
+++ b/spec/support/pages/work_packages/primerized_split_work_package.rb
@@ -26,56 +26,28 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "support/pages/work_packages/abstract_work_package"
-require "support/pages/work_packages/split_work_package_create"
+require_relative "split_work_package"
module Pages
- class SplitWorkPackage < Pages::AbstractWorkPackage
- attr_reader :selector
-
- def initialize(work_package, project = nil)
- super
- @selector = ".work-packages--details"
- end
-
- def switch_to_fullscreen
- find(".work-packages--details-fullscreen-icon").click
- FullWorkPackage.new(work_package, project)
- end
-
- def expect_closed
- expect(page).to have_no_selector(@selector)
- end
-
- def expect_open
- wait_for_reload if using_cuprite?
- expect(page).to have_selector(@selector)
- expect_subject
- end
-
- def close
- find(".work-packages--details-close-icon").click
+ class PrimerizedSplitWorkPackage < Pages::SplitWorkPackage
+ def in_split_view(&)
+ page.within("#work-package-details-#{work_package.id}", &)
end
- def container
- find(@selector)
+ def switch_to_tab(tab:)
+ in_split_view do
+ click_link tab
+ end
end
- protected
-
- def path(tab = "overview")
- state = "#{work_package.id}/#{tab}"
-
- if project
- project_work_packages_path(project, "details/#{state}")
- else
- details_work_packages_path(state)
+ def expect_tab(tab)
+ expect(page).to have_link(tab) do |link|
+ link["data-aria-current"] == "page"
end
end
- def create_page(args)
- args.merge!(project: project || work_package.project)
- SplitWorkPackageCreate.new(**args)
+ def within_active_tab(&)
+ within(".work-packages--details-content", &)
end
end
end