e2e: research unlocks the gated WEAPONS build via UI + tech state survives restart
This commit is contained in:
@@ -16,6 +16,7 @@ interface SystemState { systemId: number; systemName: string; planets: PlanetDto
|
||||
interface CrewDto { id: number; name: string; role: string; traitGood: string; traitBad: string; origin: string }
|
||||
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[] }
|
||||
|
||||
test('app survives a container restart (stack + volume persistence)', async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
@@ -58,6 +59,10 @@ test('app survives a container restart (stack + volume persistence)', async ({ p
|
||||
const shipBefore = (await (await page.request.get('/api/ship')).json()) as ShipState;
|
||||
expect(shipBefore.systems.length).toBeGreaterThan(0); // starting ship is always seeded
|
||||
|
||||
// Tech baseline: the researched flags must survive too.
|
||||
const techBefore = (await (await page.request.get('/api/tech')).json()) as TechDto[];
|
||||
expect(techBefore.length).toBeGreaterThan(0); // the tech tree is always seeded
|
||||
|
||||
// Restart the app container mid-run — the named DB volume must survive it.
|
||||
execSync(`docker compose ${composeArgs} restart space-wanderer`, { cwd: repoRoot, stdio: 'pipe' });
|
||||
|
||||
@@ -96,6 +101,10 @@ test('app survives a container restart (stack + volume persistence)', async ({ p
|
||||
const shipAfter = (await (await page.request.get('/api/ship')).json()) as ShipState;
|
||||
expect(shipAfter).toEqual(shipBefore);
|
||||
|
||||
// Tech tree survived too: same researched flags (no re-seed on restart).
|
||||
const techAfter = (await (await page.request.get('/api/tech')).json()) as TechDto[];
|
||||
expect(techAfter).toEqual(techBefore);
|
||||
|
||||
// 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