test: decisive hover diagnostics — browser snapshot vs node state + fleet HTML; CI fresh DB per run
CI / build + unit + e2e (pull_request) Failing after 6m3s

This commit is contained in:
2026-09-19 10:35:36 +00:00
parent 3209dea425
commit eff934a1cc
4 changed files with 33 additions and 7 deletions
+12 -1
View File
@@ -21,7 +21,18 @@ export interface GameStateResult {
export async function fetchState(): Promise<StateSnapshot> {
const res = await fetch('/api/state', { cache: 'no-store' });
if (!res.ok) throw new Error(`GET /api/state → HTTP ${res.status}`);
return (await res.json()) as StateSnapshot;
const snapshot = (await res.json()) as StateSnapshot;
// Dev/e2e hook (v0.15.0): the last successfully polled snapshot, so tests can compare what
// the BROWSER received against a fresh node-side fetch. Client-only, harmless in prod.
if (typeof window !== 'undefined') {
(window as unknown as Record<string, unknown>).__flightLastSnapshot = {
planeIds: snapshot.planes.map((p) => p.id),
cash: snapshot.account.cash,
timeScale: snapshot.simState.timeScale,
at: Date.now(),
};
}
return snapshot;
}
// The shell's single polling source (v0.9.0): one GET /api/state loop for the whole page,