From 07d90be28f605135029cc3823af55a802c423a25 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 30 Sep 2026 21:09:32 +0300 Subject: [PATCH] test(dialog): measure the room toggle after its knob stops sliding (#712) The second flake of smoke_dialog_polish_603: the knob slides with `transition: left .15s` and the probe waited a fixed 220 ms, 70 ms of slack that load ate (rightGap 3.05 and 5.6 instead of 2 in 2 of 20 loaded runs). The probe now waits until the toggle and its pseudo-elements have no running animation. The geometry oracle and its negative probe are unchanged. Issue: #712 User-Visible: no Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd --- demo/smoke_dialog_polish_603.mjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/demo/smoke_dialog_polish_603.mjs b/demo/smoke_dialog_polish_603.mjs index 9824d177..0933143e 100644 --- a/demo/smoke_dialog_polish_603.mjs +++ b/demo/smoke_dialog_polish_603.mjs @@ -84,13 +84,24 @@ for (const dpr of [1, 2]) { target: toggle.getBoundingClientRect(), }; }; + // #712: the knob slides with `transition: left .15s`. A fixed 220 ms + // wait left 70 ms of slack and missed it under load; wait until the + // toggle and its pseudo-elements have no running animation instead. + const idle = async () => { + for (let round = 0; round < 20; round++) { + const running = toggle.getAnimations({ subtree: true }) + .filter((animation) => animation.playState !== 'finished' && animation.playState !== 'idle'); + if (!running.length) return; + await Promise.all(running.map((animation) => animation.finished.catch(() => {}))); + } + }; toggle.checked = false; toggle.dispatchEvent(new Event('change', { bubbles: true })); await settle(); - await new Promise((resolve) => setTimeout(resolve, 220)); + await idle(); const off = measure(); toggle.checked = true; toggle.dispatchEvent(new Event('change', { bubbles: true })); await settle(); - await new Promise((resolve) => setTimeout(resolve, 220)); + await idle(); const on = measure(); const switchAligned = Math.abs(off.topGap - off.bottomGap) <= 1 && Math.abs(on.topGap - on.bottomGap) <= 1