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

Fix feature specs after bug fixes

Aaron Contreras6a5eae1ff532
diff --git a/app/components/shares/invite_user_form_component.html.erb b/app/components/shares/invite_user_form_component.html.erb
index 90f0458b448..dea952c59aa 100644
--- a/app/components/shares/invite_user_form_component.html.erb
+++ b/app/components/shares/invite_user_form_component.html.erb
@@ -1,5 +1,5 @@
<%=
- component_wrapper do
+ component_wrapper(data_test_selector: 'invite-user-form') do
primer_form_with(
model: new_share,
url: url_for([entity, Member]),
diff --git a/app/components/shares/share_row_component.html.erb b/app/components/shares/share_row_component.html.erb
index 8663e29e3b8..b22643a0bb7 100644
--- a/app/components/shares/share_row_component.html.erb
+++ b/app/components/shares/share_row_component.html.erb
@@ -3,7 +3,7 @@
grid_layout(grid_css_classes, tag: :div, align_items: :center, classes: 'ellipsis') do |user_row_grid|
user_row_grid.with_area(:selection, tag: :div) do
if share_editable?
- render(Primer::Alpha::CheckBox.new(name: "share_ids", value: share.id, label: principal.name,
+ render(Primer::Alpha::CheckBox.new(name: "share_ids", value: (share.id || VIRTUAL_SHARE_ID), label: principal.name,
visually_hide_label: true, scheme: :array,
data: {
'shares--bulk-selection-target': 'shareCheckbox',
diff --git a/app/components/shares/share_row_component.rb b/app/components/shares/share_row_component.rb
index 1a4376af63d..69d44662d4b 100644
--- a/app/components/shares/share_row_component.rb
+++ b/app/components/shares/share_row_component.rb
@@ -30,6 +30,8 @@
module Shares
class ShareRowComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ VIRTUAL_SHARE_ID = "virtual-share-id"
+
include ApplicationHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
diff --git a/spec/features/projects/persisted_lists_sharing_spec.rb b/spec/features/projects/persisted_lists_sharing_spec.rb
index 2aa61d238ba..bbf688c67e6 100644
--- a/spec/features/projects/persisted_lists_sharing_spec.rb
+++ b/spec/features/projects/persisted_lists_sharing_spec.rb
@@ -104,7 +104,7 @@ RSpec.describe "Project list sharing",
projects_index_page.set_sidebar_filter("Member-of list")
projects_index_page.open_share_dialog
- share_dialog.expect_sharing_forbidden_banner
+ share_dialog.expect_unable_to_manage
share_dialog.close
projects_index_page.open_filters
@@ -145,6 +145,7 @@ RSpec.describe "Project list sharing",
projects_index_page.set_sidebar_filter("Member-of list")
projects_index_page.open_share_dialog
+ share_dialog.expect_open
# Allowed to further share the project list
share_dialog.invite_user!(wildcard_user, "View")
share_dialog.close
@@ -225,7 +226,7 @@ RSpec.describe "Project list sharing",
projects_index_page.open_share_dialog
# View only
- share_dialog.expect_sharing_forbidden_banner
+ share_dialog.expect_unable_to_manage(only_invite: true)
share_dialog.close
projects_index_page.open_filters
diff --git a/spec/support/components/sharing/project_queries/share_modal.rb b/spec/support/components/sharing/project_queries/share_modal.rb
index efeb8f46192..6140158a951 100644
--- a/spec/support/components/sharing/project_queries/share_modal.rb
+++ b/spec/support/components/sharing/project_queries/share_modal.rb
@@ -39,12 +39,15 @@ module Components
end
# rubocop:enable Lint/MissingSuper
- def expect_sharing_forbidden_banner
- expect(page).to have_text("You don't have permissions to share Custom query.")
+ def expect_unable_to_manage(only_invite: false)
+ expect(page).to have_no_css("[data-test-selector='invite-user-form']")
+ expect(page).to have_css("[data-tooltip=\"You don't have permissions to share Project lists.\"]") unless only_invite
end
def close
- click_on(class: "Overlay-closeButton")
+ # Tooltips interfere with the driver's ability
+ # to fire a click event. Using node#trigger
+ find(".Overlay-closeButton").trigger("click")
end
def toggle_public