From 6f3e6b9bd9df43da534f37baad8a1484e209f019 Mon Sep 17 00:00:00 2001 From: Barkley Trimsworth Date: Tue, 31 Mar 2026 01:16:17 +0000 Subject: [PATCH] fix(e2e): add portal session mocks to impersonation tests QA identified that impersonation.spec.ts mocks impersonation session endpoints but not portal session endpoints. When CustomerPortal.tsx validates the session it calls GET /api/portal/me which fails without a mock, causing the redirect to fire and tests to fail. Co-Authored-By: Paperclip --- apps/e2e/tests/impersonation.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/e2e/tests/impersonation.spec.ts b/apps/e2e/tests/impersonation.spec.ts index 3588412..bc010c0 100644 --- a/apps/e2e/tests/impersonation.spec.ts +++ b/apps/e2e/tests/impersonation.spec.ts @@ -31,6 +31,13 @@ test.describe("ImpersonationBanner", () => { await page.route("**/api/impersonation/sessions/session-1/audit-log", (route) => route.fulfill({ json: { logs: [] } }) ); + // Portal session endpoints needed when CustomerPortal fetches client profile after session is established + await page.route("POST **/api/portal/dev-session", (route) => + route.fulfill({ json: { id: "session-1", client: { id: "client-1", name: "Carol Client" } } }) + ); + await page.route("GET **/api/portal/me", (route) => + route.fulfill({ json: { id: "client-1", name: "Carol Client", email: "carol@test.com" } }) + ); }); test("banner displays when session is active", async ({ page }) => {