diff --git a/e2e/two-planes.spec.ts b/e2e/two-planes.spec.ts index 490e3ec..19e90a4 100644 --- a/e2e/two-planes.spec.ts +++ b/e2e/two-planes.spec.ts @@ -210,13 +210,18 @@ async function healPlaneHome(page: Page, planeId: string): Promise { await clearQueueViaApi(page, planeId); let p = (await getState(page)).planes.find((x) => x.id === planeId); if (!p) return; // already sold — nothing to heal - if (p.status === 'flying' || p.locationIcao !== HUB) { - await setScale(page, SCALE); // fast-forward any leftover leg (~20 s real time worst case at 1000×) - } + // ISS-057: a prior landing may have slowed the sim to 1× — restore 1000× first so any in-flight leg + // completes fast. Re-applied inside the poll below, since a sibling's landing mid-wait slows it again. + await setScale(page, SCALE); if (p.status === 'flying') { // While flying, locationIcao stays at the DEPARTURE airport — re-read state after landing. await expect - .poll(async () => ((await getState(page)).planes.find((x) => x.id === planeId)?.status ?? ''), { + .poll(async () => { + const s = await getState(page); + const plane = s.planes.find((x) => x.id === planeId); + if (plane?.status === 'flying' && s.simState.timeScale !== SCALE) await setScale(page, SCALE); // sibling landing re-slowed to 1× + return plane?.status ?? ''; + }, { timeout: 240_000, message: `waiting for an in-flight ${planeId} to land`, })