From ef9dc1ddc60d5f5f2a506bd61e6f231f1d25ef60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Tue, 6 Oct 2026 00:30:13 +0200 Subject: [PATCH] test: pin the Coach layout clock to midday and read copied text without a tag-stripping replace The panel groups conversations by the browser's local day, so the e2e fixture's "an hour ago" landed in yesterday when CI ran just after midnight. The turn-steps test reads its markup by splitting rather than with a replace CodeQL reads as an incomplete sanitiser. --- e2e/coach-layout.spec.ts | 6 +++++- .../insights/coach-panel/__tests__/turn-steps.test.tsx | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/e2e/coach-layout.spec.ts b/e2e/coach-layout.spec.ts index d13cf9965..67b455d96 100644 --- a/e2e/coach-layout.spec.ts +++ b/e2e/coach-layout.spec.ts @@ -41,7 +41,10 @@ import { aiBlockAvailable, serveAiBlock } from "./setup/ai-capabilities"; * Screenshots are attached to the report (no pixel baselines). */ -const NOW = Date.now(); +// A fixed midday, pinned in the browser too (see beforeEach): the panel groups +// conversations by the browser's local day, so a run just after midnight in +// the runner's or the profile's zone would move "an hour ago" into yesterday. +const NOW = Date.parse("2026-06-04T12:00:00Z"); const HOUR = 60 * 60 * 1000; interface Conversation { @@ -406,6 +409,7 @@ test.describe("Coach page frame", () => { testInfo.project.name !== "chromium-desktop", "each case sets its own viewport; the desktop project runs them all", ); + await page.clock.setFixedTime(new Date(NOW)); await serveAiBlock(page, aiBlockAvailable()); await page.emulateMedia({ reducedMotion: "reduce" }); }); diff --git a/src/components/insights/coach-panel/__tests__/turn-steps.test.tsx b/src/components/insights/coach-panel/__tests__/turn-steps.test.tsx index d29209a83..0bda1cd08 100644 --- a/src/components/insights/coach-panel/__tests__/turn-steps.test.tsx +++ b/src/components/insights/coach-panel/__tests__/turn-steps.test.tsx @@ -363,12 +363,12 @@ describe("a step row copied out of the list", () => { "de", ); // What a selection copies: every text node except the unselectable ones. + // Reads this test's own static markup; not a sanitiser for input. const copied = html - .replace( - /]*class="[^"]*\bselect-none\b[^"]*"[^>]*>[^<]*<\/span>/g, - "", - ) - .replace(/<[^>]+>/g, "") + .split(/]*class="[^"]*\bselect-none\b[^"]*"[^>]*>[^<]*<\/span>/) + .join("") + .split(/<[^>]*>/) + .join("") .replace(/\s+/g, " ") .trim(); expect(copied).toBe("Gewicht ยท letzte 90 Tage");