Fix two-planes e2e healPlaneHome: restore 1000× before waiting for landing (ISS-057 slows sim to 1×)
CI / build + unit + e2e (pull_request) Successful in 9m21s

This commit is contained in:
2026-09-20 22:59:29 +00:00
parent 04b6f20a93
commit fa64e32f65
+9 -4
View File
@@ -210,13 +210,18 @@ async function healPlaneHome(page: Page, planeId: string): Promise<void> {
await clearQueueViaApi(page, planeId); await clearQueueViaApi(page, planeId);
let p = (await getState(page)).planes.find((x) => x.id === planeId); let p = (await getState(page)).planes.find((x) => x.id === planeId);
if (!p) return; // already sold — nothing to heal if (!p) return; // already sold — nothing to heal
if (p.status === 'flying' || p.locationIcao !== HUB) { // ISS-057: a prior landing may have slowed the sim to 1× — restore 1000× first so any in-flight leg
await setScale(page, SCALE); // fast-forward any leftover leg (~20 s real time worst case at 1000×) // 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') { if (p.status === 'flying') {
// While flying, locationIcao stays at the DEPARTURE airport — re-read state after landing. // While flying, locationIcao stays at the DEPARTURE airport — re-read state after landing.
await expect 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, timeout: 240_000,
message: `waiting for an in-flight ${planeId} to land`, message: `waiting for an in-flight ${planeId} to land`,
}) })