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

finalize test on non editable modal

ulferts30232a7b17af
diff --git a/spec/features/work_packages/share_spec.rb b/spec/features/work_packages/share_spec.rb
index 3ef2a724b13..106c8eab845 100644
--- a/spec/features/work_packages/share_spec.rb
+++ b/spec/features/work_packages/share_spec.rb
@@ -153,9 +153,7 @@ RSpec.describe 'Work package sharing',
view_shared_work_packages))
end
- # TODO:
- # - Check not having update and delete capabilities
- it 'allows seeing shares' do
+ it 'allows seeing shares but not editing' do
work_package_page.visit!
# Clicking on the share button opens a modal which lists all of the users a work package
@@ -164,10 +162,10 @@ RSpec.describe 'Work package sharing',
click_button 'Share'
share_modal.expect_open
- share_modal.expect_shared_with(view_user)
- share_modal.expect_shared_with(comment_user)
- share_modal.expect_shared_with(edit_user)
- share_modal.expect_shared_with(shared_project_user)
+ share_modal.expect_shared_with(view_user, editable: false)
+ share_modal.expect_shared_with(comment_user, editable: false)
+ share_modal.expect_shared_with(edit_user, editable: false)
+ share_modal.expect_shared_with(shared_project_user, editable: false)
share_modal.expect_not_shared_with(non_shared_project_user)
share_modal.expect_not_shared_with(not_shared_yet_with_user)
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index a2a096b4c92..3aa5afe51d4 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -82,7 +82,7 @@ module Components
modal_element.send_keys(:escape)
end
- def expect_shared_with(user, role_name = nil)
+ def expect_shared_with(user, role_name = nil, editable: true)
within active_list do
expect(page)
.to have_text(user.name)
@@ -94,6 +94,13 @@ module Components
.to have_button(role_name)
end
end
+
+ unless editable
+ within user_row(user) do
+ expect(page)
+ .not_to have_button
+ end
+ end
end
def expect_not_shared_with(user)