Two-plane load fix + e2e coverage for 2-plane gameplay (ISS-055, v0.31.0) #62

Merged
kamilkrzywda merged 4 commits from fix/two-planes-load-and-e2e into master 2026-09-21 01:08:55 +02:00
Showing only changes of commit fa64e32f65 - Show all commits
+9 -4
View File
@@ -210,13 +210,18 @@ async function healPlaneHome(page: Page, planeId: string): Promise<void> {
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`,
})