v0.70.0: default map view — world at [0,0] zoom 2, minZoom 0
CI / build + unit + e2e (pull_request) Failing after 14m13s
CI / build + unit + e2e (pull_request) Failing after 14m13s
This commit is contained in:
+25
-2
@@ -12,10 +12,27 @@ import { expect, test } from '@playwright/test';
|
||||
const SCALE = 1000; // test rate for fast-forwarding legs — keeps cleanup flights to seconds of real time
|
||||
const WORLD = 24; // the fixed world rate (ISS-117) — must match lib/worldClock.ts
|
||||
const HUB = 'EDDF'; // Frankfurt Main — the seeded starter plane's home base (lib/game/seed.ts)
|
||||
// LFRS Nantes Atlantique — same isolated marker as e2e/map.spec.ts: its nearest neighbour is ~78 px
|
||||
// away at the initial zoom, so a click on its projected center cannot hit another circle.
|
||||
// LFRS Nantes Atlantique — same isolated marker as e2e/map.spec.ts. The v0.70.0 default view ([0,0] z2)
|
||||
// shows both Africa + Europe with overlapping markers (LFRS's nearest neighbour LFRB Brest is only
|
||||
// ~13–19 px away at z2), so framePopupAirport below frames it at z5 first — its nearest marker is then
|
||||
// ~104 px away and a click on the projected center cannot hit another circle.
|
||||
const POPUP_AIRPORT = { icao: 'LFRS', lon: -1.61073, lat: 47.153198 };
|
||||
|
||||
async function framePopupAirport(page: Page): Promise<void> {
|
||||
await page.evaluate((a) => (window as any).__flightMap.jumpTo({ center: [a.lon, a.lat], zoom: 5 }), POPUP_AIRPORT);
|
||||
// Wait until the marker is actually rendered at the new camera before clicking it. The airport is
|
||||
// passed AS AN ARGUMENT — evaluate callbacks run in the browser, where Node-scope values don't exist.
|
||||
await expect.poll(async () =>
|
||||
page.evaluate((a) => {
|
||||
const map = (window as any).__flightMap;
|
||||
const p = map.project([a.lon, a.lat]);
|
||||
return (map.queryRenderedFeatures([p.x, p.y], { layers: ['airports-circles'] }) as Array<{ properties?: Record<string, unknown> }>)
|
||||
.some((f) => f.properties?.icao === a.icao);
|
||||
}, POPUP_AIRPORT),
|
||||
{ timeout: 15_000 },
|
||||
).toBe(true);
|
||||
}
|
||||
|
||||
interface StateBody {
|
||||
planes: Array<{ id: string; status: string; maxFuel: number; locationIcao: string; destIcao: string | null; queue: string[] }>;
|
||||
}
|
||||
@@ -161,6 +178,9 @@ test('airport popup offers Relocate options for grounded planes', async ({ page
|
||||
{ timeout: 15_000 },
|
||||
).toBe(true);
|
||||
|
||||
// Frame the popup airport at z5 first — see framePopupAirport above for why the v0.70.0 default view needs this.
|
||||
await framePopupAirport(page);
|
||||
|
||||
// Click the LFRS marker (projected center — same pattern as e2e/map.spec.ts). The constant is
|
||||
// passed AS AN ARGUMENT: the evaluate callback runs in the browser, where Node-scope values don't exist.
|
||||
const pt = await page.evaluate(({ lon, lat }) => {
|
||||
@@ -241,6 +261,9 @@ test('airport popup Relocate queues a leg for a flying plane', async ({ page })
|
||||
{ timeout: 15_000 },
|
||||
).toBe(true);
|
||||
|
||||
// Frame the popup airport at z5 first — see framePopupAirport above for why the v0.70.0 default view needs this.
|
||||
await framePopupAirport(page);
|
||||
|
||||
const pt = await page.evaluate(({ lon, lat }) => {
|
||||
const map = (window as any).__flightMap;
|
||||
const p = map.project([lon, lat]);
|
||||
|
||||
Reference in New Issue
Block a user