Files
hyperframes/packages/studio/tests/e2e/edit-accuracy/smoothness.test.mjs
T
James RussoandClaude Opus 5.5 a59a422195 perf(studio): speed up the edit accuracy bench and trim its grid (#5569)
* perf(studio): cut fixed waits from the edit accuracy bench

- Settle window 1000 ms -> 500 ms (EDIT_ACCURACY_STILL_MS overrides it).
- Drop the fixed 1 s sleep in openStudio; the settle that follows is the
  real readiness wait.
- Mark composition hosts data-no-timeline in the producer's page when the
  saved project has no GSAP timeline, so the render skips the 10 s
  playerReadyTimeout wait.
- Run the blank-page smoothness control once per gesture per browser.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(studio): trim the edit accuracy grid to 741 cases

Drops zoom 200, the pct and center placements, and nested keyframed cases
from the grid (2061 -> 741 cases; the pr slice 435 -> 265). Drag paths and
sequences are unchanged.

baseline.json loses the 1320 removed cases. The ratchet no longer counts a
base case that the head's baseline.json does not hold, and lists such cases
as retired, so removing cases from the grid and baseline.json together does
not fail the gate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(studio): measure the blank-page control again after it fails

The control is cached per browser and gesture, so a rejected measurement stayed
cached and failed every later case with that gesture before Studio was tested.
Drop a rejected entry so the next case measures again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(studio): keep the nested keyframed resize cases in the edit accuracy PR slice

Two historical gate runs failed only on resize-scale-px-r0-nested-z100-on,
which the trim removed, so the PR slice would have passed that build. Keep
the nested keyframed resize on a keyframe at zoom 100 without rotation, one
case per GSAP mode, with their baseline entries. PR slice 265 -> 271 cases,
full grid 741 -> 747.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 03:46:17 +00:00

44 lines
1.7 KiB
JavaScript

import { describe, expect, it } from "vitest";
import { controlDrag, smoothness } from "./case.mjs";
const thread = { pid: 1, tid: 2 };
const mark = { name: "edit-bench-end", cat: "blink.user_timing", ts: 1_000_000, ...thread };
const task = (ts, dur, tdur) => ({ name: "RunTask", ph: "X", ts, dur, tdur, ...thread });
// Frame stamps 50, 66 and 82 ms before a mark at 100 ms: trace time 950, 966 and 982 ms.
const rec = (trace) => ({ frames: [50, 66, 82], mark: 100, long: [], trace });
describe("smoothness work per frame", () => {
it("measures the frames when a task outside them lacks thread time", () => {
const s = smoothness(rec([mark, task(900_000, 10_000), task(960_000, 4_000, 2_000)]));
expect(s.work).toEqual([2, 0]);
expect(s.wallTimed).toBe(0);
});
it("counts a task inside the frames that lacks thread time at its wall time", () => {
const s = smoothness(rec([mark, task(960_000, 4_000)]));
expect(s.work).toEqual([4, 0]);
expect(s.wallTimed).toBe(1);
});
it("leaves the work unknown without the end mark", () => {
const s = smoothness(rec([task(960_000, 4_000, 4_000)]));
expect(s.work).toBeNull();
expect(s.unknown).toBe("no end mark in the trace");
});
});
describe("controlDrag", () => {
it("measures again after a failed control instead of failing every later case", async () => {
let calls = 0;
const browser = {
createBrowserContext: async () => {
calls += 1;
throw new Error(`blank page ${calls} failed`);
},
};
await expect(controlDrag(browser, "move")).rejects.toThrow("blank page 1 failed");
await expect(controlDrag(browser, "move")).rejects.toThrow("blank page 2 failed");
expect(calls).toBe(2);
});
});