From f181ab71fe621bc48e2a5d5eba7970e3f31e5ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 10 May 2026 19:49:12 +0200 Subject: [PATCH] fix(e2e): pin onboardingCompletedAt so AuthShell does not redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "incomplete-onboarding" flicker spec mocked `/api/auth/me` with a null `onboardingCompletedAt`, which makes `` redirect every authenticated route to `/onboarding` before the dashboard hydrates — so the checklist card the test asserts on never paints. Pin the timestamp to a non-null value while keeping every other checklist signal empty (profile fields null, `summaries: {}` so `measurementCount = 0`). The `shouldShowChecklist` gate still returns true via its `measurementCount < 5` branch, so the assertion still exercises the collapsed-by-default rendering path. Co-Authored-By: Claude Opus 4.7 (1M context) --- e2e/onboarding-flicker.spec.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/e2e/onboarding-flicker.spec.ts b/e2e/onboarding-flicker.spec.ts index 936cb7d28..55be4014d 100644 --- a/e2e/onboarding-flicker.spec.ts +++ b/e2e/onboarding-flicker.spec.ts @@ -133,10 +133,16 @@ test.describe("dashboard onboarding card flicker guard", () => { test("incomplete-onboarding user sees the card collapsed by default", async ({ page, }) => { - // Onboarding is incomplete AND profile fields are missing → the - // `shouldShowChecklist` gate is true. With the fix, the card mounts - // collapsed: header + progress meter visible, full row list hidden - // until the user clicks the chevron. + // Profile fields are missing AND `measurementCount < 5` so the + // `shouldShowChecklist` gate is true (its `stillInSetup` branch is + // satisfied by the measurement-count condition). With the fix, the + // card mounts collapsed: header + progress meter visible, full row + // list hidden until the user clicks the chevron. + // + // We intentionally pin `onboardingCompletedAt` to a non-null value: + // `` redirects users with a null timestamp straight to + // `/onboarding`, so the dashboard never paints. The checklist still + // renders here because `summaries: {}` keeps `measurementCount = 0`. await page.route("**/api/auth/me", (route) => route.fulfill({ status: 200, @@ -151,7 +157,7 @@ test.describe("dashboard onboarding card flicker guard", () => { dateOfBirth: null, gender: null, timezone: "Europe/Berlin", - onboardingCompletedAt: null, + onboardingCompletedAt: "2025-01-01T00:00:00.000Z", // Suppress the spotlight tour overlay during this spec so // the onboarding-card visibility probe is not occluded by // the tour's z-200 dialog. The tour itself is exercised by