@surea11y/puppeteer 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.
Files changed (2) hide show
  1. package/README.md +15 -4
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -8,7 +8,7 @@ A Puppeteer binding for [`@surea11y/core`](https://github.com/SureA11y/core) —
8
8
  npm install @surea11y/core @surea11y/puppeteer puppeteer
9
9
  ```
10
10
 
11
- `@surea11y/core` 1.15.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.
11
+ `@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.
12
12
 
13
13
  **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.
14
14
 
@@ -40,7 +40,7 @@ await browser.close();
40
40
 
41
41
  `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. `results.engine.version` names the `@surea11y/core` release that produced it (such as `"1.12.0"`); quote it in a bug report.
42
42
 
43
- From 1.6.0 this package needs `@surea11y/core` 1.15.0 or later, which it installs with it (see [Install](#install)). Core's rules and messages change between its releases; see [What changes with `@surea11y/core` 1.15](#what-changes-with-surea11ycore-115) below and core's [changelog](https://github.com/SureA11y/core/blob/main/CHANGELOG.md).
43
+ From 1.7.0 this package needs `@surea11y/core` 1.18.0 or later, and from 1.6.0 it needed 1.15.0 or later; it installs core with it (see [Install](#install)). Core's rules and messages change between its releases; 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) below and core's [changelog](https://github.com/SureA11y/core/blob/main/CHANGELOG.md).
44
44
 
45
45
  Also see `examples/basic-scan.js` for a runnable script (`npm run example -- <url>`).
46
46
 
@@ -109,7 +109,7 @@ assert.ok(
109
109
  );
110
110
  ```
111
111
 
112
- `getScanGaps(results)` lists what the scan left out, which `checksResults` alone would pass over as clean: an `.include()` scope that matched nothing (`kind: 'context-not-found'`; nothing was scanned, so every rule reports `notApplicable`), some of several `.include()` selectors that matched nothing (`'context-partly-not-found'`), each custom rule the engine did not run (`'custom-rule-skipped'`, with the engine's reason; a custom rule you excluded yourself with `.disableRules()` is not a gap), each pack the page did not run (`'pack-skipped'`, from `results.skippedPacks`; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)), and each profile a scan of several did not run (`'profile-not-run'`, from `results.engine.profilesNotRun`, `@surea11y/core` 1.15 and later; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)). Each gap has a `message`. Checking it is what keeps a mistyped scope from passing the gate. `analyze()` also prints each gap's message with `console.warn` (as `@surea11y/puppeteer (<frame url>): <message>`, once per scanned frame under `.frames(true)`), so a scan that left something out shows in the log even where nothing asserts on it.
112
+ `getScanGaps(results)` lists what the scan left out, which `checksResults` alone would pass over as clean: an `.include()` scope that matched nothing (`kind: 'context-not-found'`; nothing was scanned, so every rule reports `notApplicable`), some of several `.include()` selectors that matched nothing (`'context-partly-not-found'`), each custom rule the engine did not run (`'custom-rule-skipped'`, with the engine's reason; a custom rule you excluded yourself with `.disableRules()` is not a gap), each pack the page did not run (`'pack-skipped'`, from `results.skippedPacks`; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)), each profile a scan of several did not run (`'profile-not-run'`, from `results.engine.profilesNotRun`, `@surea11y/core` 1.15 and later; see [Scanning with packs](#scanning-with-packs-standards-checklists-and-your-own-rules)), and a scan its time budget (`.options({ timeBudgetMs })`) cut short before every rule had started (`'scan-incomplete'`, naming the rules in `results.notRun` and any style sheets not read, `@surea11y/core` 1.18.0 and `@surea11y/binding-base` 1.8.0 and later; the style sheets the binding fetches count against the budget, half of it at most). Each gap has a `message`. Checking it is what keeps a mistyped scope from passing the gate. `analyze()` also prints each gap's message with `console.warn` (as `@surea11y/puppeteer (<frame url>): <message>`, once per scanned frame under `.frames(true)`), so a scan that left something out shows in the log even where nothing asserts on it.
113
113
 
114
114
  That warning is the right default for a test run. A project that already handles gaps itself can take them over with `.logger(fn)`: `fn(gap, result)` is called once per gap, with the gap as `getScanGaps()` gives it and the result of the frame it came from, instead of `console.warn`. A scanning service that shows gaps to its users, say, can send them once to its own structured log, rather than also printing a loose line on the server's console for every scan:
115
115
 
@@ -564,7 +564,18 @@ try {
564
564
 
565
565
  ## TypeScript
566
566
 
567
- `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 plus `@surea11y/core`'s native result shapes (`A11yCoreResult`, `CheckResult`, `Occurrence`, `CompositeResult`, etc.). The result shapes are `@surea11y/core`'s own types (its `ScanResult` and the rest), with `elementHandle` added to an occurrence, so they follow the engine: `engine.version`, `contextMatch`, `skippedCustomRules`, `shadowHostSelectors` and `margin` are all declared. `EngineError`, `ScanGap`, `ScanNote` and `EngineErrorCode` come from `@surea11y/binding-base`, and so do the types of `withWcag()` and `wcagLevel()` (`WcagVersion`, `WcagLevelInput`), of `plannedChecks()`/`plannedCriteria()` (`PlannedCheck`, `PlannedCriterion`), of `withPacks()`, which takes a pack made with `definePack` (`PackLike`), and of `.screenshots()` (`ScreenshotOptions`, and `OccurrenceScreenshot` for an occurrence's `screenshot`). `A11yCoreBuilder.installInternalsHook(page)`, `installListenerHook(page)`, `installLiveRegionHook(page)` and `announcements(page)` are typed as static methods, the last resolving to `LocatedAnnouncement[] | null` (from `@surea11y/binding-base`). 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`, and one for `'profile-not-run'`, which carries `profile`. `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. `puppeteer` is a `peerDependencies` entry (not just `devDependencies`) since the class's `page` argument and `Occurrence#elementHandle` both come from it — consumers need their own `puppeteer` install for the types to resolve, same as they already do to construct a `Page` in the first place.
567
+ `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 plus `@surea11y/core`'s native result shapes (`A11yCoreResult`, `CheckResult`, `Occurrence`, `CompositeResult`, etc.). The result shapes are `@surea11y/core`'s own types (its `ScanResult` and the rest), with `elementHandle` added to an occurrence, so they follow the engine: `engine.version`, `contextMatch`, `skippedCustomRules`, `shadowHostSelectors` and `margin` are all declared. `EngineError`, `ScanGap`, `ScanNote` and `EngineErrorCode` come from `@surea11y/binding-base`, and so do the types of `withWcag()` and `wcagLevel()` (`WcagVersion`, `WcagLevelInput`), of `plannedChecks()`/`plannedCriteria()` (`PlannedCheck`, `PlannedCriterion`), of `withPacks()`, which takes a pack made with `definePack` (`PackLike`), and of `.screenshots()` (`ScreenshotOptions`, and `OccurrenceScreenshot` for an occurrence's `screenshot`). `A11yCoreBuilder.installInternalsHook(page)`, `installListenerHook(page)`, `installLiveRegionHook(page)` and `announcements(page)` are typed as static methods, the last resolving to `LocatedAnnouncement[] | null` (from `@surea11y/binding-base`). 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. `puppeteer` is a `peerDependencies` entry (not just `devDependencies`) since the class's `page` argument and `Occurrence#elementHandle` both come from it — consumers need their own `puppeteer` install for the types to resolve, same as they already do to construct a `Page` in the first place.
568
+
569
+ ## What changes with `@surea11y/core` 1.16 to 1.18
570
+
571
+ 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):
572
+
573
+ - **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).
574
+ - **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.
575
+ - **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.
576
+ - **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.
577
+ - **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`.
578
+ - **Stricter options.** More option values are checked, with a warning, and refused under `strictOptions: true`.
568
579
 
569
580
  ## What changes with `@surea11y/core` 1.15
570
581
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surea11y/puppeteer",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Accessibility (a11y, WCAG) checks for Puppeteer scripts and 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",
@@ -45,8 +45,8 @@
45
45
  "LICENSE"
46
46
  ],
47
47
  "dependencies": {
48
- "@surea11y/binding-base": "^1.7.0",
49
- "@surea11y/core": "^1.15.0"
48
+ "@surea11y/binding-base": "^1.8.0",
49
+ "@surea11y/core": "^1.18.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "puppeteer": ">=22.0.0"