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:
thalladaandClaude Opus 5.5 committed 2026-11-17 16:25:27 -05:00
1 parent 52cb7c2065
commit dbbe3effac
18 files changed
+176 -297

No files matched your search

+5 -11
View File
@@ -4,7 +4,7 @@
* Latencies are measured in the page (keydown timestamp → the frame after the render).
*/
import { expect, test, type Page } from "@playwright/test";
import { command, focusedTitle, idle, jump, keys, openPage, settle, state, writeReport, type Sample } from "./helpers";
import { command, focusedTitle, idle, jump, keys, openPage, paced, settle, state, type Sample, writeReport } from "./helpers";
const titlesUnder = (page: Page, title: string) =>
page.evaluate((t) => {
@@ -39,23 +39,17 @@ test("pre-generated expansions paint within the 50 ms budget", async ({ page })
await open(page);
// One keystroke per frame (about 60 a second, well past any typist). Sent faster than that,
// keys queue behind each other and the measurement becomes the length of the queue.
const keys = async (p: Page, seq: string) => {
for (const k of seq.split(" ")) {
await p.keyboard.press(k);
await p.evaluate(() => new Promise((r) => requestAnimationFrame(() => r(null))));
}
};
// Walk the whole pre-generated outline: open every section, top to bottom, then every note in a few.
for (let i = 0; i < 70; i++) await keys(page, "j l");
for (let i = 0; i < 70; i++) await paced(page, "j l");
const opened = await page.locator(".node.open").count();
expect(opened).toBeGreaterThan(40);
// Close and reopen subtrees, and step through grains.
await keys(page, "O j l h l i j j i l l Escape Escape");
await paced(page, "O j l h l i j j i l l Escape Escape");
// Open notes in every form from the keyboard.
await jump(page, "Levels of a node");
await keys(page, "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 keys(page, "Tab Enter Tab Enter");
await paced(page, "Tab Enter Tab Enter");
await expect(page.locator(".gloss").first()).toBeVisible();
await expect(page.locator(".inset").first()).toBeVisible();
await expect(page.locator(".sidenote").first()).toBeVisible();