console tests: time the first claim stage from its first paint
TestDemoClaimUXHeadlessFast390 measured 644.9 ms between stages 1 and 2 on CI. The recorder timed the server-rendered first stage from DOMContentLoaded, which a cold or busy browser can reach after the page has painted; the page counts its 650 ms from its own paint. The first stage is now timed from first-contentful-paint when that came first, which is when the visitor saw it. Later stages are unchanged. Splitting the UX test made the fast scene a fresh browser's first page, where this shows up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+9
−1
internal/console/testdata/demo_claim_layout.mjs+9 −1
diff --git a/internal/console/testdata/demo_claim_layout.mjs b/internal/console/testdata/demo_claim_layout.mjs| index f6091c224..c742460e0 100644 |
| --- a/internal/console/testdata/demo_claim_layout.mjs |
| +++ b/internal/console/testdata/demo_claim_layout.mjs |
| @@ -76,7 +76,15 @@ export const watchClaimCSP = ` |
| let last; |
| const record = () => { |
| const stage = claim.dataset.state === 'claimed' ? 4 : Number(progress.dataset.stage); |
| - if (stage !== last) { window.claimStageTimes.push({stage,time:performance.now()}); last=stage; } |
| + if (stage === last) return; |
| + // The server-rendered stage is on screen from the first contentful |
| + // paint, which a cold or busy browser can reach before this event |
| + // fires. The page counts its 650 ms from its own paint, so timing the |
| + // first stage from here would short it (644.9 ms on CI, 2026-11-10). |
| + let time = performance.now(); |
| + if (last === undefined) time = Math.min(time, performance.getEntriesByName('first-contentful-paint')[0]?.startTime ?? time); |
| + window.claimStageTimes.push({stage,time}); |
| + last = stage; |
| }; |
| record(); |
| new MutationObserver(record).observe(claim,{attributes:true,subtree:true,attributeFilter:['data-stage','data-state']}); |