test: fix POPUP_AIRPORT scoping in relocation popup e2e
CI / build + unit + e2e (pull_request) Failing after 6m49s
CI / build + unit + e2e (pull_request) Failing after 6m49s
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user