Skip to content

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

TypeScript

test(interaction-harness): a busy proof names a frame it cannot judge (#10765)

Christopher Chedeau5c336a54ba48
diff --git a/internal/interaction-harness/README.md b/internal/interaction-harness/README.md
index 58af5df52d..22085d5ca2 100644
--- a/internal/interaction-harness/README.md
+++ b/internal/interaction-harness/README.md
@@ -342,6 +342,12 @@ to show a new position on at least four of the control's frames. The cast step (
is read from the value's changes in the judged part, so a position the page
commits off the grid once the block ends does not shrink it.
A main-thread animation still fails: the control moves and it does not.
+Each such run counts in the control read's `belowStep`. A proof that claims a
+new position on every frame the control moved passes `judgeEveryFrame`. A frame
+the cast's step explains is then too little to judge: `busyWindowProof` throws
+`BusyFrameUnjudgedError` with each such frame, the component's move per frame
+there and the cast's step. A verdict that fails anyway comes back as it is, so
+a frozen or main-thread component stays a red on the component.
`controlClock(control)` reads the compositor's own time in each frame off the
control's position, for a proof that judges motion against time, not against
diff --git a/internal/interaction-harness/src/busy.ts b/internal/interaction-harness/src/busy.ts
index 196fdad585..576684e512 100644
--- a/internal/interaction-harness/src/busy.ts
+++ b/internal/interaction-harness/src/busy.ts
@@ -10,7 +10,9 @@
* the control when it has one. `castStep`, the screencast's position step
* read from its frames. `pooledBusyProof`, which judges several short
* blocks as one. `BusyWindowTooLateError`, for a block that began too late
- * for the motion it was meant to catch.
+ * for the motion it was meant to catch. `BusyFrameUnjudgedError`, for a
+ * frame the cast could not judge in a proof that judges every frame
+ * (`judgeEveryFrame`).
* `BUSY_PROOF_LOOKAROUND_MS` is how far around its judged part a proof
* reads frames.
* `trackControl` and `controlClock` read the control's box and its own
@@ -475,6 +477,45 @@ export class BusyWindowTooLateError extends Error {
}
}
+/** A frame a busy proof could not judge (see `BusyFrameUnjudgedError`). */
+export interface UnjudgedFrame {
+ /** When the frame was presented, ms after the window began. */
+ readonly atMs: number;
+ /**
+ * The component's move per frame there, px: the change that ends the run of
+ * equal positions that holds the frame, over the run's frames.
+ */
+ readonly movePx: number;
+ /** The cast's position step for the judged value, px. */
+ readonly stepPx: number;
+}
+
+/**
+ * A frame the cast could not show the component's step on, in a busy proof
+ * that judges every frame (`judgeEveryFrame`). The control moved on that
+ * frame. The component moved under two of the cast's steps a frame, and the
+ * frame shows no change. So the run is too little to judge: it fails by name,
+ * not as a red on the component. A frozen or main-thread component still
+ * fails the verdict, since the cast's step does not explain its hold.
+ */
+export class BusyFrameUnjudgedError extends Error {
+ constructor(
+ /** Each frame the proof could not judge. */
+ readonly frames: readonly UnjudgedFrame[],
+ summary: string,
+ ) {
+ super(
+ `busyWindowProof: too little to judge: ${frames
+ .map(
+ frame =>
+ `at +${frame.atMs.toFixed(1)} ms the component moved about ${frame.movePx.toFixed(2)} px a frame, under two of the cast's ${frame.stepPx} px steps, and the frame shows no step while the control moved`,
+ )
+ .join('; ')}. ${summary}`,
+ );
+ this.name = 'BusyFrameUnjudgedError';
+ }
+}
+
export async function blockMainThread(
page: Page,
ms: number,
@@ -1029,14 +1070,24 @@ function motionStepPx(values: readonly number[]): number {
* `FRAME_STARVATION_MS` in the block. Without a control, a block with no
* frame is a frozen animation's, and it fails the verdict. `pooledBusyProof`
* reads each run without the throw and judges the runs together.
+ *
+ * With `judgeEveryFrame`, a frame the cast could not show the component's
+ * step on is too little to judge (the frames `belowStep` counts). When the
+ * verdict otherwise passes, the proof throws `BusyFrameUnjudgedError` with
+ * each such frame, the component's move there and the cast's step. A failed
+ * verdict is returned as it is: it is the component's red.
*/
export function busyWindowProof(
...args: Parameters<typeof readBusyWindow>
): BusyProof {
- const {proof, starvation} = readBusyWindow(...args);
+ const {proof, starvation, unjudged} = readBusyWindow(...args);
if (starvation != null) {
throw new FrameStarvationError(starvation);
}
+ // A failed verdict is the component's red, whatever else the cast hid.
+ if (unjudged.length > 0 && proof.verdict.failures.length === 0) {
+ throw new BusyFrameUnjudgedError(unjudged, proof.summary);
+ }
return proof;
}
@@ -1064,6 +1115,7 @@ function readBusyWindow(
minJudgedFrames = 4,
presented,
control,
+ judgeEveryFrame = false,
}: {
axis?: 'x' | 'y' | 'width' | 'height';
marginMs?: number;
@@ -1131,8 +1183,20 @@ function readBusyWindow(
* screencast with `CONTROL_RGB`): judge the component against them.
*/
control?: readonly TrackedFrame[];
+ /**
+ * With a control: judge every frame the control moved on by the
+ * component's own step. A frame the cast could not show that step on
+ * (`belowStep`) is then too little to judge, and `busyWindowProof` throws
+ * `BusyFrameUnjudgedError`. Such a frame is never a pass, and never a red
+ * on the component.
+ */
+ judgeEveryFrame?: boolean;
} = {},
-): {proof: BusyProof; starvation: FrameShortfall | null} {
+): {
+ proof: BusyProof;
+ starvation: FrameShortfall | null;
+ unjudged: readonly UnjudgedFrame[];
+} {
let end = window.to - marginMs;
if (settledWithin != null && settledWithinSteps != null) {
throw new Error(
@@ -1518,6 +1582,7 @@ function readBusyWindow(
return changes;
};
let controlRead: BusyControlRead | null = null;
+ let unjudged: UnjudgedFrame[] = [];
if (control != null) {
const controlChanges = controlChangesUpTo(control, judged.to);
const controlEdges = [judged.from, ...controlChanges, judged.to];
@@ -1540,6 +1605,15 @@ function readBusyWindow(
}
return s;
};
+ // The first frame after that run: the change that ends it, or the
+ // series' length when no change does.
+ const runEnd = (i: number): number => {
+ let k = i + 1;
+ while (k < series.length && same(k, i)) {
+ k += 1;
+ }
+ return k;
+ };
// The component's motion per frame over up to four frames before frame
// `start`, or null with fewer than two to read.
const pxPerFrameBefore = (start: number): number | null => {
@@ -1570,10 +1644,7 @@ function readBusyWindow(
return false;
}
const start = runStart(i);
- let k = i + 1;
- while (k < series.length && same(k, i)) {
- k += 1;
- }
+ const k = runEnd(i);
if (k >= series.length) {
return false;
}
@@ -1654,11 +1725,32 @@ function readBusyWindow(
...delivered.filter(t => changed.has(t) || underStep(t)),
judged.to,
];
+ const excused = controlChanges.filter(underStep);
+ if (judgeEveryFrame) {
+ unjudged = excused.map(t => {
+ const i = seriesIndex.get(t);
+ if (i == null) {
+ throw new Error(
+ 'busyWindowProof: an excused frame is missing from the series',
+ );
+ }
+ const start = runStart(i);
+ const k = runEnd(i);
+ const runFrames = (series[k].t - series[start].t) / cadence;
+ return {
+ atMs: t - window.from,
+ movePx:
+ Math.abs(series[k].value - series[i].value) /
+ Math.max(1, runFrames),
+ stepPx,
+ };
+ });
+ }
controlRead = {
moved: controlChanges.length,
movedWith: controlChanges.filter(t => changed.has(t) || underStep(t))
.length,
- belowStep: controlChanges.filter(underStep).length,
+ belowStep: excused.length,
longestStallMs: Math.max(
...controlEdges.slice(1).map((t, i) => t - controlEdges[i]),
),
@@ -1800,7 +1892,7 @@ function readBusyWindow(
verdict: {pass: failures.length === 0, failures},
summary,
};
- return {proof, starvation};
+ return {proof, starvation, unjudged};
}
/** One run of a pooled busy proof (see `pooledBusyProof`). */
@@ -1869,7 +1961,7 @@ export function pooledBusyProof(
runs: readonly BusyRun[],
options: Omit<
NonNullable<Parameters<typeof busyWindowProof>[2]>,
- 'control' | 'minMovedFraction'
+ 'control' | 'minMovedFraction' | 'judgeEveryFrame'
> & {
/** The fewest frames a run's control must move on for the run to count. */
minRunFrames?: number;
diff --git a/internal/interaction-harness/src/busy.unjudged.fixture.ts b/internal/interaction-harness/src/busy.unjudged.fixture.ts
new file mode 100644
index 0000000000..db8f93254b
--- /dev/null
+++ b/internal/interaction-harness/src/busy.unjudged.fixture.ts
@@ -0,0 +1,197 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file busy.unjudged.fixture.ts
+ * @input One Chromium CI run of Lightbox's busy double-tap zoom proof
+ * @output `ZOOM_START_CAST`: the run's block and, per cast frame, its time,
+ * the photo's top edge and height, and the control's x
+ * @position Replayed by busy.unjudged.test.ts: at the zoom's slow start one
+ * frame moves the top edge under the cast's 1 px step
+ */
+
+/** Per frame: ms after the block began, top edge, height, control x (CSS px). */
+export const ZOOM_START_CAST: {
+ readonly block: {readonly from: number; readonly to: number};
+ readonly frames: ReadonlyArray<
+ readonly [number, number | null, number | null, number | null]
+ >;
+} = {
+ block: {from: 1794208602379.5999, to: 1794208604879.5999},
+ frames: [
+ [-258.2, 223, 268, 130],
+ [-241.5, 223, 268, 140],
+ [-225.5, 223, 268, 150],
+ [-210.3, 223, 268, 160],
+ [-192.8, 223, 268, 170],
+ [-176.4, 223, 268, 180],
+ [-160.1, 223, 268, 190],
+ [-143.7, 223, 268, 200],
+ [-126.9, 223, 268, 210],
+ [-109.9, 223, 268, 220],
+ [-93.5, 223, 268, 230],
+ [-76.9, 223, 268, 240],
+ [-59.7, 223, 268, 230],
+ [-39.7, 223, 268, 220],
+ [-21.7, 223, 268, 210],
+ [-4.9, 223, 268, 200],
+ [17, 222, 270, 190],
+ [38.9, 222, 271, 180],
+ [56.3, 220, 274, 170],
+ [72.6, 219, 276, 160],
+ [89.4, 217, 280, 150],
+ [106.3, 215, 284, 140],
+ [122.9, 213, 288, 130],
+ [139.2, 211, 292, 120],
+ [156.3, 209, 297, 110],
+ [172.2, 206, 302, 100],
+ [189.3, 203, 308, 90],
+ [206.1, 200, 314, 80],
+ [222.9, 197, 320, 70],
+ [239.2, 194, 326, 60],
+ [256.1, 191, 332, 50],
+ [273.9, 188, 338, 40],
+ [289.7, 185, 344, 30],
+ [305.7, 181, 352, 20],
+ [322.7, 178, 358, 10],
+ [339.9, 174, 366, 0],
+ [355.9, 171, 372, 10],
+ [373.3, 168, 378, 20],
+ [389.7, 164, 386, 30],
+ [406.2, 161, 392, 40],
+ [422.5, 157, 400, 50],
+ [439.9, 154, 406, 60],
+ [456.2, 150, 414, 70],
+ [472.6, 147, 420, 80],
+ [489.9, 144, 426, 90],
+ [506.2, 140, 434, 100],
+ [522.6, 137, 440, 110],
+ [539.4, 134, 446, 120],
+ [556.9, 131, 452, 130],
+ [573.3, 127, 460, 140],
+ [589.6, 124, 466, 150],
+ [606.1, 121, 472, 160],
+ [622.8, 118, 478, 170],
+ [639.2, 115, 484, 180],
+ [656.7, 112, 490, 190],
+ [672.7, 109, 496, 200],
+ [689.5, 106, 502, 210],
+ [705.7, 104, 506, 220],
+ [723.2, 101, 512, 230],
+ [739.2, 98, 518, 240],
+ [756.4, 95, 524, 230],
+ [772.6, 93, 528, 220],
+ [789.8, 90, 534, 210],
+ [805.9, 88, 538, 200],
+ [823.4, 85, 544, 190],
+ [839.8, 83, 548, 180],
+ [856.1, 81, 552, 170],
+ [872.7, 78, 558, 160],
+ [890.1, 76, 562, 150],
+ [907.3, 74, 566, 140],
+ [923.8, 72, 570, 130],
+ [939.9, 70, 574, 120],
+ [956.6, 68, 578, 110],
+ [973.1, 66, 582, 100],
+ [989.3, 64, 586, 90],
+ [1006.2, 62, 590, 80],
+ [1023.2, 60, 594, 70],
+ [1039.5, 58, 598, 60],
+ [1055.7, 56, 602, 50],
+ [1072.6, 55, 604, 40],
+ [1090.7, 53, 608, 30],
+ [1106.8, 52, 610, 20],
+ [1122.8, 50, 614, 10],
+ [1139.3, 48, 618, 0],
+ [1158.2, 47, 620, 10],
+ [1174.2, 46, 622, 20],
+ [1190.1, 44, 626, 30],
+ [1207, 43, 628, 40],
+ [1223.6, 41, 632, 50],
+ [1240.6, 40, 634, 60],
+ [1256.3, 39, 636, 70],
+ [1272.7, 38, 638, 80],
+ [1289.6, 36, 642, 90],
+ [1305.9, 35, 644, 100],
+ [1323.5, 34, 646, 110],
+ [1340, 33, 648, 120],
+ [1357, 32, 650, 130],
+ [1373.7, 31, 652, 140],
+ [1390.2, 30, 654, 150],
+ [1407, 29, 656, 160],
+ [1424.1, 28, 658, 170],
+ [1440.1, 27, 660, 180],
+ [1456.9, 26, 662, 190],
+ [1473.5, 25, 664, 200],
+ [1490.2, 25, 664, 210],
+ [1506.9, 24, 666, 220],
+ [1523.3, 23, 668, 230],
+ [1540.4, 22, 670, 240],
+ [1557.1, 22, 670, 230],
+ [1573.3, 21, 672, 220],
+ [1589.9, 20, 674, 210],
+ [1606.4, 20, 674, 200],
+ [1623.1, 19, 676, 190],
+ [1639.7, 18, 678, 180],
+ [1656.4, 18, 678, 170],
+ [1672.8, 17, 680, 160],
+ [1689.6, 16, 682, 150],
+ [1706.3, 16, 682, 140],
+ [1722.8, 15, 684, 130],
+ [1739.5, 15, 684, 120],
+ [1756.2, 14, 686, 110],
+ [1772.9, 14, 686, 100],
+ [1789, 13, 688, 90],
+ [1806.5, 13, 688, 80],
+ [1822.4, 13, 688, 70],
+ [1840, 12, 690, 60],
+ [1857.7, 12, 690, 50],
+ [1873.1, 11, 692, 40],
+ [1889.6, 11, 692, 30],
+ [1906.1, 11, 692, 20],
+ [1923.5, 10, 694, 10],
+ [1939.9, 10, 694, 0],
+ [1956.2, 10, 695, 10],
+ [1972.5, 9, 696, 20],
+ [1990.1, 9, 696, 30],
+ [2006.6, 9, 696, 40],
+ [2023.2, 8, 698, 50],
+ [2039.7, 8, 698, 60],
+ [2056.4, 8, 698, 70],
+ [2072.8, 7, 700, 80],
+ [2089.4, 7, 700, 90],
+ [2106.7, 7, 700, 100],
+ [2123.3, 7, 700, 110],
+ [2139.9, 6, 702, 120],
+ [2156.6, 6, 702, 130],
+ [2173.2, 6, 702, 140],
+ [2189.7, 6, 702, 150],
+ [2207.1, 6, 702, 160],
+ [2223.5, 5, 704, 170],
+ [2240.2, 5, 704, 180],
+ [2256.3, 5, 704, 190],
+ [2273.7, 5, 704, 200],
+ [2290.6, 5, 704, 210],
+ [2307.4, 5, 704, 220],
+ [2324.2, 4, 706, 230],
+ [2342.3, 4, 706, 240],
+ [2358.4, 4, 706, 230],
+ [2374.4, 4, 706, 220],
+ [2390.5, 4, 706, 210],
+ [2407.4, 4, 706, 200],
+ [2424.2, 4, 707, 190],
+ [2441, 3, 708, 180],
+ [2457.5, 3, 708, 170],
+ [2474, 3, 708, 160],
+ [2491.8, 3, 708, 150],
+ [2510.3, 3, 708, 140],
+ [2529.3, 3, 708, 130],
+ [2547, 3, 708, 120],
+ [2563.7, 3, 708, 110],
+ [2578.2, 3, 708, 100],
+ [2592.6, 2, 710, 90],
+ [2608.6, 2, 710, 80],
+ [2622.9, 2, 710, 70],
+ [2639.5, 2, 710, 60],
+ [2656.4, 2, 710, 50],
+ ],
+};
diff --git a/internal/interaction-harness/src/busy.unjudged.test.ts b/internal/interaction-harness/src/busy.unjudged.test.ts
new file mode 100644
index 0000000000..81730b6a7c
--- /dev/null
+++ b/internal/interaction-harness/src/busy.unjudged.test.ts
@@ -0,0 +1,109 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file busy.unjudged.test.ts
+ * @input busy.ts, and a recorded Chromium cast (busy.unjudged.fixture.ts)
+ * @output Unit tests of `judgeEveryFrame`: a frame the cast could not judge
+ * fails by name, and a frozen or main-thread component stays a red
+ * @position Harness unit tests, beside busy.control.test.ts
+ */
+
+import {describe, expect, it} from 'vitest';
+
+import {
+ BusyFrameUnjudgedError,
+ BusyWindowTooLateError,
+ busyWindowProof,
+} from './busy';
+import {ZOOM_START_CAST} from './busy.unjudged.fixture';
+import type {TrackedFrame} from './frames';
+
+const {block, frames} = ZOOM_START_CAST;
+
+/** The photo's frames, with its top edge at each frame's `y`. */
+function photo(
+ topAt: (t: number, y: number) => number = (_t, y) => y,
+): TrackedFrame[] {
+ return frames.map(([t, y, h]) => ({
+ t: block.from + t,
+ box:
+ y == null || h == null
+ ? null
+ : {x: 0, y: topAt(t, y), width: 100, height: h},
+ pixels: 1,
+ step: {x: 1, y: 1},
+ }));
+}
+
+const control: TrackedFrame[] = frames.map(([t, , , x]) => ({
+ t: block.from + t,
+ box: x == null ? null : {x, y: 0, width: 12, height: 12},
+ pixels: x == null ? 0 : 144,
+}));
+
+const options = {axis: 'y', settledWithin: 24, control} as const;
+
+describe('busyWindowProof with judgeEveryFrame', () => {
+ it('passes the recorded cast with one frame excused as under a step, without it', () => {
+ const proof = busyWindowProof(photo(), block, options);
+ expect(proof.verdict.failures).toEqual([]);
+ expect(proof.control?.belowStep).toBe(1);
+ });
+
+ it('names that frame as too little to judge, with it', () => {
+ let thrown: unknown;
+ try {
+ busyWindowProof(photo(), block, {...options, judgeEveryFrame: true});
+ } catch (error) {
+ thrown = error;
+ }
+ expect(thrown).toBeInstanceOf(BusyFrameUnjudgedError);
+ const {frames: unjudged, message} = thrown as BusyFrameUnjudgedError;
+ expect(unjudged).toHaveLength(1);
+ expect(unjudged[0].atMs).toBeCloseTo(38.9, 0);
+ expect(unjudged[0].movePx).toBeLessThan(1);
+ expect(unjudged[0].stepPx).toBe(1);
+ expect(message).toContain('too little to judge');
+ });
+
+ it('passes the cast when that frame shows its step', () => {
+ const proof = busyWindowProof(
+ photo((t, y) => (Math.abs(t - 38.9) < 0.05 ? y - 1 : y)),
+ block,
+ {...options, judgeEveryFrame: true},
+ );
+ expect(proof.verdict.failures).toEqual([]);
+ expect(proof.control?.belowStep).toBe(0);
+ });
+
+ it('keeps a frozen photo a red on the photo', () => {
+ // The top edge holds from +100 ms to +600 ms, then jumps to the curve.
+ const frozenFrom = frames.find(([t]) => t >= 100);
+ const held = frozenFrom?.[1] ?? 0;
+ const proof = busyWindowProof(
+ photo((t, y) => (t >= 100 && t < 600 ? held : y)),
+ block,
+ {...options, judgeEveryFrame: true},
+ );
+ expect(proof.verdict.failures.length).toBeGreaterThan(0);
+ });
+
+ it('keeps a main-thread zoom a red on the photo', () => {
+ // A main-thread zoom does not move until the block ends.
+ const rest = frames[0][1] ?? 0;
+ let failures: readonly string[];
+ try {
+ failures = busyWindowProof(
+ photo((t, y) => (t < block.to - block.from ? rest : y)),
+ block,
+ {...options, judgeEveryFrame: true},
+ ).verdict.failures;
+ } catch (error) {
+ // A component that never moved in the window has settled before it.
+ expect(error).not.toBeInstanceOf(BusyFrameUnjudgedError);
+ expect(error).toBeInstanceOf(BusyWindowTooLateError);
+ failures = [(error as Error).message];
+ }
+ expect(failures.length).toBeGreaterThan(0);
+ });
+});
diff --git a/packages/core/src/Lightbox/__tests__/LightboxZoom.interaction.browser.spec.ts b/packages/core/src/Lightbox/__tests__/LightboxZoom.interaction.browser.spec.ts
index ec98d69a79..3ad7af116a 100644
--- a/packages/core/src/Lightbox/__tests__/LightboxZoom.interaction.browser.spec.ts
+++ b/packages/core/src/Lightbox/__tests__/LightboxZoom.interaction.browser.spec.ts
@@ -27,7 +27,10 @@ import {
armHold,
blockMainThread,
BusyWindowTooLateError,
+ BusyFrameUnjudgedError,
busyWindowProof,
+ type BusyProof,
+ type UnjudgedFrame,
castStoryboard,
compareCurve,
countBetween,
@@ -1081,44 +1084,64 @@ test('the double-tap zoom keeps advancing every frame while the main thread is b
const castFrames = await cast.stop();
const tracked = await trackMarker(page, castFrames);
const control = await trackMarker(page, castFrames, {rgb: CONTROL_RGB});
- const proof = busyWindowProof(tracked, block, {
- axis: ZOOM_AXIS,
- settledWithin: ZOOM_SETTLED_PX,
- control,
- });
- await writeEvidence(
- 'busy-main-thread/lightbox-double-tap-zoom',
- {
- [`${testInfo.project.name}.json`]: JSON.stringify(
- {
- block,
- proof,
- frames: tracked.map(f => ({
- t: +(f.t - block.from).toFixed(1),
- y: f.box?.y ?? null,
- h: f.box?.height ?? null,
- })),
- control: control.map(f => ({
- t: +(f.t - block.from).toFixed(1),
- x: f.box?.x ?? null,
- })),
- },
- null,
- 1,
- ),
- },
- testInfo,
- );
- const film = await castStoryboard(page, castFrames, {
- name: 'lightbox-double-tap-zoom-busy-main-thread',
- zero: block.from,
- from: block.from - 40,
- to: proof.judged.to + 40,
- columns: 8,
- cellScale: 0.35,
- data: t => ({h: tracked.find(f => f.t === t)?.box?.height ?? -1}),
- });
- await film.write(testInfo, {block, judged: proof.judged});
+ // The run's frames and storyboard, kept whatever the proof concludes.
+ const record = async (
+ result: {proof: BusyProof} | {unjudged: ReadonlyArray<UnjudgedFrame>},
+ judged: {from: number; to: number},
+ ) => {
+ await writeEvidence(
+ 'busy-main-thread/lightbox-double-tap-zoom',
+ {
+ [`${testInfo.project.name}.json`]: JSON.stringify(
+ {
+ block,
+ ...result,
+ frames: tracked.map(f => ({
+ t: +(f.t - block.from).toFixed(1),
+ y: f.box?.y ?? null,
+ h: f.box?.height ?? null,
+ })),
+ control: control.map(f => ({
+ t: +(f.t - block.from).toFixed(1),
+ x: f.box?.x ?? null,
+ })),
+ },
+ null,
+ 1,
+ ),
+ },
+ testInfo,
+ );
+ const film = await castStoryboard(page, castFrames, {
+ name: 'lightbox-double-tap-zoom-busy-main-thread',
+ zero: block.from,
+ from: block.from - 40,
+ to: judged.to + 40,
+ columns: 8,
+ cellScale: 0.35,
+ data: t => ({h: tracked.find(f => f.t === t)?.box?.height ?? -1}),
+ });
+ await film.write(testInfo, {block, judged});
+ };
+ // Every frame the control moves on is judged by the edge's own step. A
+ // frame the cast's 1 px step cannot show the edge's move on is too little
+ // to judge, and fails by name (`BusyFrameUnjudgedError`). That run keeps its
+ // frames and storyboard too.
+ let proof: BusyProof;
+ try {
+ proof = busyWindowProof(tracked, block, {
+ axis: ZOOM_AXIS,
+ settledWithin: ZOOM_SETTLED_PX,
+ control,
+ judgeEveryFrame: true,
+ });
+ } catch (error) {
+ if (error instanceof BusyFrameUnjudgedError) {
+ await record({unjudged: error.frames}, block);
+ }
+ throw error;
+ }
+ await record({proof}, proof.judged);
// Judged against the control. A two-core runner's software compositor and
// the screencast share the core the block spins on. So every compositor
// animation presents fewer frames there, the control's too. The photo keeps
@@ -1126,7 +1149,9 @@ test('the double-tap zoom keeps advancing every frame while the main thread is b
expect(proof.verdict.failures).toEqual([]);
// The verdict, spelled out. The top edge takes a new position on every
// frame the control moves, with none excused as under a cast step. The
- // control moves on at least the verdict's floor of four frames.
+ // control moves on at least the verdict's floor of four frames. With
+ // `judgeEveryFrame`, an excused frame throws first, so `belowStep` stays a
+ // guard on that option.
expect(proof.control?.movedWith).toBe(proof.control?.moved);
expect(proof.control?.belowStep).toBe(0);
expect(proof.control?.moved).toBeGreaterThanOrEqual(4);