[Bug 42862] New: bookingsModalDatePicker_spec.ts is failing
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Bug ID: 42862 Summary: bookingsModalDatePicker_spec.ts is failing 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: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- The file bookingsModalDatePicker_spec.ts has a test that checks a booking calendar using hardcoded June 2026 dates, faking "today" as 2026-06-01 so those dates look like the future. That fake date is lost when the test reloads the page midway through, so the real date takes over causing it to fail. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|chris@bigballofwax.co.nz |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com, | |lucas@bywatersolutions.com, | |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Kyle M Hall (khall) <kyle@bywatersolutions.com> 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=42862 --- Comment #1 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 200604 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200604&action=edit Bug 42862: Use current-relative dates in bookingsModalDatePicker_spec.ts The booking date picker tests fake "today" with cy.clock and create bookings on hardcoded June 2026 dates. The modal fetches existing bookings from from the api and that query uses the real current time, not the fake one in the browser. Once the real date passes the hardcoded dates, the server stops returning those bookings ( they are now in the past ), so the modal sees no conflicts and assertions such as "the date should have the leadDisable class" fail. This patch anchors each test's "today" to the start of next month based on the current date so the bookings always stay in the future and are returned no matter when the test runs. The 'any item' test also sets cy.clock before its second page reload because the freeze does not survive the reload. Test Plan: 1) On main run: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts 2) Note the test fails 3) Apply this patch 4) Run the command again 5) Note all tests pass! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 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=42862 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200604|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=42862 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 200675 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200675&action=edit Bug 42862: Use current-relative dates in bookingsModalDatePicker_spec.ts The booking date picker tests fake "today" with cy.clock and create bookings on hardcoded June 2026 dates. The modal fetches existing bookings from from the api and that query uses the real current time, not the fake one in the browser. Once the real date passes the hardcoded dates, the server stops returning those bookings ( they are now in the past ), so the modal sees no conflicts and assertions such as "the date should have the leadDisable class" fail. This patch anchors each test's "today" to the start of next month based on the current date so the bookings always stay in the future and are returned no matter when the test runs. The 'any item' test also sets cy.clock before its second page reload because the freeze does not survive the reload. Test Plan: 1) On main run: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts 2) Note the test fails 3) Apply this patch 4) Run the command again 5) Note all tests pass! 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=42862 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42772 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42772 [Bug 42772] Upgrade Cypress to 15.16.0 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200675|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=42862 --- Comment #3 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 201014 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201014&action=edit Bug 42862: Use current-relative dates in bookingsModalDatePicker_spec.ts The booking date picker tests fake "today" with cy.clock and create bookings on hardcoded June 2026 dates. The modal fetches existing bookings from from the api and that query uses the real current time, not the fake one in the browser. Once the real date passes the hardcoded dates, the server stops returning those bookings ( they are now in the past ), so the modal sees no conflicts and assertions such as "the date should have the leadDisable class" fail. This patch anchors each test's "today" to the start of next month based on the current date so the bookings always stay in the future and are returned no matter when the test runs. The 'any item' test also sets cy.clock before its second page reload because the freeze does not survive the reload. Test Plan: 1) On main run: yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts 2) Note the test fails 3) Apply this patch 4) Run the command again 5) Note all tests pass! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |lucas@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 --- Comment #4 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- I need this for 26.05.x, passing QA. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- It was a very deliberate choice to use fixed dates for testing here.. I'd rather we mocked the database data to match the expectations if we can.. using relative dates.. especially when testing timezone handling prices near impossible to get reliably correct. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 --- Comment #6 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42862 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.11.00 |26.11.00,26.05.01 released in| | --- Comment #7 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Pushed to 26.05.x for upcoming 26.05.01 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org