Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(Slider): the busy-main-thread coast proof runs in WebKit on the paced touch play (#9694)

Christopher Chedeau195fcfd93006
diff --git a/packages/core/src/Slider/__tests__/SliderTouch.interaction.browser.spec.ts b/packages/core/src/Slider/__tests__/SliderTouch.interaction.browser.spec.ts
index 15c5946fc4..c59648de05 100644
--- a/packages/core/src/Slider/__tests__/SliderTouch.interaction.browser.spec.ts
+++ b/packages/core/src/Slider/__tests__/SliderTouch.interaction.browser.spec.ts
@@ -1307,10 +1307,6 @@ test(
'core-slider--touch-tracking',
{name: 'Brightness'},
);
- test.skip(
- !driver.scriptedTimestamps,
- 'WebKit stamps an injected touch when it arrives, so a stalled dispatch bunches the throw, and its cast moves in 2 px steps (README: engine limits)',
- );
await markElement(thumb);
// A compositor-only control in the same screencast: the coast is judged
// against what this machine's compositor presented in the block.
@@ -1327,20 +1323,35 @@ test(
during: fillOf(thumb),
minProgressMs: 48,
});
- // A moderate iPhone flick, 900 px/s over 60 ms, with the script's own
- // timestamps.
- await driver.play(flick(at, {velocity: {x: 900, y: 0}, durationMs: 60}));
+ // A moderate iPhone flick, 900 px/s over 60 ms. WebKit stamps a touch
+ // when it arrives, so the play keeps the script's spacing after a
+ // stalled dispatch. A page that read a resting finger, or no throw,
+ // fails the play and names whose fault it was.
+ const played = await driver.play(
+ flick(at, {velocity: {x: 900, y: 0}, durationMs: 60}),
+ {pacing: 'spacing'},
+ );
const block = await blocking;
await page.waitForTimeout(150);
const castFrames = await cast.stop();
const tracked = await trackMarker(page, castFrames);
const control = await trackMarker(page, castFrames, {rgb: CONTROL_RGB});
- // Judged until 2 px from rest: two of the cast's 1 px position steps.
+ // Judged until two of the cast's own steps from rest: 2 px in
+ // Chromium's PNG cast, 4 px in WebKit's JPEG cast. WebKit's tail then
+ // shows the cast's 2 px plateaus, not a stall.
const proof = busyWindowProof(tracked, block, {
axis: 'x',
- settledWithin: 2,
+ settledWithinSteps: 2,
control,
});
+ // A slow runner stretches the throw, and a slow throw coasts too little
+ // to judge. The verdict names the release the page read, so that red
+ // names the runner.
+ const release = played.at(-1)?.release;
+ const summary =
+ release == null
+ ? proof.summary
+ : `${proof.summary}; the page read ${release.pagePxPerS.toFixed(0)} px/s of the script's ${release.scriptPxPerS.toFixed(0)} px/s`;
await writeEvidence(
'busy-main-thread/slider-coast',
{
@@ -1348,6 +1359,7 @@ test(
{
block,
proof,
+ release,
frames: tracked.map(f => ({
t: +(f.t - block.from).toFixed(1),
x: f.box?.x ?? null,
@@ -1372,9 +1384,9 @@ test(
await film.write(testInfo, {block, judged: proof.judged});
testInfo.annotations.push({
type: 'busy-main-thread',
- description: proof.summary,
+ description: summary,
});
- expect(proof.verdict.failures, proof.summary).toEqual([]);
+ expect(proof.verdict.failures, summary).toEqual([]);
},
);