@surea11y/playwright 1.6.0 → 1.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/README.md +15 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npm install @surea11y/core @surea11y/playwright playwright
|
|
|
9
9
|
npx playwright install chromium # every test launches a real browser -- npm install alone doesn't fetch it
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
`@surea11y/core` 1.
|
|
12
|
+
`@surea11y/core` 1.18.0 or later, the engine, comes with the binding as a regular dependency, so a project that doesn't list it still works. List it in your own `package.json` too, as the line above does: your project and the binding then share one copy, so whatever you do with core directly, writing a SARIF log or an HTML report (`@surea11y/core/sarif`, `/report`), reading the rule catalogue or keeping a baseline, reads results with the same core that produced them. When your core can't match the binding's range, as with a linked checkout (`file:../core`) or a fork, add `"overrides": { "@surea11y/core": "$@surea11y/core" }` beside it.
|
|
13
13
|
|
|
14
14
|
**Coming in 2.0:** core becomes a peer dependency, so the binding will no longer install it for you, and the `overrides` entry is no longer needed. Add `@surea11y/core` to your `package.json` now and 2.0 needs no change.
|
|
15
15
|
|
|
@@ -39,7 +39,7 @@ await browser.close();
|
|
|
39
39
|
|
|
40
40
|
`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.
|
|
41
41
|
|
|
42
|
-
Every result says which `@surea11y/core` release produced it, in `results.engine.version` (for example `"1.12.0"`): quote it in a bug report, and compare it when two runs disagree. From 1.
|
|
42
|
+
Every result says which `@surea11y/core` release produced it, in `results.engine.version` (for example `"1.12.0"`): quote it in a bug report, and compare it when two runs disagree. From 1.7.0 this package needs `@surea11y/core` 1.18.0 or later, from 1.6.0 it needed 1.15.0 or later, and from 1.5.0 it needed 1.14.0 or later; see [What changes with `@surea11y/core` 1.16 to 1.18](#what-changes-with-surea11ycore-116-to-118), [What changes with `@surea11y/core` 1.15](#what-changes-with-surea11ycore-115) and [What changes with `@surea11y/core` 1.14](#what-changes-with-surea11ycore-114).
|
|
43
43
|
|
|
44
44
|
Also see `examples/basic-scan.js` for a runnable script (`npm run example -- <url>`).
|
|
45
45
|
|
|
@@ -99,7 +99,7 @@ const gaps = getScanGaps(results);
|
|
|
99
99
|
// message: 'Nothing was scanned: the scan scope matched no element ("#main").' }]
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
Each gap has a `kind`: `'context-not-found'` (nothing was scanned), `'context-partly-not-found'` (some of several selectors matched nothing), `'custom-rule-skipped'` (a custom rule the engine could not run, one per rule, from `results.skippedCustomRules`; one you excluded yourself with `.disableRules()` is not a gap), `'pack-skipped'` (a pack that did not run, one per pack, from `results.skippedPacks`; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)),
|
|
102
|
+
Each gap has a `kind`: `'context-not-found'` (nothing was scanned), `'context-partly-not-found'` (some of several selectors matched nothing), `'custom-rule-skipped'` (a custom rule the engine could not run, one per rule, from `results.skippedCustomRules`; one you excluded yourself with `.disableRules()` is not a gap), `'pack-skipped'` (a pack that did not run, one per pack, from `results.skippedPacks`; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)), `'profile-not-run'` (a profile a scan of several did not run, one per profile, from `results.engine.profilesNotRun`; `@surea11y/core` 1.15 and later), or `'scan-incomplete'` (the scan's time budget, `.options({ timeBudgetMs })`, ran out before every rule had started: the rules in `results.notRun` and any style sheets not read, in `incomplete`; `@surea11y/core` 1.18.0 and `@surea11y/binding-base` 1.8.0 and later). With a time budget, the style sheets the binding fetches count against it: fetching may take half of it, and the scan gets what is left.
|
|
103
103
|
|
|
104
104
|
`.analyze()` also prints each gap with `console.warn`, once per scanned frame, prefixed with the frame's URL, for example `@surea11y/playwright (https://example.com/): Nothing was scanned: the scan scope matched no element ("#main").` The engine warns too, but in the page's console, which a Playwright run doesn't show. The warning doesn't fail anything: to fail a test on a gap, assert on `getScanGaps(results)` as below.
|
|
105
105
|
|
|
@@ -566,7 +566,18 @@ Every occurrence already carries `selector` and (with `.elementRef(true)`, above
|
|
|
566
566
|
|
|
567
567
|
## TypeScript
|
|
568
568
|
|
|
569
|
-
`src/A11yCoreBuilder.d.ts` (re-exported from `src/index.d.ts`, wired up via `package.json`'s `types` field) ships types for the whole builder API and the result (`A11yCoreResult`, `CheckResult`, `Occurrence`, `CompositeResult`, etc.). The result types are built on the ones `@surea11y/core` ships, so they carry every field the engine returns (`engine.version`, `engine.environment`, `contextMatch`, `skippedCustomRules`, `shadowHostSelectors`, `margin`, ...); this package adds `elementHandle`, `screenshot` (`OccurrenceScreenshot`) and the `.frames(true)` shape. `EngineError`/`EngineErrorCode`, `getScanGaps()`/`ScanGap`, `getScanNotes()`/`ScanNote` and `formatOccurrenceLocation()` are typed too, and so are `withWcag()` and `wcagLevel()` (`WcagVersion`, `WcagLevelInput`), `plannedChecks()`/`plannedCriteria()` (`PlannedCheck`, `PlannedCriterion`), the static `installInternalsHook()`, `installListenerHook()` and `installLiveRegionHook()` (each taking a `Page` or a `BrowserContext`) and `announcements(page)`, which resolves to `LocatedAnnouncement[] | null`, `formatFailures()`'s review groups (`ReviewGroup`) and `howToCheck` option, `withPacks()`, which takes a pack made with `definePack` (`PackLike`), and `.screenshots()` (`ScreenshotOptions`). Code that handles every `ScanGap` kind it knows and treats the rest in an `else` branch needs a branch for `'pack-skipped'`, which carries `pack` rather than `selectors`,
|
|
569
|
+
`src/A11yCoreBuilder.d.ts` (re-exported from `src/index.d.ts`, wired up via `package.json`'s `types` field) ships types for the whole builder API and the result (`A11yCoreResult`, `CheckResult`, `Occurrence`, `CompositeResult`, etc.). The result types are built on the ones `@surea11y/core` ships, so they carry every field the engine returns (`engine.version`, `engine.environment`, `contextMatch`, `skippedCustomRules`, `shadowHostSelectors`, `margin`, ...); this package adds `elementHandle`, `screenshot` (`OccurrenceScreenshot`) and the `.frames(true)` shape. `EngineError`/`EngineErrorCode`, `getScanGaps()`/`ScanGap`, `getScanNotes()`/`ScanNote` and `formatOccurrenceLocation()` are typed too, and so are `withWcag()` and `wcagLevel()` (`WcagVersion`, `WcagLevelInput`), `plannedChecks()`/`plannedCriteria()` (`PlannedCheck`, `PlannedCriterion`), the static `installInternalsHook()`, `installListenerHook()` and `installLiveRegionHook()` (each taking a `Page` or a `BrowserContext`) and `announcements(page)`, which resolves to `LocatedAnnouncement[] | null`, `formatFailures()`'s review groups (`ReviewGroup`) and `howToCheck` option, `withPacks()`, which takes a pack made with `definePack` (`PackLike`), and `.screenshots()` (`ScreenshotOptions`). Code that handles every `ScanGap` kind it knows and treats the rest in an `else` branch needs a branch for `'pack-skipped'`, which carries `pack` rather than `selectors`, one for `'profile-not-run'`, which carries `profile`, and one for `'scan-incomplete'` (`@surea11y/binding-base` 1.8.0 and later), which carries `incomplete`. `analyze()` is typed `Promise<A11yCoreResult | A11yCoreMultiFrameResult>` — narrow on `'topFrame' in results` (or cast, if you already know which mode you called) to get the specific shape back, since a fluent builder can't statically track that `.frames(true)` was called earlier in the chain. `playwright` is a `peerDependencies` entry (not just `devDependencies`) since the class's `page` argument and `Occurrence#elementHandle` both come from it — consumers need their own `playwright` install for the types to resolve, same as they already do to construct a `Page` in the first place.
|
|
570
|
+
|
|
571
|
+
## What changes with `@surea11y/core` 1.16 to 1.18
|
|
572
|
+
|
|
573
|
+
With `@surea11y/core` 1.18.0, what a scan through this binding shows differently from 1.15 (core's [`CHANGELOG.md`](https://github.com/SureA11y/core/blob/main/CHANGELOG.md) has the full list):
|
|
574
|
+
|
|
575
|
+
- **New rules.** In a browser, `focus-not-obscured-minimum` (2.4.11) and `focus-not-obscured-enhanced` (2.4.12) ask about fixed or sticky boxes that focus can hide behind, and `reflow-horizontal-scroll` (1.4.10) and `resize-text-content-loss` (1.4.4) measure the layout and ask, never fail. `target-size-enhanced` (2.5.5) fails targets under 44 by 44 CSS pixels; `form-group-name-present` (1.3.1), `symbol-graphic-contrast` (1.4.11), `link-name-quality-link-only` (2.4.9) and `page-zones-landmark` (a best practice) ask. A full scan takes a little longer in Chromium for them (about 4% in 1.17 and 9% in 1.18, by core's measures).
|
|
576
|
+
- **A time budget and a cap.** `.options({ timeBudgetMs })` stops starting rules once the scan has spent that long, the style sheets the binding fetches included, and a scan cut short is a `'scan-incomplete'` gap, never a clean scan. `.options({ output: { maxOccurrencesPerRule } })` keeps at most that many occurrences per rule, failures first, without changing outcomes or gates.
|
|
577
|
+
- **Results you may notice.** A few findings that failed now ask: a video with a poster and no name, and a list item whose list's role replaces list. `target-size-minimum` measures every interactive widget, not only buttons and links, and gives unstyled native controls their exception; `aria-disabled` exempts contrast only on controls. Messages name the root cause (why an element has no name, a likely typo in a role or attribute) and describe the check instead of naming the criterion, so a test that matches a message's text may need the new wording; outcomes and reason codes are unchanged.
|
|
578
|
+
- **Profiles for WCAG 2.0 and 2.1**, beside 2.2's: `.options({ profile: 'wcag21-aa' })` and the others judge the page by that version and level; `section508` is deprecated for `wcag20-aa`, which gives the same results.
|
|
579
|
+
- **Packs.** A pack whose `core` range leaves out 1.18 (such as `~1.17.0`) is skipped, a `'pack-skipped'` gap; widen its range to `^1.18.0`.
|
|
580
|
+
- **Stricter options.** More option values are checked, with a warning, and refused under `strictOptions: true`.
|
|
570
581
|
|
|
571
582
|
## What changes with `@surea11y/core` 1.15
|
|
572
583
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surea11y/playwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Accessibility (a11y, WCAG) checks for Playwright tests: scan the live page with new A11yCoreBuilder({ page }).analyze() and get only proven violations, with findings that need human review listed separately.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"LICENSE"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@surea11y/binding-base": "^1.
|
|
50
|
-
"@surea11y/core": "^1.
|
|
49
|
+
"@surea11y/binding-base": "^1.8.0",
|
|
50
|
+
"@surea11y/core": "^1.18.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"playwright": ">=1.0.0"
|