test: click the rendered marker position while paused — closes render-lag race (CI run #37)
CI / build + unit + e2e (pull_request) Successful in 5m0s
CI / build + unit + e2e (pull_request) Successful in 5m0s
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
- Cargo sub-line route span had no white-space rule and wrapped mid-route — it now carries the existing `contract-route` class (nowrap + ellipsis)
|
- Cargo sub-line route span had no white-space rule and wrapped mid-route — it now carries the existing `contract-route` class (nowrap + ellipsis)
|
||||||
- **Left pane sanity-checked at its new 280px**: fleet-row location span (`.plane-loc`) already had nowrap+ellipsis but lacked `min-width: 0`, so a long in-flight leg would have overflowed instead of truncating — same one-line guard added. Fuel/loadout spans are short fixed strings and need no guard
|
- **Left pane sanity-checked at its new 280px**: fleet-row location span (`.plane-loc`) already had nowrap+ellipsis but lacked `min-width: 0`, so a long in-flight leg would have overflowed instead of truncating — same one-line guard added. Fuel/loadout spans are short fixed strings and need no guard
|
||||||
- Verified: `tsc --noEmit` clean; unit suite **238/238** green locally (no lib changes); e2e not run locally by design — CI verifies against an isolated stack
|
- Verified: `tsc --noEmit` clean; unit suite **238/238** green locally (no lib changes); e2e not run locally by design — CI verifies against an isolated stack
|
||||||
|
- **Unrelated test-stability fix included on this branch to unblock the pipeline** (`e2e/map-interactions.spec.ts`, no app changes): the mid-flight marker click now targets the plane's RENDERED position — it polls up to ~5 s for the rendered feature via `window.__flightMap.queryRenderedFeatures` on layers `planes-flying`/`planes-grounded` and projects that feature's coordinates, instead of fetching a fresh `/api/state`. With the sim paused the server position is static, but the map renders from its own ~1 s poll — right after the freeze confirmation the last rendered frame can still be up to one poll interval stale (tens of px at scale 1000 on EDDF→LEMD), so a click projected from a fresh fetch misses the small circle layer: the render-lag race that flaked CI run #37. Pause + freeze confirmation, popup assertions and resume are unchanged
|
||||||
|
|
||||||
## v0.15.0 — 2026-09-19 09:35
|
## v0.15.0 — 2026-09-19 09:35
|
||||||
- **Hover visualization from the side panels (ISS-002).** Hovering a fleet row in the left pane, an "On board" block (including its cargo rows) or an open-package row in the right pane now highlights the matching object on the map. The shared `HoverTarget` type (`components/hoverTypes.ts`: `{kind:'plane', id}` | `{kind:'package', originIcao, destIcao}`) is owned by the shell as a single `useState` and prop-drilled down — panes report via an `onHover` callback, `<Map>` consumes it. No React contexts introduced; the established prop-drilling pattern is kept
|
- **Hover visualization from the side panels (ISS-002).** Hovering a fleet row in the left pane, an "On board" block (including its cargo rows) or an open-package row in the right pane now highlights the matching object on the map. The shared `HoverTarget` type (`components/hoverTypes.ts`: `{kind:'plane', id}` | `{kind:'package', originIcao, destIcao}`) is owned by the shell as a single `useState` and prop-drilled down — panes report via an `onHover` callback, `<Map>` consumes it. No React contexts introduced; the established prop-drilling pattern is kept
|
||||||
|
|||||||
@@ -266,20 +266,35 @@ test('plane markers move while flying and the plane popup shows status + route',
|
|||||||
}, { timeout: 15_000, message: 'waiting for the paused clock to freeze the plane position' })
|
}, { timeout: 15_000, message: 'waiting for the paused clock to freeze the plane position' })
|
||||||
.toBe(true);
|
.toBe(true);
|
||||||
|
|
||||||
// Fetch + project in one evaluate — with the sim paused above, the server's analytic
|
// Click the RENDERED marker position, not a fresh /api/state fetch. With the sim paused
|
||||||
// position is static, so the projected point matches what the map renders.
|
// above the server's analytic position is static — but the map renders from its own ~1 s
|
||||||
|
// poll, so right after the freeze confirmation the last rendered frame can still be up to
|
||||||
|
// one poll interval stale (tens of px at scale 1000 on this leg) and a click projected
|
||||||
|
// from a fresh fetch misses the small circle layer (CI run #37). Poll for the plane's
|
||||||
|
// rendered feature instead and project ITS coordinates — exactly what the map draws.
|
||||||
|
// Find + project in one evaluate so nothing can change between the two steps.
|
||||||
const pt = await page.evaluate(async () => {
|
const pt = await page.evaluate(async () => {
|
||||||
const m = (window as any).__flightMap;
|
const m = (window as any).__flightMap;
|
||||||
if (!m) return null;
|
if (!m) return null;
|
||||||
const res = await fetch('/api/state', { cache: 'no-store' });
|
const deadline = Date.now() + 5_000;
|
||||||
const body = (await res.json()) as StateBody;
|
for (;;) {
|
||||||
const p = body.planes.find((x) => x.id === 'plane-starter');
|
let feats: Array<{ properties?: Record<string, unknown>; geometry?: { coordinates: number[] } }> = [];
|
||||||
if (!p || p.status !== 'flying') return null;
|
try {
|
||||||
const projected = m.project([p.lon, p.lat]);
|
feats = m.queryRenderedFeatures(undefined, { layers: ['planes-flying', 'planes-grounded'] });
|
||||||
const rect = m.getContainer().getBoundingClientRect();
|
} catch {
|
||||||
return { x: rect.left + projected.x, y: rect.top + projected.y };
|
// map not ready yet — keep polling
|
||||||
|
}
|
||||||
|
const f = feats.find((x) => x.properties?.id === 'plane-starter');
|
||||||
|
if (f && f.geometry) {
|
||||||
|
const projected = m.project(f.geometry.coordinates);
|
||||||
|
const rect = m.getContainer().getBoundingClientRect();
|
||||||
|
return { x: rect.left + projected.x, y: rect.top + projected.y };
|
||||||
|
}
|
||||||
|
if (Date.now() >= deadline) return null;
|
||||||
|
await new Promise((r) => setTimeout(r, 100));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
expect(pt).not.toBeNull(); // the ~10 s window at scale 1000 is still open this early after departure
|
expect(pt, 'plane marker not rendered after pause').not.toBeNull();
|
||||||
|
|
||||||
await page.mouse.click(pt!.x, pt!.y);
|
await page.mouse.click(pt!.x, pt!.y);
|
||||||
const popup = page.getByTestId('plane-popup');
|
const popup = page.getByTestId('plane-popup');
|
||||||
|
|||||||
Reference in New Issue
Block a user