diff --git a/e2e/two-planes.spec.ts b/e2e/two-planes.spec.ts index 6e8d557..490e3ec 100644 --- a/e2e/two-planes.spec.ts +++ b/e2e/two-planes.spec.ts @@ -226,7 +226,13 @@ async function healPlaneHome(page: Page, planeId: string): Promise { if (p.locationIcao !== HUB) { // ISS-057: the landing above slowed the sim to 1× — setScale restores 1000× for the return leg. await setScale(page, SCALE); - expect((await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } })).status()).toBe(200); + let flyHome = await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } }); + if (flyHome.status() === 409) { + // A long outbound leg can leave the tank too empty for the return — top up and retry. + expect((await page.request.post(`/api/planes/${planeId}/refuel`)).status()).toBe(200); + flyHome = await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } }); + } + expect(flyHome.status()).toBe(200); await expect .poll(async () => ((await getState(page)).planes.find((x) => x.id === planeId)?.locationIcao ?? ''), { timeout: 240_000, @@ -374,6 +380,9 @@ test('two planes fly in parallel; the last landing slows to 1× and the next dis expect(landed.packages.find((p) => p.id === pkgA.id)?.status).toBe('delivered'); expect(landed.packages.find((p) => p.id === pkgB.id)?.status).toBe('delivered'); + // The outbound to the range edge left the tank nearly empty — top up for the return leg. + expect((await page.request.post(`/api/planes/${secondId}/refuel`)).status()).toBe(200); + // Resume semantics: with the starter still grounded, dispatching the second plane does NOT resume… const flyB2 = await page.request.post(`/api/planes/${secondId}/fly`, { data: { destIcao: HUB } }); expect(flyB2.status()).toBe(200);