[Bug 44338] New: bookingsModalDatePicker_spec: lead and trail periods hover assertion is intermittent
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 Bug ID: 44338 Summary: bookingsModalDatePicker_spec: lead and trail periods hover assertion is intermittent Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Test Suite Assignee: chris@bigballofwax.co.nz Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts, "should handle lead and trail periods", fails intermittently with: AssertionError: Timed out retrying after 5000ms: expected '<span.flatpickr-day.flatpickr-disabled>' to have class 'booking-day--my-lead-buffer' at bookingsModalDatePicker_spec.ts:943:13 It failed on Koha_Main_D13 #2418 and #2419 (commit af3f59090e) but passed on Koha_Main_D12 #4085. There is no booking-related change between the two commits. On a CI-like instance (Debian 13, MariaDB 11.8) it failed once in five runs and passed otherwise, so it is a flake, not a date or timezone regression. It failed in the first run after the instance had been busy; the next runs passed. The failing assertion is the first check after hovering the candidate start date (T+3) in "PHASE 1: Lead period - Hover shows lead markers": T+1 is disabled but has no lead-buffer class. The spec itself notes that hover state set before the item availability has been applied is wiped by the redraw that applies it, and it waits for the availability request, not for the redraw. That is the likely cause but it is not proven. The spec should wait for a visible effect of the availability having been applied before hovering, and re-apply the hover until the markers are there, instead of hovering once and asserting. Test plan: 1. Start KTD with Debian 13, MariaDB 11.8 and Elasticsearch. 2. Run several times, straight after starting the instance and under load: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts 3. All tests pass every time. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212854 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212854&action=edit Bug 44338: Keep the booking calendar hover feedback when data arrives When the pointer is on a date of the booking calendar, the lead/trail period preview and the other hover feedback are applied directly to that date's cell. When the item's availability, the circulation rules or the other data the calendar displays arrive, the calendar is redrawn, which replaces the date cells and silently discards the feedback. It only comes back when the pointer moves to another date. This is easily seen on a slow connection, and it made the Cypress test "should handle lead and trail periods" (Circulation/bookingsModalDatePicker_spec.ts) fail intermittently on a busy machine, with: expected '<span.flatpickr-day.flatpickr-disabled>' to have class 'booking-day--my-lead-buffer' The test hovers a date once, after the requests it waits for have completed, but before the browser has applied their data to the calendar. Remember when the pointer or focus is on a date, and after a redraw caused by new data apply the feedback again to the new cell. It stops when the pointer or focus leaves the calendar. Test plan: 1. Make sure the EnableBooking system preference is enabled and mark at least two items of a record as bookable. In Administration > Circulation and fine rules, set the bookings lead period (e.g. 2 days) and trail period (e.g. 3 days) for the item type of those items. 2. Open the record in the staff interface and click "Place booking". 3. Choose a patron and a pickup library. In the browser developer tools set network throttling to "Slow 4G" (or slower) so the data takes a moment to load. 4. In "Item", choose a specific item, and immediately move the pointer over a date a few days from now and leave it there, without moving it. 5. Before the patch: the lead period (and trail period) preview appears and then disappears when the data arrives, and only comes back when you move to another date. 6. After the patch: the preview stays, or comes back by itself, while the pointer stays on the date. 7. Move the pointer out of the calendar: the preview goes away, and a later data update does not bring it back. 8. Run the spec several times, ideally on a busy machine: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts It used to fail in about 1 run in 10 under load, and now passes every time. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|chris@bigballofwax.co.nz |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |paul.derscheid@lmscloud.de |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|bookingsModalDatePicker_spe |Booking calendar loses |c: lead and trail periods |hover feedback when data |hover assertion is |arrives (flaky lead/trail |intermittent |spec) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212854|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 212866 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212866&action=edit Bug 44338: Keep the booking calendar hover feedback when data arrives When the pointer is on a date of the booking calendar, the lead/trail period preview and the other hover feedback are applied directly to that date's cell. When the item's availability, the circulation rules or the other data the calendar displays arrive, the calendar is redrawn, which replaces the date cells and silently discards the feedback. It only comes back when the pointer moves to another date. This is easily seen on a slow connection, and it made the Cypress test "should handle lead and trail periods" (Circulation/bookingsModalDatePicker_spec.ts) fail intermittently on a busy machine, with: expected '<span.flatpickr-day.flatpickr-disabled>' to have class 'booking-day--my-lead-buffer' The test hovers a date once, after the requests it waits for have completed, but before the browser has applied their data to the calendar. Remember when the pointer or focus is on a date, and after a redraw caused by new data apply the feedback again to the new cell. It stops when the pointer or focus leaves the calendar. Test plan: 1. Make sure the EnableBooking system preference is enabled and mark at least two items of a record as bookable. In Administration > Circulation and fine rules, set the bookings lead period (e.g. 2 days) and trail period (e.g. 3 days) for the item type of those items. 2. Open the record in the staff interface and click "Place booking". 3. Choose a patron and a pickup library. In the browser developer tools set network throttling to "Slow 4G" (or slower) so the data takes a moment to load. 4. In "Item", choose a specific item, and immediately move the pointer over a date a few days from now and leave it there, without moving it. 5. Before the patch: the lead period (and trail period) preview appears and then disappears when the data arrives, and only comes back when you move to another date. 6. After the patch: the preview stays, or comes back by itself, while the pointer stays on the date. 7. Move the pointer out of the calendar: the preview goes away, and a later data update does not bring it back. 8. Run the spec several times, ideally on a busy machine: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts It used to fail in about 1 run in 10 under load, and now passes every time. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44338 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. With my experimentation after the patch, the date picker works as expected. 2. Running thetests multiple times: - for i in {1..15}; do yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts; done - Before the patch: failed 2 times - After the patch: didn't fail 4. Note: Both before and after the patch, if you run the tests with the circulation rules in place (before and after processing days, 2 and 3) you consistently get this test failure - I didn't fail QA as this should be addressed on a separate bug (if required): Booking Modal Date Picker Tests ✓ supports keyboard range selection and restores focus (6521ms) ✓ stays visible on Escape and on a click elsewhere in the same modal (5730ms) 1) should initialize flatpickr with correct future-date constraints Error: Booking would conflict status: 400, at /kohadevbox/koha/t/cypress/plugins/dist/api-client.cjs.js:330:59 code: 'booking_would_conflict' at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { } 2) should disable dates with existing bookings for same item ✓ should keep bookings in the second visible month disabled after navigating back (10406ms) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org