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

Retry month setting in case datepicker is redrawn

Oliver Günther794b1d90077e
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index 8d9fef4102b..aaa14ace7b4 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -6,17 +6,19 @@ module Components
# Select month from datepicker
def select_month(month)
month = Date::MONTHNAMES.index(month) if month.is_a?(String)
- current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
-
- if current_month < month
- while current_month < month
- flatpickr_container.find('.flatpickr-next-month').click
- current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
- end
- elsif current_month > month
- while current_month > month
- flatpickr_container.find('.flatpickr-prev-month').click
- current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
+ retry_block do
+ current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
+
+ if current_month < month
+ while current_month < month
+ flatpickr_container.find('.flatpickr-next-month').click
+ current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
+ end
+ elsif current_month > month
+ while current_month > month
+ flatpickr_container.find('.flatpickr-prev-month').click
+ current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
+ end
end
end
end