@geonosis/walk 3.6.0 → 3.7.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 +27 -0
- package/README.md +51 -22
- package/dist/config.d.ts +2 -1
- package/dist/config.js +27 -6
- package/dist/index.d.ts +1 -1
- package/dist/probes/axe.d.ts +12 -0
- package/dist/probes/axe.js +44 -0
- package/dist/probes/index.js +2 -0
- package/dist/types.d.ts +19 -2
- package/dist/types.js +22 -1
- package/dist/walk-cli.js +15 -5
- package/dist/walk.d.ts +4 -2
- package/dist/walk.js +39 -7
- package/dist/webgl.d.ts +3 -0
- package/dist/webgl.js +29 -0
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @geonosis/walk
|
|
2
2
|
|
|
3
|
+
## 3.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- 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).
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 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).
|
|
13
|
+
- 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).
|
|
14
|
+
- 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.
|
|
15
|
+
- Updated dependencies [1830b16]
|
|
16
|
+
- Updated dependencies [1dabee8]
|
|
17
|
+
- Updated dependencies [74147f7]
|
|
18
|
+
- Updated dependencies [b505542]
|
|
19
|
+
- @geonosis/base@3.7.0
|
|
20
|
+
|
|
21
|
+
## 3.6.1
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [ac7f890]
|
|
28
|
+
- @geonosis/base@3.6.1
|
|
29
|
+
|
|
3
30
|
## 3.6.0
|
|
4
31
|
|
|
5
32
|
This package had no change of its own in 3.6.0. 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,
|
|
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. Thirteen 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
|
|
47
|
+
## The probes
|
|
48
48
|
|
|
49
49
|
| id | What it reads | Needs |
|
|
50
50
|
|---|---|---|
|
|
@@ -61,15 +61,22 @@ 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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
| `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 |
|
|
65
|
+
|
|
66
|
+
The ten in bold **refuse the run** when the option or the peer is missing, naming it (D-031). None
|
|
67
|
+
of the nine options can have a default that is true of a repo which has not configured it — what a
|
|
68
|
+
company can stand behind, which entities exist, what its signed-in header looks like, which words
|
|
69
|
+
mean "operations", where its buy box is, what its error surface says, how much a page owes a reader,
|
|
70
|
+
which containers are sections, what a price looks like — and a probe that ran with an empty list
|
|
71
|
+
would report a clean page for every repo that never set one up.
|
|
72
|
+
|
|
73
|
+
`axe` files `critical` as a `blocking` and `serious` as a `major` finding of class
|
|
74
|
+
`accessibility-error`, and `moderate` and `minor` as `minor` findings of class
|
|
75
|
+
`accessibility-warning`, so a ratchet counter can count the errors without the warnings. With the
|
|
76
|
+
peer missing, the walk exits 2 naming the install command, `npm i -D @axe-core/playwright`, and does
|
|
77
|
+
not skip the probe in silence. A walk that names no probes does not run it.
|
|
78
|
+
|
|
79
|
+
Four of the others are the `content-integrity` class: a page that renders correctly and says nothing.
|
|
73
80
|
Four defects of one audit were filed under `fabricated-claim`'s forbidden-string engine for want of
|
|
74
81
|
it, which is one class borrowing another's mechanism.
|
|
75
82
|
|
|
@@ -83,7 +90,12 @@ Everything lives in the `walk` block of `geonosis.json`; the command line wins w
|
|
|
83
90
|
"urls": [
|
|
84
91
|
"http://localhost:3000/",
|
|
85
92
|
"http://localhost:3000/products/kraft-mailer-box",
|
|
86
|
-
{ "url": "http://localhost:3000/does-not-exist/", "status": 404 }
|
|
93
|
+
{ "url": "http://localhost:3000/does-not-exist/", "status": 404 },
|
|
94
|
+
{
|
|
95
|
+
"url": "http://localhost:3000/designer/",
|
|
96
|
+
"scrollTo": "#demo",
|
|
97
|
+
"waitFor": "#demo .designer__layout"
|
|
98
|
+
}
|
|
87
99
|
],
|
|
88
100
|
"versionKey": "release-check",
|
|
89
101
|
"viewport": { "width": 1440, "height": 900 },
|
|
@@ -102,6 +114,13 @@ Everything lives in the `walk` block of `geonosis.json`; the command line wins w
|
|
|
102
114
|
geonosis-walk [url…] [--report <path>] [--config <path>] [--viewport WIDTHxHEIGHT] [--probe <id>]… [--version-key <key>] [--no-gpu]
|
|
103
115
|
```
|
|
104
116
|
|
|
117
|
+
A URL entry takes `scrollTo` and `waitFor`, two CSS selectors, for a page that mounts its content
|
|
118
|
+
when a section scrolls into view. The walk scrolls `scrollTo` into view, then waits for `waitFor` to
|
|
119
|
+
be in the page, before any probe reads it; a page that waits for an IntersectionObserver is
|
|
120
|
+
otherwise read unmounted and reported clean. A selector that never appears within ten seconds stops
|
|
121
|
+
the walk at that page and exits 2, naming the selector and the URL: a walk that cannot measure has
|
|
122
|
+
not passed.
|
|
123
|
+
|
|
105
124
|
`versionKey` (or `--version-key`) sends `Cloudflare-Workers-Version-Key: <key>` with every request
|
|
106
125
|
to the origin of each walked page, including the HEAD requests `link-integrity` makes, and to no
|
|
107
126
|
other origin. During a gradual deployment on Workers, Cloudflare routes each request to a version by
|
|
@@ -115,7 +134,7 @@ asks `failIfMajorPerformanceCaveat` even with no graphics processor, which Chrom
|
|
|
115
134
|
false` (or `--no-gpu`) walks as a visitor with no graphics processor, so a page that offers a
|
|
116
135
|
fallback for that refusal is walked on its fallback.
|
|
117
136
|
|
|
118
|
-
With no `probes` the walk runs the
|
|
137
|
+
With no `probes` the walk runs the four that need no list. A mobile pass is the same command with
|
|
119
138
|
`--viewport 390x844`.
|
|
120
139
|
|
|
121
140
|
## The report
|
|
@@ -124,6 +143,8 @@ With no `probes` the walk runs the three that need no list. A mobile pass is the
|
|
|
124
143
|
{
|
|
125
144
|
"startedAt": "…", "finishedAt": "…",
|
|
126
145
|
"viewport": { "width": 390, "height": 844 },
|
|
146
|
+
"gpu": true,
|
|
147
|
+
"webgl": { "available": true, "caveat": "granted", "renderer": "ANGLE (…)", "vendor": "Google Inc. (…)" },
|
|
127
148
|
"probes": ["buy-box-above-fold"],
|
|
128
149
|
"counts": { "buy-box-above-fold": 1 },
|
|
129
150
|
"pages": [{ "url": "…", "status": 200, "findings": [
|
|
@@ -134,8 +155,16 @@ With no `probes` the walk runs the three that need no list. A mobile pass is the
|
|
|
134
155
|
}
|
|
135
156
|
```
|
|
136
157
|
|
|
158
|
+
`gpu` is whether the walk launched with a graphics processor, and `webgl` is what the browser
|
|
159
|
+
answered for WebGL: `caveat` is `granted` or `refused` for a context asking
|
|
160
|
+
`failIfMajorPerformanceCaveat`, `renderer` and `vendor` come from the `WEBGL_debug_renderer_info`
|
|
161
|
+
extension (`null` when the browser does not expose it), and `{ "available": false }` means no WebGL
|
|
162
|
+
context at all. Two reports of one page are comparable only when these agree.
|
|
163
|
+
|
|
137
164
|
`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.
|
|
165
|
+
class was never looked for. The summary line the walk prints says the same: `<ran> of <shipped> probe(s) ran:`,
|
|
166
|
+
each probe that ran by its id, with its classes beside it where they are not the id
|
|
167
|
+
(`axe (accessibility-error, accessibility-warning)`), then the probes it never looked for. `@geonosis/ratchet`'s `walkFindings` counter reads this file and refuses
|
|
139
168
|
when it is missing or unparsable, which is the same rule as the exit code: a gate that cannot
|
|
140
169
|
measure has not passed.
|
|
141
170
|
|
|
@@ -164,11 +193,11 @@ the status agrees with the body, and asking the server again asks a different qu
|
|
|
164
193
|
|
|
165
194
|
## What this is not
|
|
166
195
|
|
|
167
|
-
A green report is not a clean surface. Twelve of the thirteen probes came from hand
|
|
168
|
-
storefront, the largest holding 36 defects; six are reproduced by a probe alone,
|
|
169
|
-
and fourteen — five product tables that disagree, a cart that re-prices what the
|
|
170
|
-
quoted, copy promising a control nobody built, four levels of taxonomy for fourteen
|
|
171
|
-
invisible to any browser probe there could be. Those stay the walker's judgement. The
|
|
172
|
-
came from a production incident instead, which is how the list is meant to grow. The
|
|
173
|
-
defect by defect, is in
|
|
196
|
+
A green report is not a clean surface. Twelve of the thirteen computed-DOM probes came from hand
|
|
197
|
+
audits of one storefront, the largest holding 36 defects; six are reproduced by a probe alone,
|
|
198
|
+
sixteen partially, and fourteen — five product tables that disagree, a cart that re-prices what the
|
|
199
|
+
product page quoted, copy promising a control nobody built, four levels of taxonomy for fourteen
|
|
200
|
+
products — are invisible to any browser probe there could be. Those stay the walker's judgement. The
|
|
201
|
+
thirteenth came from a production incident instead, which is how the list is meant to grow. The
|
|
202
|
+
reasoning, defect by defect, is in
|
|
174
203
|
[`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,
|
|
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
|
|
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
|
+
};
|
package/dist/probes/index.js
CHANGED
|
@@ -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";
|
|
@@ -13,6 +14,7 @@ import { placeholderAsset } from "./placeholder-asset.js";
|
|
|
13
14
|
import { stubOnlyEntity } from "./stub-only-entity.js";
|
|
14
15
|
import { thinPage } from "./thin-page.js";
|
|
15
16
|
var PROBES = [
|
|
17
|
+
axe,
|
|
16
18
|
buyBoxAboveFold,
|
|
17
19
|
emptySection,
|
|
18
20
|
errorPageStatus,
|
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
|
|
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', '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,13 @@ 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[];
|
|
33
35
|
run: (page: Page, context: ProbeContext) => Promise<Finding[]>;
|
|
34
36
|
/** The reading no single page can make, called once after every page; each finding is filed against the page whose `url` it names. */
|
|
35
37
|
finish?: (context: FinishContext) => Finding[];
|
|
36
38
|
};
|
|
39
|
+
export declare const classesOf: (probe: Probe) => DefectClass[];
|
|
37
40
|
export type FinishContext = {
|
|
38
41
|
memo: Map<string, unknown>;
|
|
39
42
|
options: Record<string, unknown>;
|
|
@@ -44,10 +47,23 @@ export type PageReport = {
|
|
|
44
47
|
status: number;
|
|
45
48
|
url: string;
|
|
46
49
|
};
|
|
50
|
+
export type Webgl = {
|
|
51
|
+
available: false;
|
|
52
|
+
} | {
|
|
53
|
+
available: true;
|
|
54
|
+
caveat: 'granted' | 'refused';
|
|
55
|
+
renderer: null | string;
|
|
56
|
+
vendor: null | string;
|
|
57
|
+
};
|
|
58
|
+
export type PageReady = {
|
|
59
|
+
scrollTo?: string;
|
|
60
|
+
waitFor?: string;
|
|
61
|
+
};
|
|
47
62
|
export type WalkReport = {
|
|
48
63
|
/** Keyed by the classes that ran: a zero means probed for, none found; an absent class was never looked for. */
|
|
49
64
|
counts: Partial<Record<DefectClass, number>>;
|
|
50
65
|
finishedAt: string;
|
|
66
|
+
gpu: boolean;
|
|
51
67
|
pages: PageReport[];
|
|
52
68
|
probes: string[];
|
|
53
69
|
startedAt: string;
|
|
@@ -56,6 +72,7 @@ export type WalkReport = {
|
|
|
56
72
|
why: string;
|
|
57
73
|
};
|
|
58
74
|
viewport: Viewport;
|
|
75
|
+
webgl: Webgl;
|
|
59
76
|
};
|
|
60
77
|
/** The walk could not run (exit 2), as distinct from a run that found nothing. */
|
|
61
78
|
export declare class WalkError extends Error {
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
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
|
+
"stub-only-entity"
|
|
15
|
+
];
|
|
16
|
+
var classesOf = (probe) => [
|
|
17
|
+
probe.class,
|
|
18
|
+
...probe.alsoFilesUnder ?? []
|
|
19
|
+
];
|
|
20
|
+
|
|
2
21
|
class WalkError extends Error {
|
|
3
22
|
constructor(message) {
|
|
4
23
|
super(message);
|
|
@@ -15,6 +34,8 @@ class WalkStopped extends WalkError {
|
|
|
15
34
|
}
|
|
16
35
|
}
|
|
17
36
|
export {
|
|
37
|
+
DEFECT_CLASSES,
|
|
18
38
|
WalkError,
|
|
19
|
-
WalkStopped
|
|
39
|
+
WalkStopped,
|
|
40
|
+
classesOf
|
|
20
41
|
};
|
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
|
-
|
|
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,8 @@
|
|
|
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;
|
|
4
6
|
var launchBrowser = async (gpu = true) => {
|
|
5
7
|
let chromium;
|
|
6
8
|
try {
|
|
@@ -58,10 +60,31 @@ var statusFindings = (url, status, declared) => {
|
|
|
58
60
|
}
|
|
59
61
|
];
|
|
60
62
|
};
|
|
63
|
+
var firstLine = (error) => errorMessage(error).split(`
|
|
64
|
+
`)[0] ?? "";
|
|
65
|
+
var settle = async (page, ready, timeout) => {
|
|
66
|
+
if (ready.scrollTo !== undefined) {
|
|
67
|
+
try {
|
|
68
|
+
await page.locator(ready.scrollTo).first().scrollIntoViewIfNeeded({ timeout });
|
|
69
|
+
} catch (error) {
|
|
70
|
+
return `could not scroll to "${ready.scrollTo}" within ${timeout} ms: ${firstLine(error)}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (ready.waitFor !== undefined) {
|
|
74
|
+
try {
|
|
75
|
+
await page.locator(ready.waitFor).first().waitFor({ state: "attached", timeout });
|
|
76
|
+
} catch (error) {
|
|
77
|
+
return `never showed "${ready.waitFor}" within ${timeout} ms: ${firstLine(error)}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
};
|
|
61
82
|
var reportOf = (input) => {
|
|
62
83
|
const counts = {};
|
|
63
|
-
for (const probe of input.probes)
|
|
64
|
-
|
|
84
|
+
for (const probe of input.probes) {
|
|
85
|
+
for (const filed of classesOf(probe))
|
|
86
|
+
counts[filed] = 0;
|
|
87
|
+
}
|
|
65
88
|
for (const page of input.pages) {
|
|
66
89
|
for (const finding of page.findings) {
|
|
67
90
|
counts[finding.class] = (counts[finding.class] ?? 0) + 1;
|
|
@@ -70,11 +93,13 @@ var reportOf = (input) => {
|
|
|
70
93
|
return {
|
|
71
94
|
counts,
|
|
72
95
|
finishedAt: new Date().toISOString(),
|
|
96
|
+
gpu: input.gpu,
|
|
73
97
|
pages: input.pages,
|
|
74
98
|
probes: input.probes.map((one) => one.id),
|
|
75
99
|
startedAt: input.startedAt,
|
|
76
100
|
...input.stoppedAt === undefined ? {} : { stoppedAt: input.stoppedAt },
|
|
77
|
-
viewport: input.viewport
|
|
101
|
+
viewport: input.viewport,
|
|
102
|
+
webgl: input.webgl
|
|
78
103
|
};
|
|
79
104
|
};
|
|
80
105
|
var walk = async ({
|
|
@@ -83,6 +108,8 @@ var walk = async ({
|
|
|
83
108
|
gpu = true,
|
|
84
109
|
options = {},
|
|
85
110
|
probes,
|
|
111
|
+
ready = {},
|
|
112
|
+
readyTimeoutMs = READY_TIMEOUT_MS,
|
|
86
113
|
urls,
|
|
87
114
|
versionKey,
|
|
88
115
|
viewport
|
|
@@ -90,13 +117,15 @@ var walk = async ({
|
|
|
90
117
|
if (urls.length === 0)
|
|
91
118
|
throw new WalkError("no URL to walk");
|
|
92
119
|
for (const probe of probes)
|
|
93
|
-
probe.needs?.(options[probe.id] ?? {});
|
|
120
|
+
await probe.needs?.(options[probe.id] ?? {});
|
|
94
121
|
const startedAt = new Date().toISOString();
|
|
95
122
|
const own = browser ?? await launchBrowser(gpu);
|
|
96
123
|
const memo = new Map;
|
|
97
124
|
const pages = [];
|
|
98
|
-
|
|
125
|
+
let webgl;
|
|
99
126
|
try {
|
|
127
|
+
webgl = await readWebgl(own);
|
|
128
|
+
const stoppedAt = (url, why) => new WalkStopped(`${url} ${why}`, reportOf({ gpu, pages, probes, startedAt, stoppedAt: { url, why }, viewport, webgl }));
|
|
100
129
|
for (const url of urls) {
|
|
101
130
|
const context = await own.newContext({ viewport });
|
|
102
131
|
try {
|
|
@@ -111,6 +140,9 @@ var walk = async ({
|
|
|
111
140
|
});
|
|
112
141
|
if (response === null)
|
|
113
142
|
throw stoppedAt(url, "answered nothing");
|
|
143
|
+
const unsettled = await settle(page, ready[url] ?? {}, readyTimeoutMs);
|
|
144
|
+
if (unsettled !== undefined)
|
|
145
|
+
throw stoppedAt(url, unsettled);
|
|
114
146
|
const status = response.status();
|
|
115
147
|
const findings = statusFindings(url, status, expected[url]);
|
|
116
148
|
for (const probe of probes) {
|
|
@@ -141,7 +173,7 @@ var walk = async ({
|
|
|
141
173
|
page.findings.push(finding);
|
|
142
174
|
}
|
|
143
175
|
}
|
|
144
|
-
return reportOf({ pages, probes, startedAt, viewport });
|
|
176
|
+
return reportOf({ gpu, pages, probes, startedAt, viewport, webgl });
|
|
145
177
|
};
|
|
146
178
|
var findingsIn = (report) => report.pages.reduce((total, page) => total + page.findings.length, 0);
|
|
147
179
|
export {
|
package/dist/webgl.d.ts
ADDED
package/dist/webgl.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/webgl.ts
|
|
2
|
+
var ask = () => {
|
|
3
|
+
const strict = document.createElement("canvas").getContext("webgl2", { failIfMajorPerformanceCaveat: true });
|
|
4
|
+
const gl = strict ?? document.createElement("canvas").getContext("webgl2");
|
|
5
|
+
if (gl === null)
|
|
6
|
+
return { available: false };
|
|
7
|
+
const info = gl.getExtension("WEBGL_debug_renderer_info");
|
|
8
|
+
const named = (parameter) => {
|
|
9
|
+
const value = parameter === undefined ? undefined : gl.getParameter(parameter);
|
|
10
|
+
return typeof value === "string" ? value : null;
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
available: true,
|
|
14
|
+
caveat: strict === null ? "refused" : "granted",
|
|
15
|
+
renderer: named(info?.UNMASKED_RENDERER_WEBGL),
|
|
16
|
+
vendor: named(info?.UNMASKED_VENDOR_WEBGL)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
var readWebgl = async (browser) => {
|
|
20
|
+
const context = await browser.newContext();
|
|
21
|
+
try {
|
|
22
|
+
return await (await context.newPage()).evaluate(ask);
|
|
23
|
+
} finally {
|
|
24
|
+
await context.close();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
readWebgl
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geonosis/walk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
|
-
"description": "The customer walk as a gate:
|
|
5
|
+
"description": "The customer walk as a gate: fourteen probes over a list of URLs, thirteen 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.
|
|
39
|
+
"@geonosis/base": "3.7.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": {
|