From fbd6db89c901bbf460d744523c78de72fe8a4e95 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Wed, 27 Jan 2021 21:20:38 +0100 Subject: [PATCH] avoid selecting the day in the previous month When you select date at the end of the month (27,28,29,30,...) it is likely possible that this date is already displayed by the calender but for the previous month. Avoid this by using css selector :not() --- spec/support/features/datepicker_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/features/datepicker_helper.rb b/spec/support/features/datepicker_helper.rb index b54e46bd2c..d891e4e294 100644 --- a/spec/support/features/datepicker_helper.rb +++ b/spec/support/features/datepicker_helper.rb @@ -10,7 +10,7 @@ module Features def select_date_from_datepicker(date) navigate_datepicker_to_month date - find('.flatpickr-calendar.open .flatpickr-days .flatpickr-day', text: date.strftime("%e").to_s.strip, exact_text: true, match: :first).click + find('.flatpickr-calendar.open .flatpickr-days .flatpickr-day:not(.prevMonthDay)', text: date.strftime("%e").to_s.strip, exact_text: true, match: :first).click end def navigate_datepicker_to_month(date, reference_date = Time.zone.today)