test(e2e): mission accept -> complete + board survives restart
smoke: pick an AVAILABLE contract (non-DELIVER preferred), accept it through the UI (card flips ACTIVE, button disables), complete via API — scan loop for EXPLORE/FIND, BFS jump path for DELIVER — assert DONE and the reward landed in the hold. state: mission board deep-equal across the mid-run container restart.
This commit is contained in:
@@ -16,6 +16,7 @@ interface CrewDto { id: number; name: string; role: string; traitGood: string; t
|
||||
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 }
|
||||
interface TechDto { id: number; slug: string; name: string; costKind: string; costQty: number; prereqs: string[]; effect: string; state: string; missingPrereqs: string[] }
|
||||
interface MissionDto { id: number; type: string; description: string; targetSystemId: number | null; conditionKind: string | null; progressTarget: number; progress: number; rewardKind: string; rewardQty: number; state: string }
|
||||
|
||||
test('app survives a container restart (stack + volume persistence)', async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
@@ -53,6 +54,11 @@ test('app survives a container restart (stack + volume persistence)', async ({ p
|
||||
const techBefore = (await (await page.request.get('/api/tech')).json()) as TechDto[];
|
||||
expect(techBefore.length).toBeGreaterThan(0); // the tech tree is always seeded
|
||||
|
||||
// Mission board baseline: contracts, states and progress must survive too. The GET tops the board
|
||||
// up first — a no-op here because every action leaves at least MIN_AVAILABLE AVAILABLE contracts.
|
||||
const missionsBefore = (await (await page.request.get('/api/missions')).json()) as MissionDto[];
|
||||
expect(missionsBefore.length).toBeGreaterThan(0); // the board is always seeded on new game
|
||||
|
||||
// Restart the app container mid-run — the named DB volume must survive it.
|
||||
execSync(`docker compose ${composeArgs} restart space-wanderer`, { cwd: repoRoot, stdio: 'pipe' });
|
||||
|
||||
@@ -95,6 +101,10 @@ test('app survives a container restart (stack + volume persistence)', async ({ p
|
||||
const techAfter = (await (await page.request.get('/api/tech')).json()) as TechDto[];
|
||||
expect(techAfter).toEqual(techBefore);
|
||||
|
||||
// Mission board survived too: same contracts, states and progress (no re-seed or re-top-up on restart).
|
||||
const missionsAfter = (await (await page.request.get('/api/missions')).json()) as MissionDto[];
|
||||
expect(missionsAfter).toEqual(missionsBefore);
|
||||
|
||||
// The page itself serves again with the landing title.
|
||||
await page.goto('/');
|
||||
await expect(page.getByRole('heading', { name: 'SpaceWanderer' })).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user