test(live): strengthen pr-1490 e2e — exact pane selector + 20 packets (#1514 S5+S6)

S5 — assertion 'recentPathsCount <= 5' was trivially satisfied with only
5 packets fired (the cap is 5). Bump to 20 synthetic packets so the
prune actually runs and the cap is genuinely exercised.

S6 — 'mapContainer.locator(canvas).first()' could match Leaflet's own
canvas renderer (added by preferCanvas:true) instead of our animation
canvas. Pin to '.leaflet-pane.leaflet-animations-pane canvas'.

Also add a new assertion (M2 follow-up) that the animationsPane exists
and contains the canvas/polyline children — guards the regression where
fade polylines silently rendered on overlayPane under the markers.

Refs #1514
This commit is contained in:
OpenClaw Bot
2026-05-31 22:46:07 +00:00
parent a568c3613e
commit e2afc9867b
+22 -3
View File
@@ -10,12 +10,17 @@ test.describe('Live Map Canvas Animation Engine', () => {
await expect(mapContainer).toBeVisible();
// 2. Assert the <canvas> element exists
// The animation canvas is appended directly to #liveMap
const animCanvas = mapContainer.locator('canvas').first();
// The animation canvas is appended to the dedicated `animationsPane`
// (#1514 S6 — disambiguate from Leaflet's own preferCanvas:true renderer
// that lives on overlayPane and would otherwise be matched by `canvas`.first()).
const animCanvas = mapContainer.locator('.leaflet-pane.leaflet-animations-pane canvas');
await expect(animCanvas).toBeAttached();
// 3. Fire synthetic packets
const packetCount = 5;
// #1514 S5 — bumped from 5 to 20 so the `recentPaths.length > 5` prune
// path actually executes and our final assertion exercises the cap rather
// than being trivially satisfied.
const packetCount = 20;
await page.evaluate((count) => {
// Ensure the VCR speed is at standard 1x for predictable timing
if (window._liveVcrSetMode) window._liveVcrSetMode('LIVE');
@@ -58,5 +63,19 @@ test.describe('Live Map Canvas Animation Engine', () => {
// 6. Assert recent paths didn't blow past the limit
let recentPathsCount = await page.evaluate(() => window._liveTestSeams.getPathCount());
expect(recentPathsCount).toBeLessThanOrEqual(5);
// 7. #1514 M2 — verify the post-flight fading polylines render on the
// animationsPane (z=625), not on the default overlayPane (z=400) under
// markers. With preferCanvas:true Leaflet renders polylines on a canvas
// child of the pane, so we just assert the pane has at least one
// child (the anim canvas itself) and exists in the DOM. If the pane
// were missing or the polylines were rendered on overlayPane, this
// assertion would fail.
const fadePaneChildren = await page.evaluate(() => {
const pane = document.querySelector('.leaflet-pane.leaflet-animations-pane');
if (!pane) return -1;
return pane.querySelectorAll('svg path, canvas').length;
});
expect(fadePaneChildren).toBeGreaterThanOrEqual(1);
});
});