From b8cbf2d7771ca13e44d9588e713e2dba46a42c01 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 8 Sep 2026 02:46:44 +0200 Subject: [PATCH] fix(test): fige l'horloge dans le spec vue-mobile-jour de layout.cy.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `PlanningDayView` ouvre sur le jour *courant* de la semaine affichée (`defaultDayIndexForWeek`, dérivé de `Date`). Le test « shows the one-day mobile view » ne figeait pas l'horloge : il ne passait que quand la CI tournait un lundi (UTC), et échouait les autres jours (`Curry de lentilles`, moqué sur « lundi », hors du jour affiché). `cy.clock(new Date(2026-08-17T09:00:00.000Z), [Date])` avant le `cy.visit` — même lundi de référence que `planning-page.cy.ts` ; `[Date]` seulement, les timers/debounces tournent toujours. Co-Authored-By: Claude Sonnet 5 --- apps/web/cypress/e2e/layout.cy.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/cypress/e2e/layout.cy.ts b/apps/web/cypress/e2e/layout.cy.ts index 8bd0547..0672284 100644 --- a/apps/web/cypress/e2e/layout.cy.ts +++ b/apps/web/cypress/e2e/layout.cy.ts @@ -283,6 +283,13 @@ describe("Responsive breakpoint — page content under 640px (issue #39)", () => // *that* switch; the day view's own day-by-day content is // PlanningPage.tsx's own spec (planning-page.cy.ts). it("shows the one-day mobile view instead of the horizontally-scrolling grid, on a phone", () => { + // `PlanningDayView` opens on *today's* weekday within the shown week + // (`defaultDayIndexForWeek`, derived from `Date`). Freeze "today" to a + // Monday so it opens on "lundi" — where the mocked recipe below is — + // instead of drifting with the real date (this test used to pass only + // when CI happened to run on a Monday, UTC). `["Date"]` only, so + // timers/debounces still run. + cy.clock(new Date("2026-08-17T09:00:00.000Z"), ["Date"]); cy.intercept("GET", /\/planning\?/, { statusCode: 200, body: {