testaro 72.3.2 → 72.4.3
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 +63 -33
- package/package.json +1 -1
- package/tests/testaro.js +7 -2
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@ Ensemble testing for web accessibility
|
|
|
4
4
|
|
|
5
5
|
## Breaking change notice
|
|
6
6
|
|
|
7
|
-
Version 68.0.0
|
|
7
|
+
Version 68.0.0 introduced major breaking changes.
|
|
8
8
|
|
|
9
9
|
Any application that has successfully relied on version 67.1.0 is likely to fail if it updates the `testaro` dependency to version 68.0.0 or later. To prevent such failures, pin `testaro` to version 67.1.0 in your `package.json` file.
|
|
10
10
|
|
|
11
|
-
Revision of this `README` document to reflect version
|
|
11
|
+
Revision of this `README` document to reflect the latest version is in progress but is incomplete.
|
|
12
12
|
|
|
13
13
|
## Purposes
|
|
14
14
|
|
|
@@ -28,13 +28,13 @@ Testaro is described in two papers:
|
|
|
28
28
|
|
|
29
29
|
## Functionality
|
|
30
30
|
|
|
31
|
-
Testaro performs tasks defined by a _job_. Typically, a job identifies the URL of a web page and asks Testaro to call an ensemble of
|
|
31
|
+
Testaro performs tasks defined by a _job_. Typically, a job identifies the URL of a web page and asks Testaro to call an ensemble of tools to test the page. Testaro adds the results of the testing to the job, thereby converting the job into a _report_.
|
|
32
32
|
|
|
33
33
|
Testaro can be given a job to perform, in which case it performs the job, delivers the report, and quits.
|
|
34
34
|
|
|
35
|
-
Alternatively, testaro can run as a daemon,
|
|
35
|
+
Alternatively, testaro can run as a daemon, polling a server or a directory for new jobs and performing them when they are provided or when they appear in the directory.
|
|
36
36
|
|
|
37
|
-
A practical application that leverages Testaro will use other software to prepare jobs, schedule them, post-process the reports as needed, and manage the report files. Some utilities for such purposes can be found in the [Testilo project](https://www.npmjs.com/package/testilo). One application that leverages Testaro is [Kilotest](https://github.com/jrpool/kilotest).
|
|
37
|
+
A practical application that leverages Testaro will use other software to prepare jobs, schedule them, post-process the reports as needed, and manage the report files. Some utilities for such purposes can be found in the [Testilo project](https://www.npmjs.com/package/testilo). One application that leverages Testaro for a web service is [Kilotest](https://github.com/jrpool/kilotest).
|
|
38
38
|
|
|
39
39
|
## Dependencies
|
|
40
40
|
|
|
@@ -70,22 +70,52 @@ The main concepts of Testaro are:
|
|
|
70
70
|
- `job`: a document that tells Testaro what to do.
|
|
71
71
|
- `act`: one step in a job
|
|
72
72
|
- `report`: a job that Testaro has added results to.
|
|
73
|
-
- `tool`: one of the
|
|
74
|
-
- `rule`: a success or failure criterion defined by a tool (currently about
|
|
73
|
+
- `tool`: one of the testing applications in the ensemble that Testaro has created.
|
|
74
|
+
- `rule`: a success or failure criterion defined by a tool (currently about 1300 across all tools).
|
|
75
75
|
- `test`: the software that a tool uses to apply a rule.
|
|
76
76
|
- `target`: a web page that a job tells Testaro to test.
|
|
77
77
|
- `result`: the information that Testaro adds to a job to describe the test outcomes.
|
|
78
78
|
- `native result`: the test outcomes of a tool in the native form of that tool.
|
|
79
79
|
- `standard result`: the test outcomes of a tool in a uniform Testaro-defined form.
|
|
80
|
-
- `catalog`: a collection of data on the HTML elements
|
|
80
|
+
- `catalog`: a collection of data on the HTML elements relevant to one or more tests.
|
|
81
81
|
|
|
82
82
|
## System requirements
|
|
83
83
|
|
|
84
|
+
### Operating system and Node.js version
|
|
85
|
+
|
|
84
86
|
Testaro can be installed under a MacOS, Windows, Debian, or Ubuntu operating system.
|
|
85
87
|
|
|
86
88
|
Testaro is tested with the latest long-term-support version of [Node.js](https://nodejs.org/en/).
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
### Browser security
|
|
91
|
+
|
|
92
|
+
Testaro is configured so that, when Playwright or Puppeteer (a dependency of Playwright and of some tools, including QualWeb) launches a `chromium` browser, the browser is [sandboxed](https://www.geeksforgeeks.org/ethical-hacking/what-is-browser-sandboxing/) for improved security. That is the default for Playwright and Puppeteer, and Testaro does not override that default. The host must therefore permit sandboxed browsers. If you try to run Testaro on a host that prohibits sandboxed browsers, each attempted launch of a `chromium` browser will throw an error with a message complaining about the unavailability of a sandbox.
|
|
93
|
+
|
|
94
|
+
In some operating systems a sandboxed browser requires an [unprivileged user namespace](https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces). In one case, a `…userns.conf` file in the `/etc/sysctl.d` directory with the content `kernel.apparmor_restrict_unprivileged_userns = 1` prohibits unprivileged user namespaces and thereby makes sandboxed browsers unlaunchable.
|
|
95
|
+
|
|
96
|
+
#### Option A
|
|
97
|
+
|
|
98
|
+
One way to cope with this prohibition is to configure Playwright and Puppeteer to launch `chromium` non-sandboxed. In both cases, launch arguments `'--no-sandbox'` and `'--disable-setuid-sandbox'` are available to specify this.
|
|
99
|
+
|
|
100
|
+
- For Playwright, `'--no-sandbox'` and `'--disable-setuid-sandbox'` is added to the arguments of `browserOptionArgs.push` in the Testaro `run.js` file.
|
|
101
|
+
- For the `qualWeb` tool, this is done in the Testaro `tests/qualweb.js` file, where the `qualWeb.start` method is called with an options argument. Its `args` array property is modified to include `'--no-sandbox'` and `'--disable-setuid-sandbox'`.
|
|
102
|
+
- The `ibm` tool, too, can launch a Puppeteer `chromium` browser, if page content instead of a Playwright page is passed to the `accessibilityChecker.getCompliance` method, or if the implementation of the tool is changed in the future. For anticipation of such a case, the Testaro `aceconfig.js` file is modified. That file defines a `module.exports` object with a `puppeteerArgs` property, and, `--no-sandbox` and `--disable-setuid-sandbox` are added to its array value.
|
|
103
|
+
|
|
104
|
+
Non-sandboxed browsers are less secure than sandboxed ones, particularly when there is no restriction on who can use Testaro and what web pages they can test with it.
|
|
105
|
+
|
|
106
|
+
### Option B
|
|
107
|
+
|
|
108
|
+
The `chromium` configuration was left unchanged, but the operating system is configured to permit a sandboxed browser to be launched. In one case, this is implemented with:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
sudo sysctl -w kernel.unprivileged_userns_clone=1
|
|
112
|
+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
|
113
|
+
sudo tee /etc/sysctl.d/99-kilotest-userns.conf >/dev/null <<'EOF'
|
|
114
|
+
kernel.unprivileged_userns_clone = 1
|
|
115
|
+
kernel.apparmor_restrict_unprivileged_userns = 0
|
|
116
|
+
EOF
|
|
117
|
+
sudo sysctl --system
|
|
118
|
+
```
|
|
89
119
|
|
|
90
120
|
## Installation
|
|
91
121
|
|
|
@@ -154,7 +184,7 @@ Here is a sample job, showing properties that you can set:
|
|
|
154
184
|
what: 'monthly health check', // Job description
|
|
155
185
|
strict: true, // Whether to reject redirections from the target URL
|
|
156
186
|
standard: 'also', // or 'only' or 'no' (whether to report a standard result)
|
|
157
|
-
observe: false, // Whether to send progress notices to requesting
|
|
187
|
+
observe: false, // Whether to send progress notices to the requesting host
|
|
158
188
|
device: { // Device to emulate
|
|
159
189
|
id: 'iPhone 8',
|
|
160
190
|
windowOptions: {
|
|
@@ -190,13 +220,12 @@ Here is a sample job, showing properties that you can set:
|
|
|
190
220
|
which: 'axe', // ID of the tool
|
|
191
221
|
detailLevel: 2, // An argument required by this tool
|
|
192
222
|
rules: ['landmark-complementary-is-top-level'], // Which rules of the tool to test for
|
|
193
|
-
what: 'Axe'
|
|
194
223
|
},
|
|
195
224
|
{
|
|
196
225
|
type: 'test',
|
|
197
226
|
launch: {
|
|
198
|
-
browserID: 'webkit', // For this act,
|
|
199
|
-
target: { // For this act,
|
|
227
|
+
browserID: 'webkit', // For this act, override browserID to use Webkit
|
|
228
|
+
target: { // For this act, override target to test the contact page
|
|
200
229
|
what: 'Real Estate Management contact',
|
|
201
230
|
url: 'https://abccorp.com/mgmt/realproperty/contactus'
|
|
202
231
|
}
|
|
@@ -204,7 +233,6 @@ Here is a sample job, showing properties that you can set:
|
|
|
204
233
|
which: 'qualWeb',
|
|
205
234
|
withNewContent: false,
|
|
206
235
|
rules: ['QW-BP25', 'QW-BP26']
|
|
207
|
-
what: 'QualWeb'
|
|
208
236
|
}
|
|
209
237
|
]
|
|
210
238
|
}
|
|
@@ -216,7 +244,7 @@ There are 18 act types. They and their options are documented in the `etc` prope
|
|
|
216
244
|
|
|
217
245
|
### Running jobs
|
|
218
246
|
|
|
219
|
-
####
|
|
247
|
+
#### Job as an object
|
|
220
248
|
|
|
221
249
|
An application can execute a job with::
|
|
222
250
|
|
|
@@ -224,19 +252,23 @@ An application can execute a job with::
|
|
|
224
252
|
const {doJob} = require('testaro/run');
|
|
225
253
|
doJob(job)
|
|
226
254
|
.then(report => {
|
|
227
|
-
//
|
|
255
|
+
// Perform the job and create a report.
|
|
256
|
+
…
|
|
257
|
+
return report;
|
|
228
258
|
});
|
|
229
259
|
```
|
|
230
260
|
|
|
231
|
-
|
|
261
|
+
#### Job as a file
|
|
262
|
+
|
|
263
|
+
#### Immediate execution
|
|
264
|
+
|
|
265
|
+
A user can make Testaro execute a job from a file with a command like either of:
|
|
232
266
|
|
|
233
267
|
```bash
|
|
234
268
|
node call run
|
|
235
269
|
node call run 250725T
|
|
236
270
|
```
|
|
237
271
|
|
|
238
|
-
#### Directory-watched job execution
|
|
239
|
-
|
|
240
272
|
An application can watch a directory for jobs with::
|
|
241
273
|
|
|
242
274
|
```javaScript
|
|
@@ -250,40 +282,38 @@ A user can make Testaro watch a directory for jobs with::
|
|
|
250
282
|
node call dirWatch true 300
|
|
251
283
|
```
|
|
252
284
|
|
|
253
|
-
In both cases, the first argument of `dirWatch` tells Testaro whether to continue watching after performing one job, and the second argument tells Testaro how many secods to wait after not finding a job to perform.
|
|
285
|
+
In both cases, the first argument of `dirWatch` tells Testaro whether to continue watching after performing one job, and the second argument tells Testaro how many secods to wait after not finding a job to perform before checking again.
|
|
254
286
|
|
|
255
|
-
|
|
287
|
+
Testaro finds a file containing a job in the `todo` subdirectory of the `process.env.JOBDIR` directory and saves the report of that job in the `done/raw` subdirectory. In the `node call run` case, the job selected will be the first one whose file name begins with the argument of `run`, or the first one if that argument is absent.
|
|
256
288
|
|
|
257
|
-
####
|
|
289
|
+
#### Job from a server
|
|
258
290
|
|
|
259
|
-
Testaro can poll
|
|
291
|
+
Testaro can poll a server for jobs to be performed. The server can act as the “controller” described in [How to run a thousand accessibility tests](https://medium.com/cvs-health-tech-blog/how-to-run-a-thousand-accessibility-tests-63692ad120c3). The server is responsible for preparing Testaro jobs, assigning them to Testaro agents, receiving reports back from those agents, and performing any further processing of the reports, including enhancement, storage, and disclosure to audiences. It can be any server reachable with a URL. That includes a server running on the same host as Testaro, with a URL such as `localhost:3000`.
|
|
260
292
|
|
|
261
|
-
To make Testaro poll a server for jobs, define the following environment variables
|
|
293
|
+
To make Testaro poll a server for jobs, define the following environment variables:
|
|
262
294
|
|
|
263
|
-
- `
|
|
264
|
-
- `
|
|
265
|
-
- `
|
|
266
|
-
- `NETWATCH_URL_0_AUTH`: the password to supply to the server when polling and when delivering a report
|
|
267
|
-
- `NETWATCH_URLS`: the integer IDs of the servers to be polled, comma-delimited (e.g., `0,3,4`)
|
|
295
|
+
- `NETWATCH_URL_JOB`: which URL to poll (the URL must contain the value of the `AGENT` environment variable)
|
|
296
|
+
- `NETWATCH_URL_REPORT`: which URL to send job reports to
|
|
297
|
+
- `NETWATCH_URL_AUTH`: the password to supply to the server when polling and when delivering a report
|
|
268
298
|
|
|
269
299
|
The job request sent to the server can be a `POST` request, in which the `agentPW` property of the payload will be the password. Or it can be a `GET` request with the URL containing the password.
|
|
270
300
|
|
|
271
301
|
Testaro will send the report as a `POST` request whose payload is a JSON object with two properties: `agentPW` (the password) and `report` (the report). However, if the environment does not contain a password, the payload is a JSON object containing only the report.
|
|
272
302
|
|
|
273
|
-
An application can
|
|
303
|
+
An application can poll a server for jobs with:
|
|
274
304
|
|
|
275
305
|
```javaScript
|
|
276
306
|
const {netWatch} = require('testaro/netWatch');
|
|
277
307
|
netWatch(true, 300, true);
|
|
278
308
|
```
|
|
279
309
|
|
|
280
|
-
A user can make Testaro
|
|
310
|
+
A user can make Testaro poll a server for jobs with:
|
|
281
311
|
|
|
282
312
|
```bash
|
|
283
313
|
node call netWatch true 300 true
|
|
284
314
|
```
|
|
285
315
|
|
|
286
|
-
The first argument of `netWatch` tells Testaro whether to continue
|
|
316
|
+
The first argument of `netWatch` tells Testaro whether to continue polling after performing the first job. The second argument tells Testaro how many seconds to wait after receiving a no-jobs response. The third argument tells Testaro whether to be certificate-tolerant, i.e. to accept SSL certificates that fail verification against a list of certificate authorities (the default is `true`).
|
|
287
317
|
|
|
288
318
|
## Reports
|
|
289
319
|
|
|
@@ -294,7 +324,7 @@ A report is a job with information about the results of the performance of the j
|
|
|
294
324
|
As Testaro performs a job, information about the job as a whole is inserted into the job. That information is organized into one or two properties:
|
|
295
325
|
|
|
296
326
|
- `jobData`: Miscellaneous facts about the completed job
|
|
297
|
-
- `catalog`: A collection of data about the elements on the target that
|
|
327
|
+
- `catalog`: A collection of data about the elements on the target that are relevant to any test failures
|
|
298
328
|
|
|
299
329
|
Testaro inserts the `jobData` property into every job, but inserts the `catalog` property only into jobs that instruct Testaro to produce standard results.
|
|
300
330
|
|
package/package.json
CHANGED
package/tests/testaro.js
CHANGED
|
@@ -504,9 +504,14 @@ exports.reporter = async (page, report, actIndex) => {
|
|
|
504
504
|
// Wait 1 second to prevent out-of-order logging with granular reporting.
|
|
505
505
|
await wait(1000);
|
|
506
506
|
// Get the rules to be tested for and their execution order.
|
|
507
|
+
// 'y' = include-list: run exactly the rules in ruleSpec.slice(1).
|
|
508
|
+
// 'n' = exclude-list: run all defaultOn rules EXCEPT those in ruleSpec.slice(1).
|
|
509
|
+
const excludeIDs = ruleSpec.slice(1);
|
|
507
510
|
const jobRuleIDs = ruleSpec[0] === 'y'
|
|
508
|
-
?
|
|
509
|
-
: allRules
|
|
511
|
+
? excludeIDs
|
|
512
|
+
: allRules
|
|
513
|
+
.filter(rule => rule.defaultOn && ! excludeIDs.includes(rule.id))
|
|
514
|
+
.map(rule => rule.id);
|
|
510
515
|
const jobRules = allRules.filter(rule => jobRuleIDs.includes(rule.id));
|
|
511
516
|
let justPrevented = false;
|
|
512
517
|
// For each rule to be tested for:
|