Fix flickering test (date-related)

The test wants to change a date using the datepicker from year 2025 to
year 2024. Using `fill_in` or `set` on the year input of the date picker
does not trigger any event which would update the internal state of the
flatpickr (it can be seen because the calendar dates is not redrawn). So
when the month is changed, the year switches back to 2025 (the internal
state), the wrong date is picked and the test fails.

This is fixed by sending a right arrow key to the year input to trigger
a keyboard event which then updates the internal state of the flatpickr.

This is a flickering test as the issue only occurs when the year needs
to be changed.
This commit is contained in:
Christophe Bliard
2024-12-24 09:39:14 +01:00
parent 0ecd4c8d27
commit d94ea36eca
@@ -57,7 +57,8 @@ module Components
retry_block do
flatpickr_container
.first(".numInput.cur-year")
.set value
.fill_in(with: value)
.send_keys :right # to trigger a keyboard event to get the internal state of flatpickr updated
end
end