@geonosis/walk 3.6.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @geonosis/walk
2
2
 
3
+ ## 3.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0736554: A report's `webgl` says `software`: whether the renderer is SwiftShader, llvmpipe or softpipe. `caveat` alone could not say so: on Linux ARM, SwiftShader grants it.
8
+ - 062da98: A `stillness` probe, the fifteenth, filed under a class of its own. It watches a page from before its first paint and fails on any layout shift, on a hover that moves or resizes a control or changes the page's height, on horizontal overflow, and on a console error, an uncaught error or a failed request. It needs no list and runs only when a walk names it, so a walk with no `probes` runs what it ran before. `hover` narrows the controls it hovers and `ignore` lists errors a repo accepts. `Probe` gains `prepare`, which the walk calls before `page.goto`, and `optIn`, which keeps a probe out of `DEFAULT_PROBES`; a page driven by hand calls `prepare` itself, and `stillness` refuses one that did not.
9
+
10
+ ### Patch Changes
11
+
12
+ - 1ca491e: A `Mailer` answers with a receipt naming its provider. A `told` report and a secrets write may answer anything. The walk's shift probe reads a window name with no leading underscores.
13
+ - b2581ec: A walk with `gpu: false` asks Chromium for SwiftShader by name (`--use-angle=swiftshader` beside `--disable-gpu`), so WebGL is drawn in software on Linux as on macOS. On linux-arm64 SwiftShader still grants the performance caveat, so a report says `software` to tell the two apart (see `walk-software`), not `caveat`.
14
+ - @geonosis/base@3.8.0
15
+
16
+ ## 3.7.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 281381c: The walk gains an `axe` probe through `@axe-core/playwright`, an optional peer: `critical` and `serious` violations are findings of class `accessibility-error` (blocking, major), `moderate` and `minor` of class `accessibility-warning`, and a missing peer exits 2 naming `npm i -D @axe-core/playwright` (#215, plan 049 T3). The report counts both classes whenever `axe` ran, and the summary names both beside it. The `walkFindings` counter takes `classes: ["accessibility-error"]` and `["accessibility-warning"]`, so a gate can count the errors without the warnings.
21
+ - 2e0aae2: A URL entry takes `scrollTo` and `waitFor`: the walk scrolls to the first and waits for the second before any probe reads the page, and exits 2 naming the selector and the URL when it never appears (#173). The report records `gpu` and what the browser answered for WebGL, caveat, renderer and vendor, so two reports of one page can be compared (#172). The summary names each probe that ran by its id, with its class where the two differ (#174).
22
+
23
+ ### Patch Changes
24
+
25
+ - 8eda0d0: A refusal that names a command spells it the way it was reached. Run through the `geonosis` door, `geonosis walk` and `geonosis review` refuse an unknown flag with `run geonosis walk --help` and `run geonosis review --help`, and `geonosis verify-arch --check` names `geonosis verify-arch --format … --output …` as the command that rewrites a stale drawing; run by their own bins they name those bins as before. The `walkFindings` counter with no walk report says to run `geonosis walk`. Each named the tool's own bin, which under pnpm is a command only where its package is a direct dependency (#68).
26
+ - b505542: A tool run through the door prints its usage the way it was run: `geonosis ratchet --help` says `geonosis ratchet [--cwd <dir>] …`, not `geonosis-ratchet …`, and the same for every tool the door fronts. The door tells the tool in `GEONOSIS_DOOR`, naming the bin it started, so a tool that tool starts in turn keeps its own name. `@geonosis/base/node` exports `doorSpelled`, `doorEnvFor` and `DOOR_ENV`. A tool run by its own bin prints its own name, as before (#68).
27
+ - cc48e0e: The `walkFindings` counter takes `classes: ["content-integrity"]`, the class of the walk's four newest probes (`thin-page`, `empty-section`, `money-format`, `orphan-url`). Before, the counter's own list of classes lacked it, so those findings could be counted only in the total. A test in the kit's repository holds the counter's list to the walk's own list of classes, the one its exported `DefectClass` type is drawn from. The walk's package description counts fourteen probes, thirteen computed-DOM readings and axe's accessibility rules; it counted eight.
28
+ - Updated dependencies [1830b16]
29
+ - Updated dependencies [1dabee8]
30
+ - Updated dependencies [74147f7]
31
+ - Updated dependencies [b505542]
32
+ - @geonosis/base@3.7.0
33
+
3
34
  ## 3.6.1
4
35
 
5
36
  This package had no change of its own in 3.6.1. What the group changed under that number is in `GROUP-CHANGELOG.md`, in the `@geonosis/cli` package.
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  Through the front door: `geonosis walk` — the metapackage pins this and every other kit tool at ONE
4
4
  version, and passes the exit code through unchanged.
5
5
 
6
- The customer walk as a gate. Thirteen computed-DOM probes over a list of URLs, one JSON report, and
7
- an exit code that tells a run that could not happen from a page that was clean.
6
+ The customer walk as a gate. Fourteen computed-DOM probes and an `axe` probe over a list of URLs,
7
+ one JSON report, and an exit code that tells a run that could not happen from a page that was clean.
8
8
 
9
9
  It exists because a screenshot lies. A cream chip on a cream page photographs exactly like a chip
10
10
  that is there; thirteen copies of one placeholder SVG photograph as thirteen icons; a full product
@@ -44,7 +44,7 @@ pages walked before it are not thrown away: they are written beside the report a
44
44
  `<report>.partial.json` (`stoppedAt` names the URL), and the report itself, the one a ratchet
45
45
  counter reads, is left absent.
46
46
 
47
- ## The thirteen probes
47
+ ## The probes
48
48
 
49
49
  | id | What it reads | Needs |
50
50
  |---|---|---|
@@ -61,18 +61,36 @@ counter reads, is left absent.
61
61
  | `empty-section` | A container carrying a heading and no body text and no media — a promise with nothing under it. | **`selector`** |
62
62
  | `money-format` | Money-shaped strings in the page's text nodes, against the shapes this repo accepts. `£24` beside `£24.00` is two answers to what a price looks like here. | **`accept`** |
63
63
  | `orphan-url` | Which walked URLs nothing in the walk links to. The one probe with a report-level half: `run` records each page's links, `finish` names the pages nothing pointed at. | nothing (`entry` lists the deliberately unlinked) |
64
-
65
- The nine in bold **refuse the run** when the option is missing, naming it (D-031). None of them can
66
- have a default that is true of a repo which has not configured it — what a company can stand behind,
67
- which entities exist, what its signed-in header looks like, which words mean "operations", where its
68
- buy box is, what its error surface says, how much a page owes a reader, which containers are
69
- sections, what a price looks like — and a probe that ran with an empty list would report a clean
70
- page for every repo that never set one up.
71
-
72
- The last four are the `content-integrity` class: a page that renders correctly and says nothing.
64
+ | `stillness` | A layout-shift observer installed before the first paint, read after a scroll through the page; each control's box and the page's height before and during a hover; `scrollWidth` against the viewport; console errors, uncaught errors and failed requests. Fires on any shift, any hover that moves or resizes a control or changes the page's height, any horizontal overflow, and any error. | nothing (`hover` is a selector, `ignore` a list of patterns); runs only when named |
65
+ | `axe` | Deque's axe rules, run through `@axe-core/playwright` on the page as rendered. One finding per violated rule, at the rule's impact. | **`@axe-core/playwright`**, an optional peer |
66
+
67
+ The ten in bold **refuse the run** when the option or the peer is missing, naming it (D-031). None
68
+ of the nine options can have a default that is true of a repo which has not configured it — what a
69
+ company can stand behind, which entities exist, what its signed-in header looks like, which words
70
+ mean "operations", where its buy box is, what its error surface says, how much a page owes a reader,
71
+ which containers are sections, what a price looks like — and a probe that ran with an empty list
72
+ would report a clean page for every repo that never set one up.
73
+
74
+ `axe` files `critical` as a `blocking` and `serious` as a `major` finding of class
75
+ `accessibility-error`, and `moderate` and `minor` as `minor` findings of class
76
+ `accessibility-warning`, so a ratchet counter can count the errors without the warnings. With the
77
+ peer missing, the walk exits 2 naming the install command, `npm i -D @axe-core/playwright`, and does
78
+ not skip the probe in silence. A walk that names no probes does not run it.
79
+
80
+ Four of the others are the `content-integrity` class: a page that renders correctly and says nothing.
73
81
  Four defects of one audit were filed under `fabricated-claim`'s forbidden-string engine for want of
74
82
  it, which is one class borrowing another's mechanism.
75
83
 
84
+ `stillness` needs nothing from the repo and still runs only when a walk names it, so a walk with no
85
+ `probes` reads a repo that upgraded the same as before. It reads what a screenshot cannot: a hover
86
+ that lifts a button by a `transform` records no layout shift, so each control is measured with the
87
+ pointer away and with the pointer on it, and an element at the page's corner gets the opposite
88
+ corner as the pointer's resting place. Its default `hover` selector is every link, button and form
89
+ control; on a page with hundreds of them, name the ones that matter. It scrolls and hovers the page,
90
+ so list it last in `probes`: a page that mounts content on scroll reads differently to any probe
91
+ after it. A status the walk list declares stays `link-integrity`'s and `error-page-status`'s to
92
+ judge, and the page's own document is not counted as a failed request.
93
+
76
94
  ## Configuration
77
95
 
78
96
  Everything lives in the `walk` block of `geonosis.json`; the command line wins where they overlap.
@@ -83,7 +101,12 @@ Everything lives in the `walk` block of `geonosis.json`; the command line wins w
83
101
  "urls": [
84
102
  "http://localhost:3000/",
85
103
  "http://localhost:3000/products/kraft-mailer-box",
86
- { "url": "http://localhost:3000/does-not-exist/", "status": 404 }
104
+ { "url": "http://localhost:3000/does-not-exist/", "status": 404 },
105
+ {
106
+ "url": "http://localhost:3000/designer/",
107
+ "scrollTo": "#demo",
108
+ "waitFor": "#demo .designer__layout"
109
+ }
87
110
  ],
88
111
  "versionKey": "release-check",
89
112
  "viewport": { "width": 1440, "height": 900 },
@@ -102,6 +125,13 @@ Everything lives in the `walk` block of `geonosis.json`; the command line wins w
102
125
  geonosis-walk [url…] [--report <path>] [--config <path>] [--viewport WIDTHxHEIGHT] [--probe <id>]… [--version-key <key>] [--no-gpu]
103
126
  ```
104
127
 
128
+ A URL entry takes `scrollTo` and `waitFor`, two CSS selectors, for a page that mounts its content
129
+ when a section scrolls into view. The walk scrolls `scrollTo` into view, then waits for `waitFor` to
130
+ be in the page, before any probe reads it; a page that waits for an IntersectionObserver is
131
+ otherwise read unmounted and reported clean. A selector that never appears within ten seconds stops
132
+ the walk at that page and exits 2, naming the selector and the URL: a walk that cannot measure has
133
+ not passed.
134
+
105
135
  `versionKey` (or `--version-key`) sends `Cloudflare-Workers-Version-Key: <key>` with every request
106
136
  to the origin of each walked page, including the HEAD requests `link-integrity` makes, and to no
107
137
  other origin. During a gradual deployment on Workers, Cloudflare routes each request to a version by
@@ -115,8 +145,8 @@ asks `failIfMajorPerformanceCaveat` even with no graphics processor, which Chrom
115
145
  false` (or `--no-gpu`) walks as a visitor with no graphics processor, so a page that offers a
116
146
  fallback for that refusal is walked on its fallback.
117
147
 
118
- With no `probes` the walk runs the three that need no list. A mobile pass is the same command with
119
- `--viewport 390x844`.
148
+ With no `probes` the walk runs the four that need no list, leaving out `stillness`, which is opt-in.
149
+ A mobile pass is the same command with `--viewport 390x844`.
120
150
 
121
151
  ## The report
122
152
 
@@ -124,6 +154,8 @@ With no `probes` the walk runs the three that need no list. A mobile pass is the
124
154
  {
125
155
  "startedAt": "…", "finishedAt": "…",
126
156
  "viewport": { "width": 390, "height": 844 },
157
+ "gpu": true,
158
+ "webgl": { "available": true, "caveat": "granted", "renderer": "ANGLE (…)", "software": false, "vendor": "Google Inc. (…)" },
127
159
  "probes": ["buy-box-above-fold"],
128
160
  "counts": { "buy-box-above-fold": 1 },
129
161
  "pages": [{ "url": "…", "status": 200, "findings": [
@@ -134,8 +166,17 @@ With no `probes` the walk runs the three that need no list. A mobile pass is the
134
166
  }
135
167
  ```
136
168
 
169
+ `gpu` is whether the walk launched with a graphics processor, and `webgl` is what the browser
170
+ answered for WebGL: `caveat` is `granted` or `refused` for a context asking
171
+ `failIfMajorPerformanceCaveat`, `renderer` and `vendor` come from the `WEBGL_debug_renderer_info`
172
+ extension (`null` when the browser does not expose it), `software` is whether that renderer is
173
+ SwiftShader, llvmpipe or softpipe rather than a GPU, and `{ "available": false }` means no WebGL
174
+ context at all. Two reports of one page are comparable only when these agree.
175
+
137
176
  `counts` is keyed by the classes that RAN, so a zero means "probed for, found none" and an absent
138
- class was never looked for. `@geonosis/ratchet`'s `walkFindings` counter reads this file and refuses
177
+ class was never looked for. The summary line the walk prints says the same: `<ran> of <shipped> probe(s) ran:`,
178
+ each probe that ran by its id, with its classes beside it where they are not the id
179
+ (`axe (accessibility-error, accessibility-warning)`), then the probes it never looked for. `@geonosis/ratchet`'s `walkFindings` counter reads this file and refuses
139
180
  when it is missing or unparsable, which is the same rule as the exit code: a gate that cannot
140
181
  measure has not passed.
141
182
 
@@ -162,13 +203,17 @@ const findings = await probeById('ops-leakage').run(page, {
162
203
  `status` is the page's own response status, not a second request: `error-page-status` asks whether
163
204
  the status agrees with the body, and asking the server again asks a different question.
164
205
 
206
+ `stillness` has to watch the page from the start, so call `await probeById('stillness').prepare?.(page)`
207
+ before `page.goto`. Its `run` refuses a page that was not prepared: a page opened unwatched would
208
+ read as still.
209
+
165
210
  ## What this is not
166
211
 
167
- A green report is not a clean surface. Twelve of the thirteen probes came from hand audits of one
168
- storefront, the largest holding 36 defects; six are reproduced by a probe alone, sixteen partially,
169
- and fourteen — five product tables that disagree, a cart that re-prices what the product page
170
- quoted, copy promising a control nobody built, four levels of taxonomy for fourteen products — are
171
- invisible to any browser probe there could be. Those stay the walker's judgement. The thirteenth
172
- came from a production incident instead, which is how the list is meant to grow. The reasoning,
173
- defect by defect, is in
212
+ A green report is not a clean surface. Twelve of the fourteen computed-DOM probes came from hand
213
+ audits of one storefront, the largest holding 36 defects; six are reproduced by a probe alone,
214
+ sixteen partially, and fourteen — five product tables that disagree, a cart that re-prices what the
215
+ product page quoted, copy promising a control nobody built, four levels of taxonomy for fourteen
216
+ products — are invisible to any browser probe there could be. Those stay the walker's judgement. The
217
+ thirteenth came from a production incident instead, which is how the list is meant to grow, and the
218
+ fourteenth from a site's own hand-written walk. The reasoning, defect by defect, is in
174
219
  [`docs/walk-review-inventory-2026-08-30.md`](../../docs/walk-review-inventory-2026-08-30.md).
package/dist/config.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { Viewport } from './types.js';
1
+ import type { PageReady, Viewport } from './types.js';
2
2
  export type WalkConfig = {
3
3
  expected: Record<string, number>;
4
4
  gpu: boolean;
5
5
  options: Record<string, Record<string, unknown>>;
6
6
  probes: string[];
7
+ ready: Record<string, PageReady>;
7
8
  report: string;
8
9
  urls: string[];
9
10
  versionKey?: string;
package/dist/config.js CHANGED
@@ -11,6 +11,7 @@ var WALK_DEFAULT = {
11
11
  gpu: true,
12
12
  options: {},
13
13
  probes: DEFAULT_PROBES.map((one) => one.id),
14
+ ready: {},
14
15
  report: WALK_REPORT,
15
16
  urls: [],
16
17
  viewport: VIEWPORT
@@ -20,7 +21,7 @@ var ABOUT = {
20
21
  options: "object? keyed by probe id; each probe validates its own",
21
22
  probes: "string[]? the probe ids to run",
22
23
  report: "string? where the JSON report is written",
23
- urls: "(string | { url, status? })[]? the pages to walk, and the status a page must answer",
24
+ urls: "(string | { url, status?, scrollTo?, waitFor? })[]? the pages to walk, the status a page must answer, the selector to scroll into view, and the selector to wait for before any probe reads the page",
24
25
  versionKey: "string? sent as Cloudflare-Workers-Version-Key on every request to a walked origin",
25
26
  viewport: 'object? { "width": <number>, "height": <number> }'
26
27
  };
@@ -71,13 +72,24 @@ var readStrings = (value, name, fallback) => {
71
72
  }
72
73
  return value;
73
74
  };
74
- var URL_ENTRY = 'expected a URL, or { "url": <string>, "status"?: <100-599> }';
75
+ var URL_ENTRY = 'expected a URL, or { "url": <string>, "status"?: <100-599>, "scrollTo"?: <selector>, "waitFor"?: <selector> }';
76
+ var ENTRY_KEYS = new Set(["scrollTo", "status", "url", "waitFor"]);
77
+ var readSelector = (entry, key, at) => {
78
+ const selector = entry[key];
79
+ if (selector === undefined)
80
+ return;
81
+ if (typeof selector !== "string" || selector === "") {
82
+ throw new WalkError(`${at}.${key} must be a CSS selector — ${URL_ENTRY}`);
83
+ }
84
+ return selector;
85
+ };
75
86
  var readUrls = (value) => {
76
87
  if (value === undefined)
77
- return { expected: {}, urls: [] };
88
+ return { expected: {}, ready: {}, urls: [] };
78
89
  if (!Array.isArray(value))
79
90
  throw new WalkError(`walk.urls must be a list — ${URL_ENTRY}`);
80
91
  const expected = {};
92
+ const ready = {};
81
93
  const urls = [];
82
94
  for (const [index, entry] of value.entries()) {
83
95
  const at = `walk.urls[${index}]`;
@@ -87,7 +99,7 @@ var readUrls = (value) => {
87
99
  }
88
100
  if (!isRecord(entry))
89
101
  throw new WalkError(`${at} must be a string or an object — ${URL_ENTRY}`);
90
- const unknown = Object.keys(entry).find((key) => key !== "status" && key !== "url");
102
+ const unknown = Object.keys(entry).find((key) => !ENTRY_KEYS.has(key));
91
103
  if (unknown !== undefined)
92
104
  throw new WalkError(`${at}.${unknown} is not a key it takes — ${URL_ENTRY}`);
93
105
  const url = entry.url;
@@ -101,9 +113,17 @@ var readUrls = (value) => {
101
113
  }
102
114
  expected[url] = status;
103
115
  }
116
+ const scrollTo = readSelector(entry, "scrollTo", at);
117
+ const waitFor = readSelector(entry, "waitFor", at);
118
+ if (scrollTo !== undefined || waitFor !== undefined) {
119
+ ready[url] = {
120
+ ...scrollTo === undefined ? {} : { scrollTo },
121
+ ...waitFor === undefined ? {} : { waitFor }
122
+ };
123
+ }
104
124
  urls.push(url);
105
125
  }
106
- return { expected, urls };
126
+ return { expected, ready, urls };
107
127
  };
108
128
  var partialReportPath = (report) => report.endsWith(".json") ? `${report.slice(0, -".json".length)}.partial.json` : `${report}.partial`;
109
129
  var loadWalkConfig = (file) => {
@@ -126,7 +146,7 @@ var loadWalkConfig = (file) => {
126
146
  if (!KNOWN.has(key))
127
147
  throw new WalkError(`walk.${key} is not a key of the walk block`);
128
148
  }
129
- const { expected, urls } = readUrls(block.urls);
149
+ const { expected, ready, urls } = readUrls(block.urls);
130
150
  if (block.gpu !== undefined && typeof block.gpu !== "boolean") {
131
151
  throw new WalkError("walk.gpu must be true or false");
132
152
  }
@@ -138,6 +158,7 @@ var loadWalkConfig = (file) => {
138
158
  gpu: block.gpu ?? true,
139
159
  options: readOptions(block.options),
140
160
  probes: readStrings(block.probes, "probes", WALK_DEFAULT.probes),
161
+ ready,
141
162
  report: typeof block.report === "string" ? block.report : WALK_REPORT,
142
163
  urls,
143
164
  ...block.versionKey === undefined ? {} : { versionKey: block.versionKey },
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { WalkConfig } from './config.js';
2
2
  export { configPath, loadWalkConfig, parseViewport, partialReportPath, WALK_DEFAULT, WALK_REPORT } from './config.js';
3
3
  export { DEFAULT_PROBES, PROBES, probeById } from './probes/index.js';
4
- export type { DefectClass, Finding, PageReport, Probe, ProbeContext, Severity, Viewport, WalkReport } from './types.js';
4
+ export type { DefectClass, Finding, PageReady, PageReport, Probe, ProbeContext, Severity, Viewport, WalkReport, Webgl } from './types.js';
5
5
  export { WalkError, WalkStopped } from './types.js';
6
6
  export type { WalkInput } from './walk.js';
7
7
  export { findingsIn, walk } from './walk.js';
@@ -0,0 +1,12 @@
1
+ import type { AxeBuilder } from '@axe-core/playwright';
2
+ import type { Finding, Probe } from '../types.js';
3
+ type Violation = Awaited<ReturnType<AxeBuilder['analyze']>>['violations'][number];
4
+ type Reported = Pick<Violation, 'help' | 'helpUrl' | 'id' | 'impact'> & {
5
+ nodes: Pick<Violation['nodes'][number], 'target'>[];
6
+ };
7
+ export declare const axeBuilder: (load?: () => Promise<{
8
+ AxeBuilder: typeof AxeBuilder;
9
+ }>) => Promise<typeof AxeBuilder>;
10
+ export declare const axeFindings: (violations: Reported[], url: string) => Finding[];
11
+ export declare const axe: Probe;
12
+ export {};
@@ -0,0 +1,44 @@
1
+ // src/probes/axe.ts
2
+ import { errorMessage } from "@geonosis/base";
3
+ import { WalkError } from "../types.js";
4
+ var INSTALL = "npm i -D @axe-core/playwright";
5
+ var axeBuilder = async (load = () => import("@axe-core/playwright")) => {
6
+ try {
7
+ return (await load()).AxeBuilder;
8
+ } catch (error) {
9
+ throw new WalkError(`axe: @axe-core/playwright is an optional peer of @geonosis/walk and is not installed — ${INSTALL}: ${errorMessage(error)}`);
10
+ }
11
+ };
12
+ var textOf = (target) => typeof target === "string" ? target : target.map(textOf).join(" ");
13
+ var SEVERITY = {
14
+ critical: { class: "accessibility-error", severity: "blocking" },
15
+ minor: { class: "accessibility-warning", severity: "minor" },
16
+ moderate: { class: "accessibility-warning", severity: "minor" },
17
+ serious: { class: "accessibility-error", severity: "major" }
18
+ };
19
+ var axeFindings = (violations, url) => violations.map((violation) => {
20
+ const first = violation.nodes[0]?.target[0];
21
+ return {
22
+ ...SEVERITY[violation.impact ?? "minor"],
23
+ evidence: `${violation.id}: ${violation.help} — ${violation.nodes.length} element(s), ${violation.helpUrl}`,
24
+ ...first === undefined ? {} : { selector: textOf(first) },
25
+ url
26
+ };
27
+ });
28
+ var axe = {
29
+ alsoFilesUnder: ["accessibility-warning"],
30
+ class: "accessibility-error",
31
+ id: "axe",
32
+ needs: async () => {
33
+ await axeBuilder();
34
+ },
35
+ run: async (page, { url }) => {
36
+ const Builder = await axeBuilder();
37
+ return axeFindings((await new Builder({ page }).analyze()).violations, url);
38
+ }
39
+ };
40
+ export {
41
+ axe,
42
+ axeBuilder,
43
+ axeFindings
44
+ };
@@ -1,4 +1,5 @@
1
1
  // src/probes/index.ts
2
+ import { axe } from "./axe.js";
2
3
  import { buyBoxAboveFold } from "./buy-box-above-fold.js";
3
4
  import { emptySection } from "./empty-section.js";
4
5
  import { errorPageStatus } from "./error-page-status.js";
@@ -10,9 +11,11 @@ import { moneyFormat } from "./money-format.js";
10
11
  import { opsLeakage } from "./ops-leakage.js";
11
12
  import { orphanUrl } from "./orphan-url.js";
12
13
  import { placeholderAsset } from "./placeholder-asset.js";
14
+ import { stillness } from "./stillness.js";
13
15
  import { stubOnlyEntity } from "./stub-only-entity.js";
14
16
  import { thinPage } from "./thin-page.js";
15
17
  var PROBES = [
18
+ axe,
16
19
  buyBoxAboveFold,
17
20
  emptySection,
18
21
  errorPageStatus,
@@ -24,6 +27,7 @@ var PROBES = [
24
27
  opsLeakage,
25
28
  orphanUrl,
26
29
  placeholderAsset,
30
+ stillness,
27
31
  stubOnlyEntity,
28
32
  thinPage
29
33
  ];
@@ -34,7 +38,7 @@ var probeById = (id) => {
34
38
  }
35
39
  return probe;
36
40
  };
37
- var DEFAULT_PROBES = PROBES.filter((one) => one.needs === undefined);
41
+ var DEFAULT_PROBES = PROBES.filter((one) => one.needs === undefined && one.optIn !== true);
38
42
  export {
39
43
  DEFAULT_PROBES,
40
44
  PROBES,
@@ -0,0 +1 @@
1
+ export declare const stillness: import('../index.js').Probe;
@@ -0,0 +1,202 @@
1
+ // src/probes/stillness.ts
2
+ import { collect } from "../browser.js";
3
+ import { assertPatterns, stringOption, stringsOption } from "../options.js";
4
+ import { WalkError } from "../types.js";
5
+ import { defineProbe } from "./define.js";
6
+ var HOVERED = 'a[href],button,[role="button"],[role="link"],summary,select,input,textarea';
7
+ var IDLE_TIMEOUT_MS = 5000;
8
+ var ANIMATION_LIMIT_MS = 1000;
9
+ var ABORTED = "net::ERR_ABORTED";
10
+ var NETWORK_ECHO = /^Failed to load resource/;
11
+ var heard = new WeakMap;
12
+ var watchShifts = () => {
13
+ const shifts = [];
14
+ window.geonosisShifts = shifts;
15
+ new PerformanceObserver((list) => {
16
+ for (const entry of list.getEntries()) {
17
+ shifts.push({
18
+ sources: (entry.sources ?? []).flatMap(({ node }) => {
19
+ const element = node?.getAttribute === undefined ? node?.parentElement : node;
20
+ if (element === undefined || element === null)
21
+ return [];
22
+ const testId = element.getAttribute?.("data-testid") ?? "";
23
+ if (element.id !== undefined && element.id !== "")
24
+ return [`#${element.id}`];
25
+ return [testId === "" ? element.nodeName.toLowerCase() : `[data-testid="${testId}"]`];
26
+ }),
27
+ value: entry.value
28
+ });
29
+ }
30
+ }).observe({ buffered: true, type: "layout-shift" });
31
+ };
32
+ var settled = async (limitMs) => {
33
+ await new Promise((done) => {
34
+ requestAnimationFrame(() => {
35
+ requestAnimationFrame(() => {
36
+ done();
37
+ });
38
+ });
39
+ });
40
+ const running = document.getAnimations().filter((one) => one.effect?.getTiming().iterations !== Number.POSITIVE_INFINITY).map((one) => one.finished);
41
+ await Promise.race([
42
+ Promise.allSettled(running),
43
+ new Promise((done) => {
44
+ setTimeout(done, limitMs);
45
+ })
46
+ ]);
47
+ };
48
+ var scrollThrough = async () => {
49
+ const end = document.documentElement.scrollHeight;
50
+ const step = Math.max(1, Math.floor(window.innerHeight * 0.75));
51
+ for (let top = step;top < end; top += step) {
52
+ window.scrollTo({ behavior: "instant", left: 0, top });
53
+ await new Promise((done) => {
54
+ requestAnimationFrame(() => {
55
+ done();
56
+ });
57
+ });
58
+ }
59
+ window.scrollTo({ behavior: "instant", left: 0, top: 0 });
60
+ };
61
+ var overflowOf = () => ({
62
+ clientWidth: document.documentElement.clientWidth,
63
+ scrollWidth: document.documentElement.scrollWidth
64
+ });
65
+ var bringIntoView = (element) => {
66
+ element.scrollIntoView({ behavior: "instant", block: "center" });
67
+ };
68
+ var placementOf = (element) => {
69
+ const { height, left, top, width } = element.getBoundingClientRect();
70
+ const x = left + width / 2;
71
+ const y = top + height / 2;
72
+ const reachable = width > 0 && height > 0 && x >= 0 && y >= 0 && x < window.innerWidth && y < window.innerHeight;
73
+ return reachable ? {
74
+ box: { height, left, top, width },
75
+ pageHeight: document.documentElement.scrollHeight,
76
+ x,
77
+ y
78
+ } : null;
79
+ };
80
+ var spelled = ({ height, left, top, width }) => `${width}×${height} at (${left}, ${top})`;
81
+ var sameBox = (one, other) => one.height === other.height && one.left === other.left && one.top === other.top && one.width === other.width;
82
+ var hoverEvidence = (before, after) => {
83
+ if (after === null)
84
+ return [`went out of reach on hover, from ${spelled(before.box)}`];
85
+ return [
86
+ ...sameBox(before.box, after.box) ? [] : [`moved or resized on hover: ${spelled(before.box)} became ${spelled(after.box)}`],
87
+ ...before.pageHeight === after.pageHeight ? [] : [`changed the page's height on hover: ${before.pageHeight}px became ${after.pageHeight}px`]
88
+ ];
89
+ };
90
+ var restingPoint = ({ height, left, top, width }, viewport) => left <= 0 && top <= 0 && left + width >= 0 && top + height >= 0 ? { x: viewport.width - 1, y: viewport.height - 1 } : { x: 0, y: 0 };
91
+ var hoverOne = async (page, element, viewport) => {
92
+ await element.evaluate(bringIntoView);
93
+ const placed = await element.evaluate(placementOf);
94
+ if (placed === null)
95
+ return [];
96
+ const rest = restingPoint(placed.box, viewport);
97
+ await page.mouse.move(rest.x, rest.y);
98
+ await page.evaluate(settled, ANIMATION_LIMIT_MS);
99
+ const before = await element.evaluate(placementOf);
100
+ if (before === null)
101
+ return [];
102
+ await page.mouse.move(before.x, before.y);
103
+ await page.evaluate(settled, ANIMATION_LIMIT_MS);
104
+ return hoverEvidence(before, await element.evaluate(placementOf));
105
+ };
106
+ var hoverAll = async (page, selector, url, viewport) => {
107
+ const hits = await collect(page, { kind: "links", selector });
108
+ const elements = await page.locator(selector).elementHandles();
109
+ const found = [];
110
+ for (const [index, element] of elements.entries()) {
111
+ const evidence = await hoverOne(page, element, viewport);
112
+ found.push(...evidence.map((line) => ({
113
+ evidence: line,
114
+ ...hits[index] === undefined ? {} : { selector: hits[index].selector },
115
+ severity: "major",
116
+ url
117
+ })));
118
+ }
119
+ await page.mouse.move(0, 0);
120
+ return found;
121
+ };
122
+ var shiftFinding = (shifts, url) => {
123
+ if (shifts.length === 0)
124
+ return [];
125
+ const total = shifts.reduce((sum, one) => sum + one.value, 0);
126
+ const sources = [...new Set(shifts.flatMap((one) => one.sources))];
127
+ return [
128
+ {
129
+ evidence: `${shifts.length} layout shift(s), ${total.toFixed(4)} in all${sources.length === 0 ? "" : `: ${sources.join(", ")}`}`,
130
+ severity: "major",
131
+ url
132
+ }
133
+ ];
134
+ };
135
+ var listen = (page, problems) => {
136
+ page.on("console", (message) => {
137
+ if (message.type() === "error" && !NETWORK_ECHO.test(message.text())) {
138
+ problems.add(`console error: ${message.text()}`);
139
+ }
140
+ });
141
+ page.on("pageerror", (error) => {
142
+ problems.add(`uncaught error: ${error.message}`);
143
+ });
144
+ page.on("response", (response) => {
145
+ const request = response.request();
146
+ const isThePage = request.isNavigationRequest() && request.frame() === page.mainFrame();
147
+ if (response.status() >= 400 && !isThePage) {
148
+ problems.add(`${response.status()} ${response.url()}`);
149
+ }
150
+ });
151
+ page.on("requestfailed", (request) => {
152
+ const reason = request.failure()?.errorText ?? "request failed";
153
+ if (reason !== ABORTED)
154
+ problems.add(`${reason} ${request.url()}`);
155
+ });
156
+ };
157
+ var stillness = defineProbe({
158
+ class: "stillness",
159
+ id: "stillness",
160
+ optIn: true,
161
+ prepare: async (page) => {
162
+ const problems = new Set;
163
+ heard.set(page, problems);
164
+ listen(page, problems);
165
+ await page.addInitScript(watchShifts);
166
+ },
167
+ run: async (page, { options, url, viewport }) => {
168
+ const problems = heard.get(page);
169
+ if (problems === undefined) {
170
+ throw new WalkError("stillness: call prepare(page) before page.goto — a page opened unwatched would read as still");
171
+ }
172
+ const ignore = stringsOption(options, "ignore", []);
173
+ assertPatterns("stillness", ignore, "");
174
+ await page.waitForLoadState("networkidle", { timeout: IDLE_TIMEOUT_MS }).catch(() => {
175
+ return;
176
+ });
177
+ await page.evaluate(scrollThrough);
178
+ await page.evaluate(settled, ANIMATION_LIMIT_MS);
179
+ const { clientWidth, scrollWidth } = await page.evaluate(overflowOf);
180
+ const hovers = await hoverAll(page, stringOption("stillness", options, "hover", HOVERED), url, viewport);
181
+ await page.evaluate(() => {
182
+ window.scrollTo({ behavior: "instant", left: 0, top: 0 });
183
+ });
184
+ await page.evaluate(settled, ANIMATION_LIMIT_MS);
185
+ const shifts = await page.evaluate(() => window.geonosisShifts ?? []);
186
+ return [
187
+ ...shiftFinding(shifts, url),
188
+ ...hovers,
189
+ ...scrollWidth > clientWidth ? [
190
+ {
191
+ evidence: `the page is ${scrollWidth - clientWidth}px wider than the ${clientWidth}px viewport`,
192
+ severity: "major",
193
+ url
194
+ }
195
+ ] : [],
196
+ ...[...problems].filter((line) => !ignore.some((pattern) => new RegExp(pattern).test(line))).map((line) => ({ evidence: line, severity: "major", url }))
197
+ ];
198
+ }
199
+ });
200
+ export {
201
+ stillness
202
+ };
package/dist/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Page } from 'playwright';
2
2
  /** A green walk is not a clean surface: what these classes do not cover is in docs/walk-review-inventory-2026-08-30.md. */
