ui/phase-19: seed an authenticated session in the synthetic-report e2e
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 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,35 @@
|
|||||||
// glue: lobby loader → in-memory registry → layout bypass → renderer
|
// glue: lobby loader → in-memory registry → layout bypass → renderer
|
||||||
// boot.
|
// boot.
|
||||||
|
|
||||||
import { expect, test } from "@playwright/test";
|
import { expect, test, type Page } from "@playwright/test";
|
||||||
|
|
||||||
|
interface DebugSurface {
|
||||||
|
ready: true;
|
||||||
|
loadSession(): Promise<unknown>;
|
||||||
|
setDeviceSessionId(id: string): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
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<void> {
|
||||||
|
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 = {
|
const SYNTHETIC_REPORT_FIXTURE = {
|
||||||
turn: 39,
|
turn: 39,
|
||||||
@@ -111,6 +139,7 @@ const SYNTHETIC_REPORT_FIXTURE = {
|
|||||||
test("synthetic-report loader navigates from lobby to map and renders", async ({
|
test("synthetic-report loader navigates from lobby to map and renders", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
await seedSession(page);
|
||||||
await page.goto("/lobby");
|
await page.goto("/lobby");
|
||||||
await expect(page.getByTestId("lobby-synthetic-section")).toBeVisible();
|
await expect(page.getByTestId("lobby-synthetic-section")).toBeVisible();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user