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 0500761c57..05ac219cf6 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 898cf6263a..01225162f4 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