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

Add spec to cover no selected user behavior in share modal

Aaron Contreras4873305e8cf5
diff --git a/spec/features/work_packages/share_spec.rb b/spec/features/work_packages/share_spec.rb
index d9d55800c2c..78a922c12cb 100644
--- a/spec/features/work_packages/share_spec.rb
+++ b/spec/features/work_packages/share_spec.rb
@@ -252,6 +252,20 @@ RSpec.describe 'Work package sharing',
share_modal.expect_shared_count_of(7)
end
end
+
+ it "lets the sharer know a user needs to be selected to share the work package with them" do
+ work_package_page.visit!
+
+ click_button 'Share'
+
+ share_modal.expect_open
+ share_modal.click_share
+ share_modal.expect_select_a_user_hint
+
+ share_modal.invite_user(not_shared_yet_with_user, 'View')
+ share_modal.expect_shared_with(not_shared_yet_with_user, position: 1)
+ share_modal.expect_no_select_a_user_hint
+ end
end
context 'when lacking share permission' do
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index 4f3f635ed72..0daf81cc514 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -264,6 +264,12 @@ module Components
end
end
+ def click_share
+ within_modal do
+ click_button 'Share'
+ end
+ end
+
def expect_shared_with(user, role_name = nil, position: nil, editable: true)
within_modal do
expect(page).to have_list_item(text: user.name, position:)
@@ -371,6 +377,20 @@ module Components
.to have_text(I18n.t('work_package.sharing.warning_user_limit_reached'))
end
end
+
+ def expect_select_a_user_hint
+ within modal_element do
+ expect(page)
+ .to have_text(I18n.t("work_package.sharing.warning_no_selected_user"))
+ end
+ end
+
+ def expect_no_select_a_user_hint
+ within modal_element do
+ expect(page)
+ .not_to have_text(I18n.t("work_package.sharing.warning_no_selected_user"), wait: 0)
+ end
+ end
end
end
end