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
+2
-15
@@ -5,7 +5,7 @@
|
||||
* the address it would have gone to.
|
||||
*/
|
||||
import { expect, test, type Page } from "@playwright/test";
|
||||
import { autoLayout, command, focusedTitle, jump, keys, seedLinks, selected, settle, state, visit, writeReport, type Sample } from "./helpers";
|
||||
import { command, focusedTitle, jump, keys, paced, seedLinks, selected, settle, state, type Sample, visit, wide, writeReport } from "./helpers";
|
||||
|
||||
/** The panes' titles, left to right: a node's title, or W:article for a Wikipedia pane. */
|
||||
const trail = (page: Page) =>
|
||||
@@ -29,13 +29,6 @@ async function column(page: Page, path = "Fixed points") {
|
||||
await page.waitForFunction(() => (globalThis as any).__ie?.ready);
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
}
|
||||
async function wide(page: Page, path = "Fixed points") {
|
||||
await page.setViewportSize({ width: 1920, height: 1080 });
|
||||
await autoLayout(page);
|
||||
await visit(page, path);
|
||||
await page.waitForSelector(".strip .pane");
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
}
|
||||
/** Open a section in panes and select the first marked span in its text. */
|
||||
async function inPane(page: Page, title: string, words: string) {
|
||||
await jump(page, title);
|
||||
@@ -507,12 +500,6 @@ test("a hostile article cannot run script or load anything from elsewhere, in a
|
||||
});
|
||||
|
||||
test("keypress → paint stays within one frame budget through links and articles, in panes and in the column", async ({ page }) => {
|
||||
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))));
|
||||
}
|
||||
};
|
||||
const report: Record<string, unknown> = {};
|
||||
for (const view of ["panes", "column"] as const) {
|
||||
if (view === "panes") await wide(page);
|
||||
@@ -521,7 +508,7 @@ test("keypress → paint stays within one frame budget through links and article
|
||||
const measure = async (passes: number) => {
|
||||
await page.evaluate(() => ((globalThis as any).__ie.samples.length = 0));
|
||||
for (let pass = 0; pass < passes; pass++) {
|
||||
await paced(seq);
|
||||
await paced(page, seq);
|
||||
await page.waitForTimeout(50);
|
||||
}
|
||||
const samples: Sample[] = await state(page, (s) => s.samples);
|
||||
|
||||
Reference in new issue
Block a user