test(ui): the panel gate waits for the rail on a timer, and never fails on it

On the CI runner the CCTV box never held pixel-identical for ten animation
frames within 15 s, so settle() timed out and failed the gate although the
street-level gate before it passed. The wait now rounds the box to whole
pixels, polls every 100 ms for half a second of stillness, and only logs if
the rail keeps moving: the lift is checked against the box recorded at
pointerdown, so settling is only there to make that box the docked one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-05 15:18:14 +01:00
1 parent 69beda99fa
commit 8482daa377
1 file changed
+28 -15
+28 -15
View File
@@ -132,21 +132,34 @@ async function main() {
}; };
}, PANEL_ID); }, PANEL_ID);
/** Wait until the CCTV box has held still for ten animation frames. */ /** Wait until the CCTV box has held still for ten animation frames. */
const settle = () => /**
page.waitForFunction( * Best effort: wait until the CCTV box (to the whole pixel) has held still
(id) => { * for half a second. The lift is checked against the box at pointerdown,
const r = document.getElementById(id).getBoundingClientRect(); * so a rail that keeps nudging the panel only costs the wait, not the run.
const box = `${r.left},${r.top},${r.width},${r.height}`; */
if (window.__qaLastBox === box) window.__qaStill += 1; const settle = async () => {
else { try {
window.__qaLastBox = box; await page.waitForFunction(
window.__qaStill = 0; (id) => {
} const r = document.getElementById(id).getBoundingClientRect();
return window.__qaStill >= 10; const box = [r.left, r.top, r.width, r.height]
}, .map(Math.round)
{ polling: 'raf', timeout: 15_000 }, .join(',');
PANEL_ID, const now = performance.now();
); if (window.__qaLastBox !== box) {
window.__qaLastBox = box;
window.__qaSince = now;
}
return now - window.__qaSince >= 500;
},
{ polling: 100, timeout: 20_000 },
PANEL_ID,
);
} catch (error) {
if (error?.name !== 'TimeoutError') throw error;
console.log('note: the CCTV panel was still moving; lifting anyway');
}
};
const headerPoint = async () => { const headerPoint = async () => {
const rect = await page.evaluate((id) => { const rect = await page.evaluate((id) => {
const title = document.querySelector( const title = document.querySelector(