testaro 1.0.1 → 1.0.2
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 +43 -46
- package/index.js +2 -2
- package/package.json +1 -1
- package/tests/wave.js +1 -1
package/README.md
CHANGED
|
@@ -8,36 +8,30 @@ Testaro is a collection of web accessibility tests.
|
|
|
8
8
|
|
|
9
9
|
The purpose of Testaro is to provide programmatic access to over 600 accessibility tests defined in several test packages and in Testaro itself.
|
|
10
10
|
|
|
11
|
-
Calling Testaro requires telling it which operations (including tests) to perform
|
|
11
|
+
Calling Testaro requires telling it which operations (including tests) to perform, which URLs to perform them on, and where to write its reports.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Testaro is derived from [Autotest](https://github.com/jrpool/autotest).
|
|
16
|
-
|
|
17
|
-
Testaro omits some functionalities of Autotest, such as:
|
|
18
|
-
- tests producing results intended to be human-inspected
|
|
19
|
-
- previous versions of scoring algorithms
|
|
20
|
-
- file operations for score aggregation, report revision, and HTML reports
|
|
21
|
-
- a web user interface
|
|
13
|
+
Testaro outputs progress messages and a list of reports to the standard output. It writes the reports in JSON format.
|
|
22
14
|
|
|
23
15
|
## System requirements
|
|
24
16
|
|
|
25
17
|
Version 14 or later of [Node.js](https://nodejs.org/en/).
|
|
26
18
|
|
|
27
|
-
A file system with a directory that Testaro has permission to read and write in.
|
|
19
|
+
A file system with a directory that the Testaro user has permission to read and write in.
|
|
28
20
|
|
|
29
|
-
##
|
|
21
|
+
## Dependencies
|
|
30
22
|
|
|
31
|
-
Testaro uses
|
|
23
|
+
Testaro uses:
|
|
24
|
+
- [Playwright](https://playwright.dev/) to launch browsers, perform user actions in them, and perform tests
|
|
25
|
+
- [pixelmatch](https://www.npmjs.com/package/pixelmatch) to measure motion
|
|
32
26
|
|
|
33
|
-
Testaro
|
|
27
|
+
Testaro includes some of its own accessibility tests. In addition, it performs the tests in:
|
|
34
28
|
- [accessibility-checker](https://www.npmjs.com/package/accessibility-checker) (the IBM Equal Access Accessibility Checker)
|
|
35
29
|
- [alfa](https://alfa.siteimprove.com/) (Siteimprove alfa)
|
|
36
30
|
- [Automated Accessibility Testing Tool](https://www.npmjs.com/package/aatt) (Paypal AATT, running HTML CodeSniffer)
|
|
37
31
|
- [axe-playwright](https://www.npmjs.com/package/axe-playwright) (Deque Axe-core)
|
|
38
32
|
- [WAVE API](https://wave.webaim.org/api/) (WebAIM WAVE)
|
|
39
33
|
|
|
40
|
-
As of
|
|
34
|
+
As of this version, the counts of tests in the packages referenced above were:
|
|
41
35
|
- AATT: 98
|
|
42
36
|
- Alfa: 103
|
|
43
37
|
- Axe-core: 138
|
|
@@ -57,11 +51,7 @@ The main directories containing code files are:
|
|
|
57
51
|
|
|
58
52
|
## Installation
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Then make its directory your working directory (`cd testaro`).
|
|
63
|
-
|
|
64
|
-
Before installing its dependencies, authorize yourself to install them. You presumably are already authorized to install dependencies from `https://npmjs.org`. But some of the Testaro dependencies are not there, but rather at `https://npm.pkg.github.com`. If you are not already authorized to install packages from that registry, authorize yourself as follows:
|
|
54
|
+
Some of the dependencies of Testaro are published as Github packages. Installing Testaro therefore requires you to be authorized to read Github packages. If you do not yet have that authorization, you can give it to yourself as follows:
|
|
65
55
|
- Log in at [Github](https://github.com).
|
|
66
56
|
- From your avatar in the upper-right corner, choose “Settings”.
|
|
67
57
|
- In the left sidebar, choose “Developer settings”.
|
|
@@ -72,7 +62,7 @@ Before installing its dependencies, authorize yourself to install them. You pres
|
|
|
72
62
|
- Check the checkbox `read:packages`.
|
|
73
63
|
- Activate the button “Generate token”.
|
|
74
64
|
- Copy the generated token (you can use the copy icon next to it).
|
|
75
|
-
- In
|
|
65
|
+
- In the local directory of the project into which you will install Testaro, create a file named `.npmrc`, unless it already exists.
|
|
76
66
|
- Populate the `.npmrc` file with the following statements, replacing `abc` with your Github username and `xyz` with the token that you copied:
|
|
77
67
|
|
|
78
68
|
```bash
|
|
@@ -80,18 +70,15 @@ Before installing its dependencies, authorize yourself to install them. You pres
|
|
|
80
70
|
//npm.pkg.github.com/:username=abc
|
|
81
71
|
//npm.pkg.github.com/:_authToken=xyz
|
|
82
72
|
```
|
|
73
|
+
Once you have done that, you can install Testaro as you would install any `npm` package.
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## Configuration
|
|
75
|
+
## Payment
|
|
87
76
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Use of WAVE requires you to have a WAVE API key (see the link above under “Technologies”).
|
|
77
|
+
All of the tests that Testaro can perform are free of cost, except those in the WAVE package. WebAIM requires an API key for those tests. If you wish to have Testaro perform the WAVE tests, you will need to have a WAVE API key. Visit the URL above in order to obtain your key. It costs 1 to 3 credits to perform the WAVE tests on one URL. WebAIM gives you 100 credits without cost, before you need to begin paying.
|
|
91
78
|
|
|
92
79
|
## Specification
|
|
93
80
|
|
|
94
|
-
To use Testaro, you must specify what it should do. You do this
|
|
81
|
+
To use Testaro, you must specify what it should do. You do this with a script and optionally a batch.
|
|
95
82
|
|
|
96
83
|
## Scripts
|
|
97
84
|
|
|
@@ -145,9 +132,9 @@ If the `strict` property is `true`, Testaro will accept redirections that add or
|
|
|
145
132
|
|
|
146
133
|
### Commands
|
|
147
134
|
|
|
148
|
-
####
|
|
135
|
+
#### Introduction
|
|
149
136
|
|
|
150
|
-
The `commands` property’s value is an array of
|
|
137
|
+
The `commands` property’s value is an array of command objects.
|
|
151
138
|
|
|
152
139
|
Each command has a `type` property and optionally has a `name` property (used in branching, described below). It must or may have other properties, depending on the value of `type`.
|
|
153
140
|
|
|
@@ -399,8 +386,8 @@ The second item in each array, if there are 3 items in the array, is an operator
|
|
|
399
386
|
## Batches
|
|
400
387
|
|
|
401
388
|
There are two ways to use a script to give instructions to Testaro:
|
|
402
|
-
- The script can be the complete specification of the
|
|
403
|
-
- The script can specify the operations to perform, and a _batch_ can specify which
|
|
389
|
+
- The script can be the complete specification of the operations to perform and the URLs to perform them on.
|
|
390
|
+
- The script can specify the operations to perform, and a _batch_ can specify which URLs to perform them on.
|
|
404
391
|
|
|
405
392
|
A batch is a JSON file with this format:
|
|
406
393
|
|
|
@@ -420,9 +407,9 @@ A batch is a JSON file with this format:
|
|
|
420
407
|
}
|
|
421
408
|
```
|
|
422
409
|
|
|
423
|
-
When you combine a script with a batch, Testaro performs the script, replacing the `which` and `what` properties of all `url` commands with the values in the first object in the `hosts` array, then again with the values in the second object, and so on. Those replacements also occur in the inserted extra `url` commands mentioned above.
|
|
410
|
+
When you combine a script with a batch, Testaro performs the script, replacing the `which` and `what` properties of all `url` commands with the values in the first object in the `hosts` array of the batch, then again with the values in the second `host` object, and so on. Those replacements also occur in the inserted extra `url` commands mentioned above.
|
|
424
411
|
|
|
425
|
-
A batch offers an efficient way to perform a uniform set of
|
|
412
|
+
A batch offers an efficient way to perform a uniform set of operations on every host in a set of hosts. In this way you can run the same set of tests on multiple web pages.
|
|
426
413
|
|
|
427
414
|
A no-batch script offers a way to carry out a complex operation, which can include navigating from one host to another, which is not possible with a batch. Any `url` commands are performed as-is, without changes to their URLs.
|
|
428
415
|
|
|
@@ -436,29 +423,29 @@ Testaro also writes to standard output a list of the names of the files containi
|
|
|
436
423
|
|
|
437
424
|
### Invocation
|
|
438
425
|
|
|
439
|
-
To run Testaro, create
|
|
426
|
+
To run Testaro, create an _invocation_ file like this:
|
|
440
427
|
|
|
441
428
|
```javascript
|
|
442
429
|
const options = {
|
|
443
|
-
reports:
|
|
444
|
-
|
|
445
|
-
|
|
430
|
+
reports: `${__readdir}/path/to/reports/directory`,
|
|
431
|
+
batch: `${__readdir}/path/to/batch/file.json`,
|
|
432
|
+
script: `${__readdir}/path/to/script/file.json`
|
|
446
433
|
};
|
|
447
|
-
const {handleRequest} = require('
|
|
434
|
+
const {handleRequest} = require('testaro');
|
|
448
435
|
handleRequest(options);
|
|
449
436
|
```
|
|
450
437
|
|
|
451
|
-
The `batch` option is optional. If there is no batch, it
|
|
438
|
+
The `batch` option is optional. If there is no batch, omit it.
|
|
452
439
|
|
|
453
|
-
The paths
|
|
440
|
+
The paths are relative to the directory containing the file. So, if the script file is `script.json` and is in the same directory as the invocation file, the path would be `${__readdir}/script.json`.
|
|
454
441
|
|
|
455
|
-
If the file
|
|
442
|
+
If the invocation file is named `runTestaro.js`, execute it with the statement `node runTestaro`.
|
|
456
443
|
|
|
457
444
|
### Environment variables
|
|
458
445
|
|
|
459
|
-
If a `wave` test is included in the script, an environment variable named `
|
|
446
|
+
If a `wave` test is included in the script, an environment variable named `TESTARO_WAVE_KEY` must exist, with your WAVE API key as its value.
|
|
460
447
|
|
|
461
|
-
Before executing a Testaro script, you can also set the environment variables `
|
|
448
|
+
Before executing a Testaro script, you can optionally also set the environment variables `TESTARO_DEBUG` (to `'true'` or anything else) and/or `TESTARO_WAITS` (to a non-negative integer). The effects of these variables are described in the `index.js` file.
|
|
462
449
|
|
|
463
450
|
## Contribution
|
|
464
451
|
|
|
@@ -466,7 +453,7 @@ You can define additional Testaro commands and functionality. Contributions are
|
|
|
466
453
|
|
|
467
454
|
## Accessibility principles
|
|
468
455
|
|
|
469
|
-
The rationales motivating the Testaro-defined tests and scoring procs can be found in comments within the files of those tests and procs, in the `tests` and `procs/score` directories. Unavoidably, each test is opinionated. Testaro itself, however, can accommodate other tests representing different opinions. Testaro is intended to be neutral with respect to questions such as the criteria for accessibility, the severities of accessibility issues, whether accessibility
|
|
456
|
+
The rationales motivating the Testaro-defined tests and scoring procs can be found in comments within the files of those tests and procs, in the `tests` and `procs/score` directories. Unavoidably, each test is opinionated. Testaro itself, however, can accommodate other tests representing different opinions. Testaro is intended to be neutral with respect to questions such as the criteria for accessibility, the severities of accessibility issues, whether accessibility is binary or graded, and the distinction between usability and accessibility.
|
|
470
457
|
|
|
471
458
|
### Future work
|
|
472
459
|
|
|
@@ -491,12 +478,22 @@ The Playwright “Receives Events” actionability check does **not** check whet
|
|
|
491
478
|
|
|
492
479
|
### Test-package duplication
|
|
493
480
|
|
|
494
|
-
Test packages sometimes do redundant testing, in that two or more packages test for the same issues. But such duplications are not necessarily perfect. Therefore, the scoring procs currently
|
|
481
|
+
Test packages sometimes do redundant testing, in that two or more packages test for the same issues. But such duplications are not necessarily perfect. Therefore, the scoring procs currently defined by Testaro do not select a single package to test for a single issue. Instead, they allow all packages to test for all the issues they can test for, but decrease the weights placed on issues that multiple packages test for. The more packages test for an issue, the smaller the weight placed on each package’s finding of that issue.
|
|
495
482
|
|
|
496
483
|
## Repository exclusions
|
|
497
484
|
|
|
498
485
|
The files in the `temp` directory are presumed ephemeral and are not tracked by `git`. When tests require temporary files to be written, Testaro writes them there.
|
|
499
486
|
|
|
487
|
+
## Origin
|
|
488
|
+
|
|
489
|
+
Testaro is derived from [Autotest](https://github.com/jrpool/autotest), which in turn is derived from accessibility test investigations beginning in 2018.
|
|
490
|
+
|
|
491
|
+
Testaro omits some functionalities of Autotest, such as:
|
|
492
|
+
- tests producing results intended to be human-inspected
|
|
493
|
+
- previous versions of scoring algorithms
|
|
494
|
+
- file operations for score aggregation, report revision, and HTML reports
|
|
495
|
+
- a web user interface
|
|
496
|
+
|
|
500
497
|
## Etymology
|
|
501
498
|
|
|
502
499
|
“Testaro” means “collection of tests” in Esperanto.
|
package/index.js
CHANGED
|
@@ -9,9 +9,9 @@ const fs = require('fs/promises');
|
|
|
9
9
|
const {commands} = require('./commands');
|
|
10
10
|
// ########## CONSTANTS
|
|
11
11
|
// Set DEBUG environment variable to 'true' to add debugging features.
|
|
12
|
-
const debug = process.env.
|
|
12
|
+
const debug = process.env.TESTARO_DEBUG === 'true';
|
|
13
13
|
// Set WAITS environment variable to a positive number to insert delays (in ms).
|
|
14
|
-
const waits = Number.parseInt(process.env.
|
|
14
|
+
const waits = Number.parseInt(process.env.TESTARO_WAITS) || 0;
|
|
15
15
|
// CSS selectors for targets of moves.
|
|
16
16
|
const moves = {
|
|
17
17
|
button: 'button',
|
package/package.json
CHANGED
package/tests/wave.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const https = require('https');
|
|
8
8
|
exports.reporter = async (page, reportType) => {
|
|
9
|
-
const waveKey = process.env.
|
|
9
|
+
const waveKey = process.env.TESTARO_WAVE_KEY;
|
|
10
10
|
// Get the data from a WAVE test.
|
|
11
11
|
const data = await new Promise(resolve => {
|
|
12
12
|
https.get(
|