Tests: shared helpers once in helpers.ts, not copied into each spec
- The panes view's pane, tid, frames, still, library, clickOpen and noFaults were copied into colours, panes3, panes4 (and partly forks, libraries, phone) with identical bodies; wide() into annotate and links; linksHere into review and reviewer; the one-key-per-frame loop of the latency tests into six specs (paced). They live in helpers.ts. The specs whose own still() or open() differ keep theirs. - `:` + type + Enter written out where command() does the same, the newDoc alias of addTop, nodes' copy of focusedTitle, forks.test's four isStr guards, an unused fixture and `void request`, Math.max(x, x). - panes3 and panes4 no longer call themselves rounds three and four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
52cb7c2065
commit
dbbe3effac
18 files changed
+176
-297
No files matched your search
+5
-12
@@ -5,7 +5,7 @@
|
||||
* (z) and start from it, as the first pane.
|
||||
*/
|
||||
import { expect, test, type Page } from "@playwright/test";
|
||||
import { autoLayout, command, focusedTitle, idle, jump, keys, openAt, settle, state, writeReport, type Sample } from "./helpers";
|
||||
import { autoLayout, command, focusedTitle, idle, jump, keys, openAt, paced, settle, state, type Sample, writeReport } from "./helpers";
|
||||
|
||||
/** Each pane's title and box, left to right. */
|
||||
const panes = (page: Page) =>
|
||||
@@ -277,24 +277,17 @@ test("editing in a pane: c, type, Esc", async ({ page }) => {
|
||||
|
||||
test("keypress → paint stays within the 50 ms budget in panes", async ({ page }) => {
|
||||
await open(page);
|
||||
// One keystroke per frame, as in the column test.
|
||||
const paced = async (seq: string) => {
|
||||
for (const k of seq.split(" ")) {
|
||||
await page.keyboard.press(k);
|
||||
await page.evaluate(() => new Promise((r) => requestAnimationFrame(() => r(null))));
|
||||
}
|
||||
};
|
||||
// Walk down and across: open each top-level section, then three of its children in turn,
|
||||
// read a sentence of the last, close back up and move to the next section.
|
||||
for (let pass = 0; pass < 2; pass++) {
|
||||
await paced("O");
|
||||
for (let i = 0; i < 10; i++) await paced(`${i === 0 ? "l" : "j"} l l l j l j l i j Escape h h`);
|
||||
await paced(page, "O");
|
||||
for (let i = 0; i < 10; i++) await paced(page, `${i === 0 ? "l" : "j"} l l l j l j l i j Escape h h`);
|
||||
}
|
||||
// Open notes in a pane from the keyboard.
|
||||
await jump(page, "Levels of a node");
|
||||
await paced("Tab Enter Tab Enter Tab Enter Escape Escape");
|
||||
await paced(page, "Tab Enter Tab Enter Tab Enter Escape Escape");
|
||||
await jump(page, "Expansion by depth");
|
||||
await paced("l Tab Enter Tab Enter Escape Escape");
|
||||
await paced(page, "l Tab Enter Tab Enter Escape Escape");
|
||||
const samples: Sample[] = await state(page, (s) => s.samples);
|
||||
const ms = samples.filter((x) => x.what !== "first-token").map((x) => x.ms).sort((a, b) => a - b);
|
||||
const pct = (p: number) => ms[Math.min(ms.length - 1, Math.floor(ms.length * p))];
|
||||
|
||||
Reference in new issue
Block a user