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

Modify ShareModal `#filter` helper to work with dynamic labels

Aaron Contrerasba4f64228925
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index 0daf81cc514..7d9beebb9d4 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -246,11 +246,14 @@ module Components
end
def filter(filter_name, value)
- within modal_element.find("[data-test-selector='op-share-wp-filter-#{filter_name}']") do
- # Open the ActionMenu
- retry_block do # Sometimes this is just too fast.
- click_button filter_name.capitalize
-
+ within(shares_header) do
+ retry_block do
+ # The button's text changes dynamically based on the currently selected option
+ # Hence the spec's readability is hindered by using something like
+ # `click_button filter_name.capitalize`
+ find("[data-test-selector='op-share-wp-filter-#{filter_name}-button']").click
+
+ # Open the ActionMenu
find('.ActionListContent', text: value).click
end
end