testkit: comments describe the code, not its history; drop Checks.skip
commit 7defb72359d7b874b42509fac77e6a98e1f6134f · parent 2203cbd09d
· browse this tree
Ximianth, 2026-10-10 05:49:15 UTC
The header comments and the wheel/shot comments talked about the scenarios and drivers this code was lifted from. In a published package that's nobody; say what the thing is. Checks.skip printed a line and recorded nothing, so a scenario that skipped everything reported 0/0 and exited 0. Nothing calls it; gone.
diff --git a/packages/yukey-testkit/src/cdp.ts b/packages/yukey-testkit/src/cdp.ts index ee47470..63956ba 100644 --- a/packages/yukey-testkit/src/cdp.ts +++ b/packages/yukey-testkit/src/cdp.ts @@ -1,12 +1,11 @@ // A small typed CDP client: JSON-RPC over a websocket to one page target. // -// This is the shared core of the e2e scenarios: TRUSTED input dispatch -// (Input.dispatchKeyEvent / Input.dispatchMouseEvent -- synthetic DOM events -// cannot drive real focus traversal, real typing, or real hover) plus -// Runtime.evaluate state reads between steps. +// Trusted input dispatch (Input.dispatchKeyEvent / Input.dispatchMouseEvent -- +// synthetic DOM events cannot drive real focus traversal, real typing, or real +// hover) plus Runtime.evaluate state reads between steps. // Runs on Node 22's built-in WebSocket; no dependencies. -// Key definitions for the non-printable keys the scenarios use: +// The named (non-printable) keys that key() accepts: // windowsVirtualKeyCode + code, exactly what a real keyboard produces. const KEYDEFS: Record<string, [number, string]> = { Tab: [9, "Tab"], @@ -212,8 +211,7 @@ export class Cdp { await this.mouseUp(x, y, button); } - // A trusted wheel tick at (x, y). Positive deltaY scrolls down (the map - // reads that as zoom OUT); negative zooms in, anchored under the cursor. + // A trusted wheel tick at (x, y). Positive deltaY scrolls down. async wheel(x: number, y: number, deltaY: number): Promise<void> { await this.cmd("Input.dispatchMouseEvent", { type: "mouseWheel", diff --git a/packages/yukey-testkit/src/checks.ts b/packages/yukey-testkit/src/checks.ts index 3a632e8..948b2da 100644 --- a/packages/yukey-testkit/src/checks.ts +++ b/packages/yukey-testkit/src/checks.ts @@ -1,6 +1,5 @@ -// The check collector: the PASS/FAIL line protocol every scenario reports through. -// Same shape as the drivers always had: each check prints immediately, -// failures carry their detail, and the run summarizes at the end. +// The check collector: a PASS/FAIL line protocol. Each check prints +// immediately, failures carry their detail, and the counts are read at the end. import { mkdirSync, writeFileSync } from "node:fs"; import { join } from "node:path"; @@ -26,10 +25,6 @@ export class Checks { console.log((cond ? "PASS " : "FAIL ") + name + (detail !== "" && !cond ? ` ${detail}` : "")); } - skip(name: string, why: string): void { - console.log(`SKIP ${name} (${why})`); - } - get passed(): number { return this.results.filter((r) => r.ok).length; } @@ -43,8 +38,8 @@ export class Checks { } } -// Screenshots were stage evidence in the original drivers, never assertions: -// they write only when YUKEY_E2E_SHOTS_DIR names a destination, and no-op otherwise. +// A screenshot for a human to look at later, never an assertion: +// writes only when YUKEY_E2E_SHOTS_DIR names a destination, and no-ops otherwise. export async function shot(cdp: Cdp, name: string): Promise<void> { const dir = process.env.YUKEY_E2E_SHOTS_DIR; if (dir === undefined || dir === "") return; diff --git a/packages/yukey-testkit/src/sleep.ts b/packages/yukey-testkit/src/sleep.ts index 227aeb9..78dacf2 100644 --- a/packages/yukey-testkit/src/sleep.ts +++ b/packages/yukey-testkit/src/sleep.ts @@ -1,3 +1,2 @@ -// A promise that resolves after ms. Scenarios use it to poll between steps; -// the harness that launches Chrome uses it the same way. +// A promise that resolves after ms, for polling loops between steps. export const sleep = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms));