@surea11y/webdriverio 1.0.1 → 1.1.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/README.md +12 -8
- package/package.json +21 -7
- package/src/A11yCoreBuilder.d.ts +17 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @surea11y/webdriverio
|
|
2
2
|
|
|
3
|
-
A WebdriverIO binding for [`@surea11y/core`](https://github.com/
|
|
3
|
+
A WebdriverIO binding for [`@surea11y/core`](https://github.com/SureA11y/core) — scans a real, already-rendered page for accessibility issues using surea11y's DOM-rules engine.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -39,7 +39,7 @@ await browser.deleteSession();
|
|
|
39
39
|
|
|
40
40
|
The builder takes `{ browser }` — the object WebdriverIO's `remote()` returns (standalone mode), or the global `browser` the WDIO testrunner injects (see the E2E section). It must already be navigated to and settled at the URL to scan; the class does not navigate for you.
|
|
41
41
|
|
|
42
|
-
`results` is `@surea11y/core`'s own native result shape — see its [`OUTPUT_SCHEMA.md`](https://github.com/
|
|
42
|
+
`results` is `@surea11y/core`'s own native result shape — see its [`OUTPUT_SCHEMA.md`](https://github.com/SureA11y/core/blob/main/docs/OUTPUT_SCHEMA.md) — not the `violations`/`passes`/`incomplete`/`inapplicable` shape used by other popular accessibility testing tools. The builder's *method names* are modeled on common conventions in this space for migration familiarity; the richer result schema is kept as-is.
|
|
43
43
|
|
|
44
44
|
Also see `examples/basic-scan.js` for a runnable script (`npm run example -- <url>`).
|
|
45
45
|
|
|
@@ -166,7 +166,7 @@ const results = await new A11yCoreBuilder({ browser })
|
|
|
166
166
|
.analyze();
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
A custom rule descriptor is the same shape as one of `@surea11y/core`'s own internal rule modules (`{ id, meta, runInPage, applicability?, data? }`) — see its [`ENGINE_OPTIONS.md`](https://github.com/
|
|
169
|
+
A custom rule descriptor is the same shape as one of `@surea11y/core`'s own internal rule modules (`{ id, meta, runInPage, applicability?, data? }`) — see its [`ENGINE_OPTIONS.md`](https://github.com/SureA11y/core/blob/main/docs/ENGINE_OPTIONS.md) for the full contract. Results appear in `checksResults` exactly like a built-in rule's, including automatic `selector`/`html`/`structuralPath` fill-in. Registered per-scan only (nothing persists between calls or shows up in any catalog listing), and a custom rule whose `id` collides with a built-in one overrides it for that scan.
|
|
170
170
|
|
|
171
171
|
Pass an array to register several at once, or call `.withCustomRules()` again to add more — like `.withRules()`/`.withTags()`, it accumulates rather than replacing what was already registered:
|
|
172
172
|
|
|
@@ -183,7 +183,7 @@ Invalid input (a missing/empty `id`, or a `runInPage`/`applicability` that's nei
|
|
|
183
183
|
|
|
184
184
|
### Element addressing beyond a CSS selector
|
|
185
185
|
|
|
186
|
-
Every occurrence already carries `selector` and (with `.elementRef(true)`, above) a live `element`. It also carries `structuralPath` — a sibling-index path from the document root down to the flagged element (e.g. `[1, 0, 2]`) — a more robust identity than a selector string alone, since it survives some DOM changes a selector wouldn't (an id/class rename, for instance). No opt-in needed; it's already on every `fail`/`cantTell` occurrence today. See [`OUTPUT_SCHEMA.md`](https://github.com/
|
|
186
|
+
Every occurrence already carries `selector` and (with `.elementRef(true)`, above) a live `element`. It also carries `structuralPath` — a sibling-index path from the document root down to the flagged element (e.g. `[1, 0, 2]`) — a more robust identity than a selector string alone, since it survives some DOM changes a selector wouldn't (an id/class rename, for instance). No opt-in needed; it's already on every `fail`/`cantTell` occurrence today. See [`OUTPUT_SCHEMA.md`](https://github.com/SureA11y/core/blob/main/docs/OUTPUT_SCHEMA.md) for the full field description.
|
|
187
187
|
|
|
188
188
|
## TypeScript
|
|
189
189
|
|
|
@@ -191,7 +191,7 @@ Every occurrence already carries `selector` and (with `.elementRef(true)`, above
|
|
|
191
191
|
|
|
192
192
|
## Relationship to `@surea11y/playwright` and `@surea11y/puppeteer`
|
|
193
193
|
|
|
194
|
-
This binding's builder API is deliberately the same shape as [`@surea11y/playwright`](https://github.com/
|
|
194
|
+
This binding's builder API is deliberately the same shape as [`@surea11y/playwright`](https://github.com/SureA11y/playwright)'s and `@surea11y/puppeteer`'s — same method names, same mutability contract, same result shapes — so the accessibility-gate logic reads almost identically across all three. The state-accumulation half of the builder (`include`/`exclude`/`withTags`/`disableTags`/`withRules`/`disableRules`/`options`/`withCustomRules`/`reportOnly`) is not copied across bindings — `A11yCoreBuilder` here extends `A11yCoreBuilderBase` from [`@surea11y/binding-base`](https://github.com/SureA11y/binding-base), the single shared implementation every sibling binding depends on.
|
|
195
195
|
|
|
196
196
|
Where it genuinely diverges is WebdriverIO's driver model, and those differences are real, not cosmetic:
|
|
197
197
|
|
|
@@ -202,12 +202,16 @@ Where it genuinely diverges is WebdriverIO's driver model, and those differences
|
|
|
202
202
|
|
|
203
203
|
## Building another framework binding?
|
|
204
204
|
|
|
205
|
-
See `@surea11y/core`'s [`BINDING_AUTHORS_GUIDE.md`](https://github.com/
|
|
205
|
+
See `@surea11y/core`'s [`BINDING_AUTHORS_GUIDE.md`](https://github.com/SureA11y/core/blob/main/docs/BINDING_AUTHORS_GUIDE.md) — a reference for building a new binding, covering which parity features are engine-level (work through a generic `.options()`/`runOnly` passthrough with zero binding code, including WCAG-version tag filtering) vs. binding-layer (element refs, `reportOnly`-style verbosity filtering, the serialization-boundary caveat `.withCustomRules()` exists to paper over).
|
|
206
206
|
|
|
207
|
-
`A11yCoreBuilder` here extends `A11yCoreBuilderBase` from [`@surea11y/binding-base`](https://github.com/
|
|
207
|
+
`A11yCoreBuilder` here extends `A11yCoreBuilderBase` from [`@surea11y/binding-base`](https://github.com/SureA11y/binding-base), a small shared package holding the scaffolding common to every framework binding. A new binding should depend on that package from the start.
|
|
208
|
+
|
|
209
|
+
## Maintainer
|
|
210
|
+
|
|
211
|
+
Maintained by [Jorge Rumoroso](https://github.com/rumoroso).
|
|
208
212
|
|
|
209
213
|
## License
|
|
210
214
|
|
|
211
215
|
MIT — see [`LICENSE`](./LICENSE).
|
|
212
216
|
|
|
213
|
-
This package depends on [`@surea11y/core`](https://github.com/
|
|
217
|
+
This package depends on [`@surea11y/core`](https://github.com/SureA11y/core), which is MPL-2.0. MPL-2.0's copyleft is file-level and applies only to `@surea11y/core`'s own source files; consuming it as a normal package dependency doesn't affect this package's license.
|
package/package.json
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surea11y/webdriverio",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "WebdriverIO binding for surea11y -- scan real, live-rendered pages for accessibility issues.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"accessibility",
|
|
7
|
+
"a11y",
|
|
8
|
+
"wcag",
|
|
9
|
+
"wcag22",
|
|
10
|
+
"accessibility-testing",
|
|
11
|
+
"webdriverio",
|
|
12
|
+
"wdio",
|
|
13
|
+
"webdriver",
|
|
14
|
+
"e2e",
|
|
15
|
+
"e2e-testing",
|
|
16
|
+
"audit",
|
|
17
|
+
"surea11y"
|
|
18
|
+
],
|
|
5
19
|
"main": "src/index.js",
|
|
6
20
|
"types": "src/index.d.ts",
|
|
7
21
|
"author": "Jorge Rumoroso",
|
|
8
22
|
"license": "MIT",
|
|
9
23
|
"repository": {
|
|
10
24
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
25
|
+
"url": "git+https://github.com/SureA11y/webdriverio.git"
|
|
12
26
|
},
|
|
13
|
-
"homepage": "https://github.com/
|
|
27
|
+
"homepage": "https://github.com/SureA11y/webdriverio#readme",
|
|
14
28
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/SureA11y/webdriverio/issues"
|
|
16
30
|
},
|
|
17
31
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
32
|
+
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
|
19
33
|
},
|
|
20
34
|
"publishConfig": {
|
|
21
35
|
"access": "public"
|
|
@@ -27,7 +41,7 @@
|
|
|
27
41
|
],
|
|
28
42
|
"dependencies": {
|
|
29
43
|
"@surea11y/binding-base": "^1.1.0",
|
|
30
|
-
"@surea11y/core": "^1.
|
|
44
|
+
"@surea11y/core": "^1.5.0"
|
|
31
45
|
},
|
|
32
46
|
"peerDependencies": {
|
|
33
47
|
"webdriverio": ">=8.0.0"
|
|
@@ -40,7 +54,7 @@
|
|
|
40
54
|
"webdriverio": "^9.0.0"
|
|
41
55
|
},
|
|
42
56
|
"scripts": {
|
|
43
|
-
"test": "node --test
|
|
57
|
+
"test": "node --test --test-concurrency=1 tests/*.test.js",
|
|
44
58
|
"example": "node examples/basic-scan.js",
|
|
45
59
|
"example:e2e": "wdio run examples/wdio.conf.js"
|
|
46
60
|
}
|
package/src/A11yCoreBuilder.d.ts
CHANGED
|
@@ -15,9 +15,26 @@ export type Confidence = 'high' | 'medium' | 'low';
|
|
|
15
15
|
export type RuleType = 'automatic' | 'manual';
|
|
16
16
|
export type Category = 'perceivable' | 'operable' | 'understandable' | 'robust' | null;
|
|
17
17
|
|
|
18
|
+
// The reason set is open: core can add a value in a minor release, so the
|
|
19
|
+
// union stays assignable from any string rather than going stale.
|
|
20
|
+
export type LocaleResolutionReason =
|
|
21
|
+
| 'ok'
|
|
22
|
+
| 'primary-subtag'
|
|
23
|
+
| 'dictionary-not-loaded'
|
|
24
|
+
| 'unknown-locale'
|
|
25
|
+
| 'partial-dictionary'
|
|
26
|
+
| (string & {});
|
|
27
|
+
|
|
28
|
+
export interface LocaleResolution {
|
|
29
|
+
requested: string;
|
|
30
|
+
resolved: string;
|
|
31
|
+
reason: LocaleResolutionReason;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
export interface EngineInfo {
|
|
19
35
|
tag: string;
|
|
20
36
|
schemaVersion: string;
|
|
37
|
+
locale: LocaleResolution;
|
|
21
38
|
}
|
|
22
39
|
|
|
23
40
|
export interface NormativeMapping {
|