fix(e2e): task-10 review fixes — Nth tick, retry-safe preambles, queue-DTO shape (#44)
CI / build + unit + e2e (pull_request) Failing after 34m10s
CI / build + unit + e2e (pull_request) Failing after 34m10s
This commit is contained in:
+9
-4
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { jumpToFreshSystem, resolveAction } from './helpers';
|
||||
import { drainQueue, jumpToFreshSystem, resolveAction } from './helpers';
|
||||
|
||||
// Repo root — docker-compose.yml lives here; `docker compose restart` runs on
|
||||
// this host (the test runner), browsers stay remote. CI points E2E_COMPOSE_ARGS at the
|
||||
@@ -13,9 +13,10 @@ const composeArgs = process.env.E2E_COMPOSE_ARGS ?? '';
|
||||
interface PlanetDto { id: number; name: string; type: string; hazard: boolean; explored: boolean; parent: number | null }
|
||||
interface SystemState { systemId: number; systemName: string; planets: PlanetDto[]; inventory: { kind: string; name: string; qty: number }[]; turn: number }
|
||||
interface CrewDto { id: number; name: string; role: string; traitGood: string; traitBad: string; origin: string }
|
||||
// Mirrors the task row of lib/game/tasks.ts minus saveId — GET /api/crew is the {crew, tasks}
|
||||
// object (Task 6 / JC-7): ACTIVE block first, then PENDING, DONE filtered.
|
||||
interface TaskDto { id: number; type: string; payload: string; leadCrewId: number; helpers: number[]; duration: number; remaining: number; status: string; queuedAtTurn: number }
|
||||
// Mirrors the QueueDto of lib/game/save.ts — GET /api/crew is the {crew, tasks} object (Task 6 /
|
||||
// JC-7): the queue's display shape (resolved names, no raw payload), ACTIVE block first, then
|
||||
// PENDING, DONE filtered.
|
||||
interface TaskDto { id: number; type: string; targetLabel: string; leadName: string; helperNames: string[]; remaining: number; status: string; leadCrewId: number; helperCrewIds: number[] }
|
||||
interface CrewState { crew: CrewDto[]; tasks: TaskDto[] }
|
||||
interface ShipSystemDto { id: number; type: string; level: number; capacity: number; built: boolean }
|
||||
interface ShipState { systems: ShipSystemDto[]; inventory: { kind: string; name: string; qty: number }[]; turn: number }
|
||||
@@ -26,6 +27,10 @@ interface EventDto { id: number; turn: number; type: string; message: string; cr
|
||||
test('app survives a container restart (stack + volume persistence)', async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
|
||||
// Retry-safety: a failed earlier attempt may have left a row queued — an in-transit JUMP would
|
||||
// 409 every new queue (lib/game/tasks.ts's in-transit rule), so drain before the baselines.
|
||||
await drainQueue(page);
|
||||
|
||||
// Baseline: the app serves and reports its version.
|
||||
const resBefore = await page.request.get('/api/version');
|
||||
expect(resBefore.status()).toBe(200);
|
||||
|
||||
Reference in New Issue
Block a user