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

Refactor more filter methods.

Dombi Attila85b81361fd1f
diff --git a/spec/support/components/common/filters.rb b/spec/support/components/common/filters.rb
index 6e01b5b4c18..f218f3585fa 100644
--- a/spec/support/components/common/filters.rb
+++ b/spec/support/components/common/filters.rb
@@ -164,7 +164,7 @@ module Components
end
when "between"
if send_keys
- find_field("from_value").send_keysvalues.first
+ find_field("from_value").send_keys values.first
find_field("to_value").send_keys values.second
else
fill_in "from_value", with: values.first
@@ -222,6 +222,10 @@ module Components
filter[:"data-filter-type"] == "date"
end
+ def date_time_filter?(filter)
+ filter[:"data-filter-type"] == "datetime_past"
+ end
+
def boolean_filter?(_filter)
false
end
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index fcd1cc82ad6..beabcacfebf 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -250,26 +250,7 @@ module Pages
elsif date_filter?(selected_filter) || date_time_filter?(selected_filter)
select(human_operator, from: "operator")
wait_for_network_idle
- set_date_filter(human_operator, values, send_keys:)
- end
- end
- end
-
- def set_date_filter(human_operator, values, send_keys: false)
- case human_operator
- when "on", "less than days ago", "more than days ago", "days ago"
- if send_keys
- find_field("value").send_keys values.first
- else
- fill_in "value", with: values.first
- end
- when "between"
- if send_keys
- find_field("from_value").send_keys values.first
- find_field("to_value").send_keys values.second
- else
- fill_in "from_value", with: values.first
- fill_in "to_value", with: values.second
+ set_created_at_filter(human_operator, values, send_keys:)
end
end
end
@@ -540,10 +521,6 @@ module Pages
%w[active member_of favored public templated].include?(filter.to_s)
end
- def date_time_filter?(filter)
- filter[:"data-filter-type"] == "datetime_past"
- end
-
def submenu
Components::Submenu.new
end