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

Include test scenarios for restricted comments edit

Kabiru Mwenjace611a29111e
diff --git a/app/components/work_packages/activities_tab/journals/new_component.html.erb b/app/components/work_packages/activities_tab/journals/new_component.html.erb
index 683fa5f716f..6a69a10a929 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/new_component.html.erb
@@ -56,7 +56,7 @@
if adding_restricted_comment_allowed?
concat(
flex_layout do |flex|
- flex.with_row(mb: 3) do
+ flex.with_row(mb: 3, test_selector: "op-work-package-journal-restricted-comment-checkbox") do
render(WorkPackages::ActivitiesTab::Journals::RestrictedNoteForm.new(f))
end
end
diff --git a/spec/features/activities/work_package/restricted_visibility_comments_spec.rb b/spec/features/activities/work_package/restricted_visibility_comments_spec.rb
index dffd23c7e79..9160240433b 100644
--- a/spec/features/activities/work_package/restricted_visibility_comments_spec.rb
+++ b/spec/features/activities/work_package/restricted_visibility_comments_spec.rb
@@ -106,8 +106,15 @@ RSpec.describe "Work package comments with restricted visibility", :js, :with_cu
activity_tab.within_journal_entry(created_comment) do
page.find_test_selector("op-wp-journal-#{created_comment.id}-action-menu").click
+ page.find_test_selector("op-wp-journal-#{created_comment.id}-edit").click
- expect(page).to have_test_selector("op-wp-journal-#{created_comment.id}-edit")
+ page.within_test_selector("op-work-package-journal-form-element") do
+ expect(page).not_to have_test_selector("op-work-package-journal-restricted-comment-checkbox")
+ activity_tab.get_editor_form_field_element.set_value("Edited comment by member")
+ page.find_test_selector("op-submit-work-package-journal-form").click
+ end
+
+ wait_for { page }.to have_test_selector("op-journal-notes-body", text: "Edited comment by member")
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 3eb4c076207..d9d4933408f 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -241,7 +241,12 @@ module Components
page.within_test_selector("op-work-package-journal-form-element") do
get_editor_form_field_element.set_value(text)
- page.check("Restricted visibility") if restricted
+
+ if restricted
+ expect(page).to have_test_selector("op-work-package-journal-restricted-comment-checkbox")
+ page.check("Restricted visibility")
+ end
+
page.find_test_selector("op-submit-work-package-journal-form").click if save
end