test(ui): migrate suite to the app-shell (state-driven navigation)
- Unit: repoint moved screen imports (lib/screens, lib/game), mock $lib/app-nav (appScreen/activeView) instead of $app/navigation, drop the removed gameId props, assert screen/view selection. - e2e: add a dev-only window.__galaxyNav affordance; specs enter a game via enterGame(...) instead of a /games/:id URL; URL assertions become content assertions (the URL stays /game/); reload uses waitUntil:"commit" (shallow routing) and mocks /rpc on game entry. - Remove the obsolete report scroll-restore test (it relied on a SvelteKit route Snapshot that no longer exists); update the missing-membership test to the new lobby-redirect+toast behaviour. Fix a stale report.svelte docstring. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,25 @@ import type {
|
||||
MapPrimitiveSnapshot,
|
||||
} from "../../src/lib/debug-surface.svelte";
|
||||
import type { WrapMode } from "../../src/map/world";
|
||||
import type {
|
||||
AppScreen,
|
||||
GameView,
|
||||
GameViewState,
|
||||
} from "../../src/lib/app-nav.svelte";
|
||||
|
||||
// View sub-parameters accepted by the dev-only nav affordance — the
|
||||
// `GameViewState` fields minus the discriminating `view`.
|
||||
type NavViewParams = Omit<GameViewState, "view">;
|
||||
|
||||
// Mirrors the dev-only surface mounted by `routes/+page.svelte`. The
|
||||
// single-URL app-shell has no per-screen / per-view routes, so the
|
||||
// Playwright suite drives the in-memory screen and view through this
|
||||
// global instead of `page.goto("/games/:id/:view")`.
|
||||
interface NavSurface {
|
||||
enterGame(gameId: string, view?: GameView, params?: NavViewParams): void;
|
||||
select(view: GameView, params?: NavViewParams): void;
|
||||
go(screen: AppScreen, opts?: { gameId?: string }): void;
|
||||
}
|
||||
|
||||
// Mirrors the surface mounted by `routes/__debug/store/+page.svelte`.
|
||||
// Other Playwright specs (`game-shell.spec.ts`, `order-composer.spec.ts`,
|
||||
@@ -56,6 +75,7 @@ interface DebugSurface {
|
||||
declare global {
|
||||
interface Window {
|
||||
__galaxyDebug?: DebugSurface;
|
||||
__galaxyNav?: NavSurface;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user