feat: v0.14.0 — ISS-006 time-scale slider values up to 1000x; tests use fastest time
CI / build + unit + e2e (pull_request) Failing after 4m52s
CI / build + unit + e2e (pull_request) Failing after 4m52s
This commit is contained in:
@@ -5,14 +5,16 @@ import { test, expect, type Page } from '@playwright/test';
|
||||
// deterministic generated weather), plane markers whose positions come from the
|
||||
// /api/state polls, each FLYING plane's current leg as a route line (origin →
|
||||
// dest_icao; grounded planes draw nothing), and the plane status popup. Packages
|
||||
// are created on a known EDDF→EDDV route via POST /api/test/create-package
|
||||
// are created on a known EDDF→LEMD route via POST /api/test/create-package
|
||||
// (FLIGHT_TEST_HOOKS=1).
|
||||
|
||||
const HUB = 'EDDF'; // must match HUB_ICAO in lib/game/seed.ts
|
||||
// Hannover — ~282 km from EDDF → ~33 min game time ≈ 33 s at scale 60, a comfortable
|
||||
// window for the click assertions below (the nearest airport would land too fast).
|
||||
const DEST = 'EDDV';
|
||||
const SCALE = 60;
|
||||
// Madrid–Barajas — ~1420 km from EDDF → ~2.8 h game time ≈ 10 s at scale 1000, a comfortable
|
||||
// window for the mid-flight click assertions below (at 1000× even Hannover's 33-min leg would
|
||||
// land in ~2 s — shorter than the map poll + click pipeline). Round-trip burn (~4970 L) fits
|
||||
// the 6300 L tank, so a full-tank departure always makes it home.
|
||||
const DEST = 'LEMD';
|
||||
const SCALE = 1000; // fastest sim speed (v0.14.0 ladder top)
|
||||
|
||||
interface PlaneState {
|
||||
id: string;
|
||||
@@ -91,7 +93,7 @@ async function createPackage(page: Page, fromIcao: string, toIcao: string): Prom
|
||||
}
|
||||
|
||||
// Load a package onto plane-starter and fly it from → to via the API, then poll at
|
||||
// scale 60 until the plane lands at `to`. Same pattern as e2e/actions.spec.ts.
|
||||
// scale 1000 until the plane lands at `to`. Same pattern as e2e/actions.spec.ts.
|
||||
async function loadAndFly(page: Page, fromIcao: string, toIcao: string): Promise<PackageState> {
|
||||
const pkg = await createPackage(page, fromIcao, toIcao);
|
||||
const load = await page.request.post(`/api/packages/${pkg.id}/load`, { data: { planeId: 'plane-starter' } });
|
||||
@@ -171,7 +173,7 @@ test('airport popup shows name, ICAO, local time and generated weather', async (
|
||||
});
|
||||
|
||||
test('plane markers move while flying and the plane popup shows status + route', async ({ page }) => {
|
||||
test.setTimeout(600_000); // self-heal from a far airport (~4 min worst case at 60×) + main flight + cleanup
|
||||
test.setTimeout(600_000); // self-heal from a far airport (~20 s worst case at 1000×) + main flight + cleanup
|
||||
|
||||
await page.goto('/');
|
||||
await waitForAirportCount(page);
|
||||
@@ -195,6 +197,11 @@ test('plane markers move while flying and the plane popup shows status + route',
|
||||
await loadAndFly(page, starterLoc, HUB);
|
||||
}
|
||||
|
||||
// Full tank before departure — the EDDF↔LEMD round trip burns ~4970 L of the 6300 L tank,
|
||||
// so a partially drained plane left by an earlier spec could not make it home.
|
||||
const refuel = await page.request.post('/api/planes/plane-starter/refuel');
|
||||
expect(refuel.status()).toBe(200);
|
||||
|
||||
// 1) Load the hook-created package — a GROUNDED plane draws no route line yet.
|
||||
const pkg = await createPackage(page, HUB, DEST);
|
||||
const load = await page.request.post(`/api/packages/${pkg.id}/load`, { data: { planeId: 'plane-starter' } });
|
||||
@@ -244,8 +251,8 @@ test('plane markers move while flying and the plane popup shows status + route',
|
||||
// The arc itself stays covered by unit tests: lib/mapData.test.ts.)
|
||||
|
||||
// 4) Click the flying plane → status popup with model, status, fuel and the leg.
|
||||
// Fetch + project in one evaluate so the click lands on a fresh position (the
|
||||
// marker drifts only ~1 px/s of screen space at scale 60).
|
||||
// Fetch + project in one evaluate so the click lands on a fresh position (at scale
|
||||
// 1000 the marker moves fast — a stale projection would miss it).
|
||||
const pt = await page.evaluate(async () => {
|
||||
const m = (window as any).__flightMap;
|
||||
if (!m) return null;
|
||||
@@ -257,7 +264,7 @@ test('plane markers move while flying and the plane popup shows status + route',
|
||||
const rect = m.getContainer().getBoundingClientRect();
|
||||
return { x: rect.left + projected.x, y: rect.top + projected.y };
|
||||
});
|
||||
expect(pt).not.toBeNull(); // the flight (~33 s at scale 60) is still in progress here
|
||||
expect(pt).not.toBeNull(); // the ~10 s window at scale 1000 is still open this early after departure
|
||||
|
||||
await page.mouse.click(pt!.x, pt!.y);
|
||||
const popup = page.getByTestId('plane-popup');
|
||||
|
||||
Reference in New Issue
Block a user