testaro 65.1.1 → 66.0.1

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 CHANGED
@@ -48,7 +48,7 @@ Testaro uses:
48
48
  - [Playwright](https://playwright.dev/) to launch browsers, perform user actions in them, and perform tests
49
49
  - [playwright-extra](https://www.npmjs.com/package/playwright-extra) and [puppeteer-extra-plugin-stealth](https://www.npmjs.com/package/puppeteer-extra-plugin-stealth) to make a Playwright-controlled browser more indistinguishable from a human-operated browser and thus make their requests more likely to succeed
50
50
  - [playwright-dompath](https://www.npmjs.com/package/playwright-dompath) to retrieve XPaths of elements
51
- - [pixelmatch](https://www.npmjs.com/package/pixelmatch) to measure motion
51
+ - [BlazeDiff](https://blazediff.dev/) to measure motion
52
52
 
53
53
  Testaro performs tests of these _tools_:
54
54
 
package/UPGRADES.md CHANGED
@@ -54,7 +54,7 @@ I'll quickly scan for module patterns and JSON imports across the repo to tailor
54
54
  - Strategy for optional properties and progressive enrichment during execution.
55
55
 
56
56
  - **3rd‑party types and augmentations**
57
- - Verify/choose type packages for `playwright`, `@siteimprove/alfa-*`, `axe-playwright`, `@qualweb/*`, `accessibility-checker`, `playwright-dompath`, `pixelmatch`. Plan fallbacks if defs are missing.
57
+ - Verify/choose type packages for `playwright`, `@siteimprove/alfa-*`, `axe-playwright`, `@qualweb/*`, `accessibility-checker`, `playwright-dompath`. Plan fallbacks if defs are missing.
58
58
  - Decide on module augmentation vs casting for custom fields (e.g., `page.browserID` assignment requires augmenting `playwright.Page` or casting).
59
59
 
60
60
  - **Dynamic loading patterns**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "65.1.1",
3
+ "version": "66.0.1",
4
4
  "description": "Run 1000 web accessibility tests from 11 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "homepage": "https://github.com/jrpool/testaro#readme",
32
32
  "dependencies": {
33
+ "@blazediff/core": "*",
33
34
  "@qualweb/core": "*",
34
35
  "@qualweb/act-rules": "*",
35
36
  "@qualweb/wcag-techniques": "*",
@@ -43,11 +44,11 @@
43
44
  "aslint-testaro": "*",
44
45
  "axe-playwright": "*",
45
46
  "dotenv": "*",
46
- "pixelmatch": "*",
47
47
  "playwright": "*",
48
48
  "playwright-dompath": "*",
49
49
  "playwright-extra": "*",
50
50
  "playwright-extra-plugin-stealth": "*",
51
+ "pngjs": "*",
51
52
  "puppeteer-extra-plugin-stealth": "*",
52
53
  "vnu-jar": "*"
53
54
  },
package/testaro/motion.js CHANGED
@@ -19,7 +19,7 @@ const fs = require('fs/promises');
19
19
  // Module to get operating-system properties.
20
20
  const os = require('os');
21
21
  // Module to compare screenshots.
22
- const pixelmatch = require('pixelmatch').default;
22
+ const blazediff = require('@blazediff/core').diff;
23
23
  // Module to parse PNGs.
24
24
  const {PNG} = require('pngjs');
25
25
 
@@ -60,7 +60,7 @@ exports.reporter = async page => {
60
60
  // Otherwise, i.e. if their dimensions are identical:
61
61
  else {
62
62
  // Get the count of differing pixels between the shots.
63
- const pixelChanges = pixelmatch(shoot0PNG.data, shoot1PNG.data, null, width, height);
63
+ const pixelChanges = blazediff(shoot0PNG.data, shoot1PNG.data, null, width, height);
64
64
  // Get the ratio of differing to all pixels as a percentage.
65
65
  const changePercent = Math.round(100 * pixelChanges / (width * height));
66
66
  // Free the memory used by screenshots.
package/tests/testaro.js CHANGED
@@ -393,13 +393,6 @@ const allRules = [
393
393
  timeOut: 10,
394
394
  defaultOn: true
395
395
  },
396
- {
397
- id: 'motionSolo',
398
- what: 'motion without user request, measured within this test',
399
- launchRole: 'waster',
400
- timeOut: 15,
401
- defaultOn: false
402
- },
403
396
  {
404
397
  id: 'textNodes',
405
398
  what: 'data on specified text nodes',
@@ -1,103 +0,0 @@
1
- /*
2
- © 2023–2025 CVS Health and/or one of its affiliates. All rights reserved.
3
- © 2025 Jonathan Robert Pool.
4
-
5
- Licensed under the MIT License. See LICENSE file at the project root or
6
- https://opensource.org/license/mit/ for details.
7
-
8
- SPDX-License-Identifier: MIT
9
- */
10
-
11
- /*
12
- visChange
13
- This procedure reports a change in the visible content of a page between two times, optionally
14
- hovering over a locator-defined element immediately after the first time. This test uses the
15
- Playwright page.screenshot method, which is not implemented for the firefox browser type.
16
- */
17
-
18
- // IMPORTS
19
-
20
- const pixelmatch = require('pixelmatch').default;
21
- const {PNG} = require('pngjs');
22
- const {screenShot} = require('./screenShot');
23
-
24
- // FUNCTIONS
25
-
26
- exports.visChange = async (page, options = {}) => {
27
- const {delayBefore, delayBetween, exclusion} = options;
28
- // Wait, if required.
29
- if (delayBefore) {
30
- await page.waitForTimeout(delayBefore);
31
- }
32
- // If an exclusion was specified:
33
- if (exclusion) {
34
- // Hover over the upper-left corner of the page for test isolation.
35
- const docLoc = page.locator('html');
36
- await docLoc.hover({
37
- position: {
38
- x: 0,
39
- y: 0
40
- }
41
- });
42
- }
43
- // Make and get a screenshot, excluding an element if specified.
44
- const shot0 = await screenShot(page, exclusion);
45
- // If it succeeded:
46
- if (shot0.length) {
47
- // If an exclusion was specified:
48
- if (exclusion) {
49
- // Hover over it.
50
- try {
51
- await exclusion.hover({
52
- timeout: 500,
53
- noWaitAfter: true
54
- });
55
- }
56
- catch(error) {
57
- return {
58
- prevented: true,
59
- error: 'Hovering failed'
60
- };
61
- }
62
- }
63
- // Wait as specified, or 3 seconds.
64
- await page.waitForTimeout(delayBetween || 3000);
65
- // Make and get another screenshot.
66
- const shot1 = await screenShot(page, exclusion);
67
- // If it succeeded:
68
- if (shot1.length) {
69
- // Get the shots as PNG images.
70
- const pngs = [shot0, shot1].map(shot => PNG.sync.read(shot));
71
- // Get their dimensions.
72
- const {width, height} = pngs[0];
73
- // Get the count of differing pixels between the shots.
74
- const pixelChanges = pixelmatch(pngs[0].data, pngs[1].data, null, width, height);
75
- // Get the ratio of differing to all pixels as a percentage.
76
- const changePercent = 100 * pixelChanges / (width * height);
77
- // Return this.
78
- return {
79
- prevented: false,
80
- width,
81
- height,
82
- pixelChanges,
83
- changePercent
84
- };
85
- }
86
- // Otherwise, i.e. if the second screenshot failed:
87
- else {
88
- // Return this.
89
- return {
90
- prevented: true,
91
- error: 'Second screenshot failed'
92
- };
93
- }
94
- }
95
- // Otherwise, i.e. if the first screenshot failed:
96
- else {
97
- // Return this.
98
- return {
99
- prevented: true,
100
- error: 'First screenshot failed'
101
- };
102
- }
103
- };
@@ -1,68 +0,0 @@
1
- /*
2
- © 2021–2024 CVS Health and/or one of its affiliates. All rights reserved.
3
- © 2025 Jonathan Robert Pool.
4
-
5
- Licensed under the MIT License. See LICENSE file at the project root or
6
- https://opensource.org/license/mit/ for details.
7
-
8
- SPDX-License-Identifier: MIT
9
- */
10
-
11
- /*
12
- motion
13
- This test reports motion in a page. For minimal accessibility, standards require motion to be brief, or else stoppable by the user. But stopping motion can be difficult or impossible, and, by the time a user manages to stop motion, the motion may have caused annoyance or harm. For superior accessibility, a page contains no motion until and unless the user authorizes it. The test compares two screen shots of the viewport 2 seconds and 6 seconds after page load. It reports a rule violation if any pixels change. The larger the change fraction, the greater the ordinal severity.
14
-
15
- This test is an alternative to the motion test. Whereas the motion test relies on screenshots made earlier in the same job by the shoot test, this test makes its own screenshots. MotionSolo waits several seconds between its screenshots to allow time for motion to occur. That wait makes motionSolo, and any job containing it, take longer than the combination of shoot tests and the motion test.
16
-
17
- WARNING: This test uses the procs/visChange module. See the warning in that module about browser types.
18
- */
19
-
20
- // IMPORTS
21
-
22
- // Module to get pixel changes between two times.
23
- const {visChange} = require('../procs/visChange');
24
-
25
- // FUNCTIONS
26
-
27
- // Reports motion in a page.
28
- exports.reporter = async page => {
29
- // Initialize the totals and standard instances.
30
- const totals = [0, 0, 0, 0];
31
- const standardInstances = [];
32
- // Make screenshots and get the result.
33
- const data = await visChange(page, {
34
- delayBefore: 2000,
35
- delayBetween: 3000
36
- });
37
- // If the screenshots succeeded:
38
- if (! data.prevented) {
39
- // If any pixels were changed:
40
- if (data.pixelChanges) {
41
- // Get the ordinal severity from the fractional pixel change.
42
- const ordinalSeverity = Math.floor(Math.min(3, 0.4 * Math.sqrt(data.changePercent)));
43
- // Add to the totals.
44
- totals[ordinalSeverity] = 1;
45
- // Get a summary standard instance.
46
- standardInstances.push({
47
- ruleID: 'motionSolo',
48
- what: 'Content moves or changes without user request',
49
- count: 1,
50
- ordinalSeverity,
51
- tagName: 'HTML',
52
- id: '',
53
- location: {
54
- doc: '',
55
- type: '',
56
- spec: ''
57
- },
58
- excerpt: ''
59
- });
60
- }
61
- }
62
- // Return the result.
63
- return {
64
- data,
65
- totals,
66
- standardInstances
67
- };
68
- };