From 36948477926d05cd0c658c1fa27e26a82897f737 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Sun, 10 May 2026 13:39:08 +0200 Subject: [PATCH] ui/phase-19: seed an authenticated session in the synthetic-report e2e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The root +layout.svelte redirects anonymous traffic to /login, so a fresh CI browser context never gets to render the lobby's DEV-gated synthetic-report section — the previous spec relied on leftover session state in the local browser and silently broke on clean runners (local-ci run 23). Bootstrap the session through /__debug/store before navigating to /lobby: load a device keypair, set a deterministic device session id. The synthetic flow itself still bypasses the gateway entirely; the seed only ensures `session.status === "authenticated"` so the layout guard lets the lobby through. Co-Authored-By: Claude Opus 4.7 --- .../tests/e2e/inspector-ship-group.spec.ts | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ui/frontend/tests/e2e/inspector-ship-group.spec.ts b/ui/frontend/tests/e2e/inspector-ship-group.spec.ts index b1b537d..f655fcf 100644 --- a/ui/frontend/tests/e2e/inspector-ship-group.spec.ts +++ b/ui/frontend/tests/e2e/inspector-ship-group.spec.ts @@ -8,7 +8,35 @@ // glue: lobby loader → in-memory registry → layout bypass → renderer // boot. -import { expect, test } from "@playwright/test"; +import { expect, test, type Page } from "@playwright/test"; + +interface DebugSurface { + ready: true; + loadSession(): Promise; + setDeviceSessionId(id: string): Promise; +} + +declare global { + interface Window { + __galaxyDebug?: DebugSurface; + } +} + +// Seed an authenticated session through `/__debug/store` so the +// root layout's redirect-to-login guard passes. The synthetic flow +// itself does not talk to the gateway, but the session check still +// runs at every navigation. +async function seedSession(page: Page): Promise { + await page.goto("/__debug/store"); + await expect(page.getByTestId("debug-store-ready")).toBeVisible(); + await page.waitForFunction(() => window.__galaxyDebug?.ready === true); + await page.evaluate(async () => { + await window.__galaxyDebug!.loadSession(); + await window.__galaxyDebug!.setDeviceSessionId( + "phase-19-synthetic-session", + ); + }); +} const SYNTHETIC_REPORT_FIXTURE = { turn: 39, @@ -111,6 +139,7 @@ const SYNTHETIC_REPORT_FIXTURE = { test("synthetic-report loader navigates from lobby to map and renders", async ({ page, }) => { + await seedSession(page); await page.goto("/lobby"); await expect(page.getByTestId("lobby-synthetic-section")).toBeVisible();