3
- export type DefectClass = 'buy-box-above-fold' | 'content-integrity' | 'error-page-status' | 'fabricated-claim' | 'fake-session' | 'light-on-light' | 'link-integrity' | 'ops-leakage' | 'placeholder-asset' | 'stub-only-entity';
3
+ export declare const DEFECT_CLASSES: readonly ['accessibility-error', 'accessibility-warning', 'buy-box-above-fold', 'content-integrity', 'error-page-status', 'fabricated-claim', 'fake-session', 'light-on-light', 'link-integrity', 'ops-leakage', 'placeholder-asset', 'stillness', 'stub-only-entity'];
4
+ export type DefectClass = (typeof DEFECT_CLASSES)[number];
4
5
  /** `blocking` breaks trust or the buy path; `major` confuses the buyer; `minor` is polish. */
5
6
  export type Severity = 'blocking' | 'major' | 'minor';
6
7
  /** `evidence` is the measured value (colours and ratio, status code, matched text), never a restatement of the class. */
@@ -29,11 +30,15 @@ export type Probe = {
29
30
  class: DefectClass;
30
31
  id: string;
31
32
  /** D-031: refuses the run when a required option is missing; a probe with nothing to look for is indistinguishable from a clean page. */
32
- needs?: (options: Record<string, unknown>) => void;
33
+ needs?: (options: Record<string, unknown>) => Promise<void> | void;
34
+ alsoFilesUnder?: DefectClass[];
35
+ optIn?: true;
36
+ prepare?: (page: Page) => Promise<void>;
33
37
  run: (page: Page, context: ProbeContext) => Promise<Finding[]>;
34
38
  /** The reading no single page can make, called once after every page; each finding is filed against the page whose `url` it names. */
35
39
  finish?: (context: FinishContext) => Finding[];
36
40
  };
