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
Define the expected visiblity for the "Share" button in a spec
Aaron Contreras2f18abc0052a
diff --git a/spec/features/work_packages/share_spec.rb b/spec/features/work_packages/share_spec.rbindex 78a922c12cb..0f55996571b 100644--- a/spec/features/work_packages/share_spec.rb+++ b/spec/features/work_packages/share_spec.rb@@ -269,34 +269,51 @@ RSpec.describe 'Work package sharing',endcontext 'when lacking share permission' do- let(:sharer_role) do- create(:project_role,- permissions: %i(view_work_packages- view_shared_work_packages))- end+ context 'with :view_shared_work_packages permission' do+ let(:sharer_role) do+ create(:project_role,+ permissions: %i(view_work_packages+ view_shared_work_packages))+ end- it 'allows seeing shares but not editing' do- work_package_page.visit!+ 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- # is explicitly shared with.- # Project members are not listed unless the work package is also shared with them explicitly.- click_button 'Share'+ # Clicking on the share button opens a modal which lists all of the users a work package+ # is explicitly shared with.+ # Project members are not listed unless the work package is also shared with them explicitly.+ click_button 'Share'- share_modal.expect_open- share_modal.expect_shared_with(view_user, editable: false)- share_modal.expect_shared_with(comment_user, editable: false)- share_modal.expect_shared_with(dinesh, editable: false)- share_modal.expect_shared_with(edit_user, editable: false)- share_modal.expect_shared_with(shared_project_user, editable: false)- share_modal.expect_shared_with(current_user, editable: false)+ share_modal.expect_open+ share_modal.expect_shared_with(view_user, editable: false)+ share_modal.expect_shared_with(comment_user, editable: false)+ share_modal.expect_shared_with(dinesh, editable: false)+ share_modal.expect_shared_with(edit_user, editable: false)+ share_modal.expect_shared_with(shared_project_user, editable: false)+ share_modal.expect_shared_with(current_user, editable: false)- share_modal.expect_not_shared_with(non_shared_project_user)- share_modal.expect_not_shared_with(not_shared_yet_with_user)+ share_modal.expect_not_shared_with(non_shared_project_user)+ share_modal.expect_not_shared_with(not_shared_yet_with_user)- share_modal.expect_shared_count_of(6)+ share_modal.expect_shared_count_of(6)++ share_modal.expect_no_invite_option+ end+ end- share_modal.expect_no_invite_option+ context 'without the :view_shared_work_packages permission' do+ let(:sharer_role) do+ create(:project_role,+ permissions: %i(view_work_packages))+ end++ it 'does not render the "Share" button to open the modal' do+ work_package_page.visit!++ within work_package_page.toolbar do+ expect(page).not_to have_button('Share', wait: 0)+ end+ endendenddiff --git a/spec/support/pages/work_packages/full_work_package.rb b/spec/support/pages/work_packages/full_work_package.rbindex 02d89f815d4..e07e391c90d 100644--- a/spec/support/pages/work_packages/full_work_package.rb+++ b/spec/support/pages/work_packages/full_work_package.rb@@ -34,6 +34,10 @@ module Pagesfind('.work-packages--details--subject', match: :first)end+ def toolbar+ find_by_id('toolbar-items')+ end+privatedef container