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
Test some functionality of the tabs of the primerized split screen as it should behave the same way, the old tabs behave
Henriette Darge58a7130bdfe0
diff --git a/app/components/work_packages/details/tab_component.html.erb b/app/components/work_packages/details/tab_component.html.erbindex 9e47fba192c..1561aa56938 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:, hide_if_zero: true, id: "wp-details-tab-#{node.name}-counter", test_selector: "wp-details-tab-component--tab-counter")+ c.with_counter(count:, hide_if_zero: true, id: "wp-details-tab-#{node.name}-counter", test_selector: "wp-details-tab-component--#{node.name}-counter")endendenddiff --git a/app/components/work_packages/details/update_counter_component.rb b/app/components/work_packages/details/update_counter_component.rbindex 38fef212baf..48d0c64f4ce 100644--- a/app/components/work_packages/details/update_counter_component.rb+++ b/app/components/work_packages/details/update_counter_component.rb@@ -18,7 +18,7 @@ class WorkPackages::Details::UpdateCounterComponent < ApplicationComponent.new(count:,hide_if_zero: true,id: wrapper_key,- test_selector: "wp-details-tab-component--tab-counter")+ test_selector: "wp-details-tab-component--#{@menu.name}-counter")end# We don't need a wrapper component, but wrap on the counter iddiff --git a/modules/github_integration/config/locales/js-en.yml b/modules/github_integration/config/locales/js-en.ymlindex 8e856069d20..a54613b6a8d 100644--- a/modules/github_integration/config/locales/js-en.yml+++ b/modules/github_integration/config/locales/js-en.yml@@ -57,3 +57,6 @@ en:draft: 'drafted'merged: 'merged'ready_for_review: 'marked ready for review'+ work_packages:+ tabs:+ github: "GitHub"diff --git a/modules/github_integration/spec/features/work_package_github_tab_spec.rb b/modules/github_integration/spec/features/work_package_github_tab_spec.rbindex 50a59b65bb8..b2d74548441 100644--- a/modules/github_integration/spec/features/work_package_github_tab_spec.rb+++ b/modules/github_integration/spec/features/work_package_github_tab_spec.rb@@ -106,7 +106,7 @@ RSpec.describe "Open the GitHub tab", :js doit "does not show the github tab" dowork_package_page.visit!- github_tab.expect_tab_not_present+ work_package_page.expect_no_tab "Github"endend@@ -116,7 +116,7 @@ RSpec.describe "Open the GitHub tab", :js doit "does not show the github tab" dowork_package_page.visit!- github_tab.expect_tab_not_present+ work_package_page.expect_no_tab "Github"endendend@@ -132,4 +132,12 @@ RSpec.describe "Open the GitHub tab", :js doit_behaves_like "a github tab"end++ describe "primerized work package split view" do+ let(:work_package_page) { Pages::PrimerizedSplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::PrimerizedTabs.new }+ let(:github_tab_element) { "github" }++ it_behaves_like "a github tab"+ endenddiff --git a/modules/github_integration/spec/support/pages/work_package_github_tab.rb b/modules/github_integration/spec/support/pages/work_package_github_tab.rbindex 39c3f7d59a1..eeb429ec390 100644--- a/modules/github_integration/spec/support/pages/work_package_github_tab.rb+++ b/modules/github_integration/spec/support/pages/work_package_github_tab.rb@@ -55,10 +55,6 @@ module Pagespage.send_keys(meta_key, "v")end- def expect_tab_not_present- expect(page).to have_no_css(".op-tab-row--link", text: "GITHUB")- end-privatedef osx?diff --git a/modules/gitlab_integration/config/locales/js-en.yml b/modules/gitlab_integration/config/locales/js-en.ymlindex 83c76586c3f..8db996c5c66 100644--- a/modules/gitlab_integration/config/locales/js-en.yml+++ b/modules/gitlab_integration/config/locales/js-en.yml@@ -55,3 +55,6 @@ en:empty: There are no merge requests linked yet. Link an existing MR by using the code <code>OP#%{wp_id}</code> (or <code>PP#%{wp_id}</code> for private links) in the MR title/description or create a new MR.gitlab_pipelines: Pipelinesupdated_on: Updated on+ work_packages:+ tabs:+ gitlab: "GitLab"diff --git a/modules/meeting/config/locales/js-en.yml b/modules/meeting/config/locales/js-en.ymlindex d14ff2dc2ec..1572bbff9c9 100644--- a/modules/meeting/config/locales/js-en.yml+++ b/modules/meeting/config/locales/js-en.yml@@ -29,3 +29,6 @@en:js:label_meetings: 'Meetings'+ work_packages:+ tabs:+ meetings: 'Meetings'diff --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 96726418d7f..92512d6a777 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@@ -168,7 +168,7 @@ RSpec.describe "Notification center date alerts", :js, :with_cuprite,let(:center) { Pages::Notifications::Center.new }let(:side_menu) { Components::Submenu.new }let(:toaster) { PageObjects::Notifications.new(page) }- let(:activity_tab) { Components::WorkPackages::Activities.new(notification_wp_due_today) }+ let(:tabs) { Components::WorkPackages::PrimerizedTabs.new }# Converts "hh:mm" into { hour: h, min: m }def time_hash(time)@@ -254,7 +254,7 @@ RSpec.describe "Notification center date alerts", :js, :with_cuprite,wait_for_network_idle# We expect no badge count- split_screen.expect_no_notification_badge+ tabs.expect_no_counter "activity"# The same is true for the mention item that is opened in date alerts filtercenter.click_item notification_wp_double_date_alert@@ -263,7 +263,7 @@ RSpec.describe "Notification center date alerts", :js, :with_cuprite,wait_for_network_idle# We expect one badge- split_screen.expect_notification_count 1+ tabs.expect_counter "activity", 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/work_packages/details/relations/hierarchy_spec.rb b/spec/features/work_packages/details/relations/hierarchy_spec.rbindex 7394e0f4fff..a66690e17fa 100644--- a/spec/features/work_packages/details/relations/hierarchy_spec.rb+++ b/spec/features/work_packages/details/relations/hierarchy_spec.rb@@ -36,9 +36,6 @@ RSpec.shared_examples "work package relations tab", :js, :selenium dolet(:project) { create(:project) }let(:work_package) { create(:work_package, project:) }let(:relations) { Components::WorkPackages::Relations.new(work_package) }- let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }-- let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }let(:visit) { true }@@ -266,14 +263,28 @@ RSpec.shared_examples "work package relations tab", :js, :selenium doendend-RSpec.context "Split screen" do+RSpec.context "within a split screen" dolet(:wp_page) { Pages::SplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }++ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }it_behaves_like "work package relations tab"end-RSpec.context "Full screen" do+RSpec.context "within a primerized split screen" do+ let(:wp_page) { Pages::PrimerizedSplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::PrimerizedTabs.new }+ let(:relations_tab) { "relations" }++ it_behaves_like "work package relations tab"+end++RSpec.context "within a full screen" dolet(:wp_page) { Pages::FullWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }++ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }it_behaves_like "work package relations tab"enddiff --git a/spec/features/work_packages/details/relations/relations_spec.rb b/spec/features/work_packages/details/relations/relations_spec.rbindex 8f2f73e1126..ba513eb55ce 100644--- a/spec/features/work_packages/details/relations/relations_spec.rb+++ b/spec/features/work_packages/details/relations/relations_spec.rb@@ -28,19 +28,15 @@require "spec_helper"-RSpec.describe "Work package relations tab", :js, :selenium do+RSpec.shared_examples "Work package relations tab", :js, :selenium doinclude_context "ng-select-autocomplete helpers"let(:user) { create(:admin) }let(:project) { create(:project) }let(:work_package) { create(:work_package, project:) }- let(:work_packages_page) { Pages::SplitWorkPackage.new(work_package) }let(:full_wp) { Pages::FullWorkPackage.new(work_package) }let(:relations) { Components::WorkPackages::Relations.new(work_package) }- let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }-- let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }let(:visit) { true }@@ -198,7 +194,7 @@ RSpec.describe "Work package relations tab", :js, :selenium dotabs.expect_counter(relations_tab, 1)# Switch to full view- find(".work-packages--details-fullscreen-icon").click+ work_packages_page.switch_to_fullscreen# Expect to have rowrelations.hover_action(relatable, :delete)@@ -278,3 +274,20 @@ RSpec.describe "Work package relations tab", :js, :selenium doendendend++RSpec.context "within a split screen" do+ let(:work_packages_page) { Pages::SplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }++ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }++ it_behaves_like "Work package relations tab"+end++RSpec.context "within a primerized split screen" do+ let(:work_packages_page) { Pages::PrimerizedSplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::PrimerizedTabs.new }+ let(:relations_tab) { "relations" }++ it_behaves_like "Work package relations tab"+enddiff --git a/spec/features/work_packages/tabs/watcher_tab_spec.rb b/spec/features/work_packages/tabs/watcher_tab_spec.rbindex 91a93e617c2..a48105336f2 100644--- a/spec/features/work_packages/tabs/watcher_tab_spec.rb+++ b/spec/features/work_packages/tabs/watcher_tab_spec.rb@@ -53,7 +53,7 @@ RSpec.describe "Watcher tab", :js, :selenium dologin_as(user)wp_page.visit_tab! :watchersexpect_angular_frontend_initialized- expect(page).to have_css(".op-tab-row--link_selected", text: "WATCHERS")+ wp_page.expect_tab "Watchers"endit "modifying the watcher list modifies the watch button" do@@ -113,13 +113,21 @@ RSpec.describe "Watcher tab", :js, :selenium doendend- context "split screen" do+ context "within a split screen" dolet(:wp_page) { Pages::SplitWorkPackage.new(work_package) }it_behaves_like "watchers tab"end- context "full screen" do+ context "within a primerized split screen" do+ let(:wp_page) { Pages::PrimerizedSplitWorkPackage.new(work_package) }+ let(:tabs) { Components::WorkPackages::PrimerizedTabs.new }+ let(:watchers_tab) { "watchers" }++ it_behaves_like "watchers tab"+ end++ context "within a full screen" dolet(:wp_page) { Pages::FullWorkPackage.new(work_package) }it_behaves_like "watchers tab"diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rbindex c2d09a30951..8a934eb147b 100644--- a/spec/support/components/work_packages/activities.rb+++ b/spec/support/components/work_packages/activities.rb@@ -46,14 +46,6 @@ module Componentsendend- def expect_notification_count(count)- expect(page).to have_css('[data-test-selector="tab-counter-Activity"] span', text: count)- end-- def expect_no_notification_badge- expect(page).to have_no_css('[data-test-selector="tab-counter-Activity"] span')- end-def hover_action(journal_id, action)retry_block do# Focus type edit to expose buttonsdiff --git a/spec/support/components/work_packages/primerized_tabs.rb b/spec/support/components/work_packages/primerized_tabs.rbnew file mode 100644index 00000000000..f33eb94608a--- /dev/null+++ b/spec/support/components/work_packages/primerized_tabs.rb@@ -0,0 +1,19 @@+module Components+ module WorkPackages+ class PrimerizedTabs+ include Capybara::DSL+ include Capybara::RSpecMatchers+ include RSpec::Matchers++ # Check value of counter for the given tab+ def expect_counter(tab, count)+ expect(page).to have_test_selector("wp-details-tab-component--#{tab}-counter", text: count)+ end++ # Counter should not be displayed, if there are no relations or watchers+ def expect_no_counter(tab)+ expect(page).not_to have_test_selector("wp-details-tab-component--#{tab}-counter")+ end+ end+ end+enddiff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rbindex d4ffa958c4d..c79bdef2d03 100644--- a/spec/support/pages/work_packages/abstract_work_package.rb+++ b/spec/support/pages/work_packages/abstract_work_package.rb@@ -53,6 +53,10 @@ module Pagesexpect(page).to have_css(".op-tab-row--link_selected", text: tab.to_s.upcase)end+ def expect_no_tab(tab)+ expect(page).to have_no_css(".op-tab-row--link", text: tab.to_s.upcase)+ end+def within_active_tab(&)within(".work-packages-full-view--split-right .work-packages--panel-inner", &)enddiff --git a/spec/support/pages/work_packages/primerized_split_work_package.rb b/spec/support/pages/work_packages/primerized_split_work_package.rbindex 363ff21a6d3..f1ab2ac3a49 100644--- a/spec/support/pages/work_packages/primerized_split_work_package.rb+++ b/spec/support/pages/work_packages/primerized_split_work_package.rb@@ -59,12 +59,8 @@ module Pageswithin(".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")+ def path(tab = "overview")+ details_notifications_path(work_package.id, tab:)endprivate