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

Make the Components::Datepicker#container method to search for context in the whole document, instead of the page scope which can be bound in a "within" matcher

Dombi Attila1c9310125e1e
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index f282bba63b6..3ef86957f64 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -29,7 +29,7 @@ module Components
end
def container
- page.find(context_selector)
+ page.document.find(context_selector)
end
def flatpickr_container
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 88109dc9398..ed3e1215759 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -76,7 +76,7 @@ module Pages
set_created_at_filter(human_operator, values)
elsif name =~ /cf_\d+/
select(human_operator, from: 'operator')
- set_custom_field_filter(selected_filter, human_operator, values)
+ set_custom_field_filter(selected_filter, human_operator, name, values)
end
end
end
@@ -102,8 +102,10 @@ module Pages
def set_created_at_filter(human_operator, values)
case human_operator
- when 'on', 'less than days ago', 'more than days ago', 'days ago'
+ when 'on'
set_date 'on-date-value-created_at', values.first
+ when 'less than days ago', 'more than days ago', 'days ago'
+ fill_in 'value', with: values.first
when 'between'
set_date 'between-dates-from-value-created_at', values.first
set_date 'between-dates-to-value-created_at', values.second
@@ -117,7 +119,7 @@ module Pages
datepicker.save!
end
- def set_custom_field_filter(selected_filter, human_operator, values)
+ def set_custom_field_filter(selected_filter, human_operator, name, values)
if selected_filter[:'filter-type'] == 'list_optional'
if values.size == 1
value_select = find('.single-select select[name="value"]')
@@ -125,7 +127,7 @@ module Pages
end
elsif selected_filter[:'filter-type'] == 'date'
if human_operator == 'on'
- fill_in 'value', with: values.first
+ set_date "on-date-value-#{name}", values.first
end
end
end