test: fix POPUP_AIRPORT scoping in relocation popup e2e
CI / build + unit + e2e (pull_request) Failing after 6m49s

This commit is contained in:
2026-09-19 16:23:03 +00:00
parent 008a77e456
commit 8852ae11f2
2 changed files with 6 additions and 4 deletions
+5 -4
View File
@@ -151,13 +151,14 @@ test('airport popup offers Relocate options for grounded planes', async ({ page
{ timeout: 15_000 },
).toBe(true);
// Click the LFRS marker (projected center — same pattern as e2e/map.spec.ts).
const pt = await page.evaluate(() => {
// 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 }) => {
const map = (window as any).__flightMap;
const p = map.project([POPUP_AIRPORT.lon, POPUP_AIRPORT.lat]);
const p = map.project([lon, lat]);
const rect = map.getContainer().getBoundingClientRect();
return { x: rect.left + p.x, y: rect.top + p.y };
});
}, POPUP_AIRPORT);
await page.mouse.click(pt.x, pt.y);
const popup = page.getByTestId('airport-popup');