console tests: allow 1 ms timer granularity on the claim's 650 ms holds
main bd2e9dfa: TestDemoClaimUXHeadlessFast1280 measured 649.8 ms between two stages. The page keeps its 650 ms hold with its own timers, which Chromium runs in whole milliseconds against a performance.now() it coarsens to about 0.1 ms with jitter, so a kept hold can read a fraction short. The three hold assertions now require 649 ms; a page that skipped a hold would still be hundreds of ms short. Showed up once the fast scene became a fresh browser's first page (the UX test split).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+11
−3
internal/console/testdata/demo_claim_browser.mjs+11 −3
CI passed — run details
diff --git a/internal/console/testdata/demo_claim_browser.mjs b/internal/console/testdata/demo_claim_browser.mjs| index 9a6d43ca4..da87de325 100644 |
| --- a/internal/console/testdata/demo_claim_browser.mjs |
| +++ b/internal/console/testdata/demo_claim_browser.mjs |
| @@ -4,6 +4,14 @@ import {writeFile} from 'node:fs/promises'; |
| import {captureClaim, watchClaimCSP} from './demo_claim_layout.mjs'; |
| import {checkClaimMotion} from './demo_claim_motion.mjs'; |
| +// The page holds each stage, and a working button, for 650 ms by its own |
| +// timers. Chromium runs timers in whole milliseconds and coarsens |
| +// performance.now() (about 0.1 ms, with jitter), so a hold the page kept |
| +// can measure a fraction under 650 here: 649.8 ms on CI, 2026-11-11. One |
| +// millisecond of slack absorbs that; a page that skipped its hold would |
| +// still come up hundreds of milliseconds short. |
| +const heldAtLeast = 649; |
| + |
| const [binary, profile, target, screenshots, expectedError] = process.argv.slice(2); |
| const chrome = spawn(binary, ['--headless', '--no-sandbox', '--disable-gpu', |
| '--disable-dev-shm-usage', '--disable-background-networking', '--disable-component-update', |
| @@ -167,7 +175,7 @@ async function runUX(scenes) { |
| const a = stages.find(row => row.stage === stage); |
| const b = stages.find(row => row.stage === stage+1); |
| assert(a && b,JSON.stringify(stages)); |
| - assert(b.time-a.time >= 650,JSON.stringify(stages)); |
| + assert(b.time-a.time >= heldAtLeast,JSON.stringify(stages)); |
| } |
| assert.equal(await evaluate('window.claimBlankFrames'),0,'blank progress frame'); |
| await captureClaim(call,evaluate,screenshots,'live-done',[390,1280]); |
| @@ -196,7 +204,7 @@ async function runUX(scenes) { |
| await new Promise(resolve=>setTimeout(resolve,500)); |
| assert.equal(await evaluate('window.claimSubmitEnd === undefined'),true,'button submitted before 650ms'); |
| await until('window.claimSubmitEnd !== undefined'); |
| - assert(await evaluate('window.claimSubmitEnd-window.claimSubmitStart >= 650')); |
| + assert(await evaluate('window.claimSubmitEnd-window.claimSubmitStart >= '+heldAtLeast)); |
| await captureClaim(call,evaluate,screenshots,scene.Name+'-working',[390,1280]); |
| } |
| await call('Network.setBlockedURLs',{urls:[]}); |
| @@ -219,7 +227,7 @@ async function liveMotion(scene) { |
| assert.equal(await evaluate(`document.getAnimations().some(a=>a.animationName==='claim-burst')`),true); |
| } |
| const stages = await evaluate('window.claimStageTimes'); |
| - for (const n of [1,2,3]) assert(stages.find(s=>s.stage===n+1).time-stages.find(s=>s.stage===n).time>=650,JSON.stringify(stages)); |
| + for (const n of [1,2,3]) assert(stages.find(s=>s.stage===n+1).time-stages.find(s=>s.stage===n).time>=heldAtLeast,JSON.stringify(stages)); |
| assert.equal(await evaluate('window.claimBlankFrames'),0); |
| await new Promise(resolve=>setTimeout(resolve,450)); |
| if (screenshots) { |