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

Ensure we're navigating to the date we're testing

Oliver Günthera452c05f6103
diff --git a/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
index 0500761c578..05ac219cf6b 100644
--- a/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
@@ -68,10 +68,10 @@ describe 'Datepicker modal individual non working days (WP #44453)',
# Wait for the datepicker to be initialized
datepicker.expect_visible
+ datepicker.show_date non_working_day_this_week.date
datepicker.expect_non_working non_working_day_this_week.date
- datepicker.select_year non_working_day_next_year.date.year
- datepicker.select_month non_working_day_next_year.date.month
+ datepicker.show_date non_working_day_next_year.date
datepicker.expect_non_working non_working_day_next_year.date
end
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index 898cf6263af..01225162f4f 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -65,13 +65,22 @@ module Components
end
end
- ##
- # Set a ISO8601 date through the datepicker
- def set_date(date)
+ # Change the datepicker visible area.
+ #
+ # @param date the date to navigate to. Can be a Date or a String with
+ # ISO8601 formatted date.
+ def show_date(date)
date = Date.parse(date) unless date.is_a?(Date)
select_year date.year
select_month date.strftime('%B')
+ end
+
+ # Set a ISO8601 date through the datepicker
+ def set_date(date)
+ date = Date.parse(date) unless date.is_a?(Date)
+
+ show_date(date)
select_day date.day
end