41
+ export declare const classesOf: (probe: Probe) => DefectClass[];
37
42
  export type FinishContext = {
38
43
  memo: Map<string, unknown>;
39
44
  options: Record<string, unknown>;
@@ -44,10 +49,24 @@ export type PageReport = {
44
49
  status: number;
45
50
  url: string;
46
51
  };
52
+ export type Webgl = {
53
+ available: false;
54
+ } | {
55
+ available: true;
56
+ caveat: 'granted' | 'refused';
57
+ renderer: null | string;
58
+ software: boolean;
59
+ vendor: null | string;
60
+ };
61
+ export type PageReady = {
62
+ scrollTo?: string;
63
+ waitFor?: string;
64
+ };
47
65
  export type WalkReport = {
48
66
  /** Keyed by the classes that ran: a zero means probed for, none found; an absent class was never looked for. */
49
67
  counts: Partial<Record<DefectClass, number>>;
50
68
  finishedAt: string;
69
+ gpu: boolean;
51
70
  pages: PageReport[];
52
71
  probes: string[];
53
72
  startedAt: string;
@@ -56,6 +75,7 @@ export type WalkReport = {
56
75
  why: string;
57
76
  };
58
77
  viewport: Viewport;
78
+ webgl: Webgl;
59
79
  };
60
80
  /** The walk could not run (exit 2), as distinct from a run that found nothing. */
61
81
  export declare class WalkError extends Error {
package/dist/types.js CHANGED
@@ -1,4 +1,24 @@
1
1
  // src/types.ts
2
+ var DEFECT_CLASSES = [
3
+ "accessibility-error",
4
+ "accessibility-warning",
5
+ "buy-box-above-fold",
6
+ "content-integrity",
7
+ "error-page-status",
8
+ "fabricated-claim",
9
+ "fake-session",
10
+ "light-on-light",
11
+ "link-integrity",
12
+ "ops-leakage",
13
+ "placeholder-asset",
14
+ "stillness",
15
+ "stub-only-entity"
16
+ ];
17
+ var classesOf = (probe) => [
18
+ probe.class,
19
+ ...probe.alsoFilesUnder ?? []
20
+ ];
21
+
2
22
  class WalkError extends Error {
3
23
  constructor(message) {
4
24
  super(message);
@@ -15,6 +35,8 @@ class WalkStopped extends WalkError {
15
35
  }
16
36
  }
17
37
  export {
38
+ DEFECT_CLASSES,
18
39
  WalkError,
19
- WalkStopped
40
+ WalkStopped,
41
+ classesOf
20
42
  };
package/dist/walk-cli.js CHANGED
@@ -3,9 +3,10 @@ import { mkdirSync, writeFileSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { parseArgs } from "node:util";
5
5
  import { errorMessage } from "@geonosis/base";
6
+ import { doorSpelled } from "@geonosis/base/node";
6
7
  import { configPath, configShape, loadWalkConfig, parseViewport, partialReportPath } from "./config.js";
7
8
  import { PROBES, probeById } from "./probes/index.js";
8
- import { WalkError, WalkStopped } from "./types.js";
9
+ import { classesOf, WalkError, WalkStopped } from "./types.js";
9
10
  import { findingsIn, walk } from "./walk.js";
10
11
  var parse = (argv) => {
11
12
  try {
@@ -32,10 +33,10 @@ var parse = (argv) => {
32
33
  ...values.viewport === undefined ? {} : { viewport: values.viewport }
33
34
  };
34
35
  } catch (error) {
35
- throw new WalkError(`${errorMessage(error)} — run geonosis-walk --help`);
36
+ throw new WalkError(doorSpelled(`${errorMessage(error)} — run geonosis-walk --help`, "geonosis-walk"));
36
37
  }
37
38
  };
38
- var USAGE = `geonosis-walk [url…] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>] [--version-key <key>] [--no-gpu]
39
+ var USAGE = doorSpelled(`geonosis-walk [url…] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>] [--version-key <key>] [--no-gpu]
39
40
 
40
41
  Walks the URLs this repo declares and runs the accessibility, correctness and dead-end probes
41
42
  against each. URLs and probes named on the command line replace the configured ones.
@@ -51,17 +52,25 @@ against each. URLs and probes named on the command line replace the configured o
51
52
  A page that answers is walked whatever its status. An error status the config does not declare
52
53
  (walk.urls: { "url", "status" }) is a finding, and so is a declared one the page does not answer.
53
54
 
55
+ A page that mounts its content when a section scrolls into view takes walk.urls: { "url",
56
+ "scrollTo", "waitFor" }: the walk scrolls scrollTo into view and waits for waitFor before any probe
57
+ reads the page. A selector that never appears exits 2, naming it and the page.
58
+
54
59
  Exit codes: 0 the walk ran and found nothing · 1 the walk ran and found something · 2 the walk did
55
60
  not run. The report is written for 0 and 1, and never for 2 — a tool that reported an empty result
56
61
  for a browser it could not launch would pass hardest exactly when it is broken. A walk that stops at
57
62
  a page it could not open writes the pages before it beside the report as <report>.partial.json,
58
- naming the URL; the gate's report stays absent.`;
63
+ naming the URL; the gate's report stays absent.`, "geonosis-walk");
59
64
  var line = (finding) => `${finding.severity} ${finding.class} ${finding.url}${finding.selector === undefined ? "" : ` ${finding.selector}`}
60
65
  ${finding.evidence}`;
61
66
  var denominator = (report) => {
62
67
  const ran = new Set(report.probes);
63
68
  const silent = PROBES.filter((probe) => !ran.has(probe.id)).map((probe) => probe.id);
64
- return `${ran.size} of ${PROBES.length} probe(s) ran${silent.length === 0 ? "" : ` — never looked for: ${silent.join(", ")}`}`;
69
+ const named = PROBES.filter((probe) => ran.has(probe.id)).map((probe) => {
70
+ const classes = classesOf(probe);
71
+ return classes.length === 1 && classes[0] === probe.id ? probe.id : `${probe.id} (${classes.join(", ")})`;
72
+ }).join(", ");
73
+ return `${ran.size} of ${PROBES.length} probe(s) ran: ${named}${silent.length === 0 ? "" : ` — never looked for: ${silent.join(", ")}`}`;
65
74
  };
66
75
  var summarise = (report) => [
67
76
  ...report.pages.flatMap((page) => page.findings.map(line)),
@@ -102,6 +111,7 @@ var main = async () => {
102
111
  gpu: argv.gpu && config.gpu,
103
112
  options: config.options,
104
113
  probes,
114
+ ready: config.ready,
105
115
  urls: argv.urls.length > 0 ? argv.urls : config.urls,
106
116
  ...versionKey === undefined ? {} : { versionKey },
107
117
  viewport: argv.viewport === undefined ? config.viewport : parseViewport(argv.viewport)
package/dist/walk.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import type { Browser } from 'playwright';
2
- import type { Probe, Viewport, WalkReport } from './types.js';
2
+ import type { PageReady, Probe, Viewport, WalkReport } from './types.js';
3
3
  export type WalkInput = {
4
4
  browser?: Browser;
5
5
  expected?: Record<string, number>;
6
6
  gpu?: boolean;
7
7
  options?: Record<string, Record<string, unknown>>;
8
8
  probes: Probe[];
9
+ ready?: Record<string, PageReady>;
10
+ readyTimeoutMs?: number;
9
11
  urls: string[];
10
12
  versionKey?: string;
11
13
  viewport: Viewport;
@@ -14,5 +16,5 @@ export type WalkInput = {
14
16
  export declare const launchBrowser: (gpu?: boolean) => Promise<Browser>;
15
17
  export declare const VERSION_KEY = "Cloudflare-Workers-Version-Key";
16
18
  /** Each page gets its own context with no cookies or storage, which is what gives `fake-session` meaning. Refusals come before the browser opens, a page that answers is walked whatever its status, and a page that answers nothing stops the walk. */
17
- export declare const walk: ({ browser, expected, gpu, options, probes, urls, versionKey, viewport }: WalkInput) => Promise<WalkReport>;
19
+ export declare const walk: ({ browser, expected, gpu, options, probes, ready, readyTimeoutMs, urls, versionKey, viewport }: WalkInput) => Promise<WalkReport>;
18
20
  export declare const findingsIn: (report: WalkReport) => number;
package/dist/walk.js CHANGED
@@ -1,6 +1,9 @@
1
1
  // src/walk.ts
2
2
  import { errorMessage } from "@geonosis/base";
3
- import { WalkError, WalkStopped } from "./types.js";
3
+ import { classesOf, WalkError, WalkStopped } from "./types.js";
4
+ import { readWebgl } from "./webgl.js";
5
+ var READY_TIMEOUT_MS = 1e4;
6
+ var NO_GPU_ARGS = ["--disable-gpu", "--use-angle=swiftshader"];
4
7
  var launchBrowser = async (gpu = true) => {
5
8
  let chromium;
6
9
  try {
@@ -12,7 +15,7 @@ var launchBrowser = async (gpu = true) => {
12
15
  return await chromium.launch({
13
16
  channel: "chromium",
14
17
  headless: true,
15
- ...gpu ? {} : { args: ["--disable-gpu"] }
18
+ ...gpu ? {} : { args: NO_GPU_ARGS }
16
19
  });
17
20
  } catch (error) {
18
21
  throw new WalkError(`chromium would not launch — \`npx playwright install chromium\`: ${errorMessage(error)}`);
@@ -58,10 +61,31 @@ var statusFindings = (url, status, declared) => {
58
61
  }
59
62
  ];
60
63
  };
64
+ var firstLine = (error) => errorMessage(error).split(`
65
+ `)[0] ?? "";
66
+ var settle = async (page, ready, timeout) => {
67
+ if (ready.scrollTo !== undefined) {
68
+ try {
69
+ await page.locator(ready.scrollTo).first().scrollIntoViewIfNeeded({ timeout });
70
+ } catch (error) {
71
+ return `could not scroll to "${ready.scrollTo}" within ${timeout} ms: ${firstLine(error)}`;
72
+ }
73
+ }
74
+ if (ready.waitFor !== undefined) {
75
+ try {
76
+ await page.locator(ready.waitFor).first().waitFor({ state: "attached", timeout });
77
+ } catch (error) {
78
+ return `never showed "${ready.waitFor}" within ${timeout} ms: ${firstLine(error)}`;
79
+ }
80
+ }
81
+ return;
82
+ };
61
83
  var reportOf = (input) => {
62
84
  const counts = {};
63
- for (const probe of input.probes)
64
- counts[probe.class] = 0;
85
+ for (const probe of input.probes) {
86
+ for (const filed of classesOf(probe))
87
+ counts[filed] = 0;
88
+ }
65
89
  for (const page of input.pages) {
66
90
  for (const finding of page.findings) {
67
91
  counts[finding.class] = (counts[finding.class] ?? 0) + 1;
@@ -70,11 +94,13 @@ var reportOf = (input) => {
70
94
  return {
71
95
  counts,
72
96
  finishedAt: new Date().toISOString(),
97
+ gpu: input.gpu,
73
98
  pages: input.pages,
74
99
  probes: input.probes.map((one) => one.id),
75
100
  startedAt: input.startedAt,
76
101
  ...input.stoppedAt === undefined ? {} : { stoppedAt: input.stoppedAt },
77
- viewport: input.viewport
102
+ viewport: input.viewport,
103
+ webgl: input.webgl
78
104
  };
79
105
  };
80
106
  var walk = async ({
@@ -83,6 +109,8 @@ var walk = async ({
83
109
  gpu = true,
84
110
  options = {},
85
111
  probes,
112
+ ready = {},
113
+ readyTimeoutMs = READY_TIMEOUT_MS,
86
114
  urls,
87
115
  versionKey,
88
116
  viewport
@@ -90,13 +118,15 @@ var walk = async ({
90
118
  if (urls.length === 0)
91
119
  throw new WalkError("no URL to walk");
92
120
  for (const probe of probes)
93
- probe.needs?.(options[probe.id] ?? {});
121
+ await probe.needs?.(options[probe.id] ?? {});
94
122
  const startedAt = new Date().toISOString();
95
123
  const own = browser ?? await launchBrowser(gpu);
96
124
  const memo = new Map;
97
125
  const pages = [];
98
- const stoppedAt = (url, why) => new WalkStopped(`${url} ${why}`, reportOf({ pages, probes, startedAt, stoppedAt: { url, why }, viewport }));
126
+ let webgl;
99
127
  try {
128
+ webgl = await readWebgl(own);
129
+ const stoppedAt = (url, why) => new WalkStopped(`${url} ${why}`, reportOf({ gpu, pages, probes, startedAt, stoppedAt: { url, why }, viewport, webgl }));
100
130
  for (const url of urls) {
101
131
  const context = await own.newContext({ viewport });
102
132
  try {
@@ -106,11 +136,16 @@ var walk = async ({
106
136
  if (headers !== undefined && origin !== undefined) {
107
137
  await page.route((target) => target.origin === origin, (route) => route.continue({ headers: { ...route.request().headers(), ...headers } }));
108
138
  }
139
+ for (const probe of probes)
140
+ await probe.prepare?.(page);
109
141
  const response = await page.goto(url).catch((error) => {
110
142
  throw stoppedAt(url, `could not be opened: ${errorMessage(error)}`);
111
143
  });
112
144
  if (response === null)
113
145
  throw stoppedAt(url, "answered nothing");
146
+ const unsettled = await settle(page, ready[url] ?? {}, readyTimeoutMs);
147
+ if (unsettled !== undefined)
148
+ throw stoppedAt(url, unsettled);
114
149
  const status = response.status();
115
150
  const findings = statusFindings(url, status, expected[url]);
116
151
  for (const probe of probes) {
@@ -141,7 +176,7 @@ var walk = async ({
141
176
  page.findings.push(finding);
142
177
  }
143
178
  }
144
- return reportOf({ pages, probes, startedAt, viewport });
179
+ return reportOf({ gpu, pages, probes, startedAt, viewport, webgl });
145
180
  };
146
181
  var findingsIn = (report) => report.pages.reduce((total, page) => total + page.findings.length, 0);
147
182
  export {
@@ -0,0 +1,4 @@
1
+ import type { Browser } from 'playwright';
2
+ import type { Webgl } from './types.js';
3
+ export declare const drawnInSoftware: (renderer: null | string | undefined) => boolean;
4
+ export declare const readWebgl: (browser: Browser) => Promise<Webgl>;
package/dist/webgl.js ADDED
@@ -0,0 +1,33 @@
1
+ // src/webgl.ts
2
+ var SOFTWARE_RENDERER = /swiftshader|llvmpipe|softpipe/i;
3
+ var drawnInSoftware = (renderer) => renderer !== null && renderer !== undefined && SOFTWARE_RENDERER.test(renderer);
4
+ var ask = () => {
5
+ const strict = document.createElement("canvas").getContext("webgl2", { failIfMajorPerformanceCaveat: true });
6
+ const gl = strict ?? document.createElement("canvas").getContext("webgl2");
7
+ if (gl === null)
8
+ return { available: false };
9
+ const info = gl.getExtension("WEBGL_debug_renderer_info");
10
+ const named = (parameter) => {
11
+ const value = parameter === undefined ? undefined : gl.getParameter(parameter);
12
+ return typeof value === "string" ? value : null;
13
+ };
14
+ return {
15
+ available: true,
16
+ caveat: strict === null ? "refused" : "granted",
17
+ renderer: named(info?.UNMASKED_RENDERER_WEBGL),
18
+ vendor: named(info?.UNMASKED_VENDOR_WEBGL)
19
+ };
20
+ };
21
+ var readWebgl = async (browser) => {
22
+ const context = await browser.newContext();
23
+ try {
24
+ const answered = await (await context.newPage()).evaluate(ask);
25
+ return answered.available ? { ...answered, software: drawnInSoftware(answered.renderer) } : answered;
26
+ } finally {
27
+ await context.close();
28
+ }
29
+ };
30
+ export {
31
+ drawnInSoftware,
32
+ readWebgl
33
+ };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@geonosis/walk",
3
- "version": "3.6.1",
3
+ "version": "3.8.0",
4
4
  "types": "./dist/index.d.ts",
5
- "description": "The customer walk as a gate: eight computed-DOM probes over a list of URLs, one JSON report, and an exit code that tells a could-not-run from a clean page.",
5
+ "description": "The customer walk as a gate: fifteen probes over a list of URLs, fourteen computed-DOM readings and axe’s accessibility rules, one JSON report, and an exit code that tells a could-not-run from a clean page.",
6
6
  "keywords": [
7
7
  "playwright",
8
8
  "audit",
@@ -36,17 +36,22 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@geonosis/base": "3.6.1"
39
+ "@geonosis/base": "3.8.0"
40
40
  },
41
41
  "peerDependencies": {
42
+ "@axe-core/playwright": "^4.14.0",
42
43
  "playwright": ">=1.40.0"
43
44
  },
44
45
  "peerDependenciesMeta": {
46
+ "@axe-core/playwright": {
47
+ "optional": true
48
+ },
45
49
  "playwright": {
46
50
  "optional": true
47
51
  }
48
52
  },
49
53
  "devDependencies": {
54
+ "@axe-core/playwright": "4.14.0",
50
55
  "playwright": "1.64.1"
51
56
  },
52
57
  "engines": {
@@ -56,7 +61,7 @@
56
61
  "runtime": [
57
62
  {
58
63
  "name": "bun",
59
- "version": "^1.4.2",
64
+ "version": "^1.4.4",
60
65
  "onFail": "download"
61
66
  },
62
67
  {