testaro 40.0.2 → 41.0.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 +213 -217
- package/actSpecs.js +3 -3
- package/package.json +1 -1
- package/procs/device.js +59 -0
- package/procs/standardize.js +16 -8
- package/run.js +192 -178
- package/tests/ed11y.js +2 -2
package/README.md
CHANGED
|
@@ -40,10 +40,10 @@ One software product that performs some such functions is [Testilo](https://www.
|
|
|
40
40
|
|
|
41
41
|
Testaro uses:
|
|
42
42
|
- [Playwright](https://playwright.dev/) to launch browsers, perform user actions in them, and perform tests
|
|
43
|
-
- [
|
|
43
|
+
- [playwright-dompath](https://www.npmjs.com/package/playwright-dompath) to retrieve XPaths of elements
|
|
44
44
|
- [pixelmatch](https://www.npmjs.com/package/pixelmatch) to measure motion
|
|
45
45
|
|
|
46
|
-
Testaro performs tests of these
|
|
46
|
+
Testaro performs tests of these _tools_:
|
|
47
47
|
- [accessibility-checker](https://www.npmjs.com/package/accessibility-checker) (IBM)
|
|
48
48
|
- [alfa](https://alfa.siteimprove.com/) (Siteimprove)
|
|
49
49
|
- [aslint](https://www.npmjs.com/package/@essentialaccessibility/aslint) (eSSENTIAL Accessibility)
|
|
@@ -77,16 +77,6 @@ total: 990
|
|
|
77
77
|
|
|
78
78
|
Some of the tools are under active development, and their rule counts change over time.
|
|
79
79
|
|
|
80
|
-
## Job data
|
|
81
|
-
|
|
82
|
-
A report produced by Testaro discloses:
|
|
83
|
-
- raw results of tests conducted by tools
|
|
84
|
-
- standardized results of tests conducted by tools
|
|
85
|
-
- process data, including statistics on:
|
|
86
|
-
- latency (how long a time each tool takes to run its tests)
|
|
87
|
-
- test prevention (the failure of tools to run on particular targets)
|
|
88
|
-
- logging (browser messaging, including about document errors, during testing)
|
|
89
|
-
|
|
90
80
|
## Code organization
|
|
91
81
|
|
|
92
82
|
The main directories containing code files are:
|
|
@@ -131,191 +121,102 @@ To run Testaro after installation, provide the environment variables described b
|
|
|
131
121
|
|
|
132
122
|
All of the tests that Testaro can perform are free of cost, except those performed by the WAVE tool. The owner of that tool gives new registrants a free allowance of credits before it becomes necessary to pay for use of the API of the tool. The required environment variable for authentication and payment is described below under “Environment variables”.
|
|
133
123
|
|
|
134
|
-
##
|
|
124
|
+
## Jobs
|
|
135
125
|
|
|
136
|
-
|
|
126
|
+
A _job_ is an object that specifies what Testaro is to do. As Testaro performs a job, Testaro reports results by adding data to the job.
|
|
127
|
+
|
|
128
|
+
### Example
|
|
137
129
|
|
|
138
130
|
Here is an example of a job:
|
|
139
131
|
|
|
140
|
-
```
|
|
132
|
+
```javaScript
|
|
141
133
|
{
|
|
142
|
-
id: '
|
|
143
|
-
what: '
|
|
134
|
+
id: '250110T1200-7f-4',
|
|
135
|
+
what: 'aside mislocation',
|
|
144
136
|
strict: true,
|
|
145
|
-
|
|
137
|
+
isolate: true,
|
|
138
|
+
standard: 'also',
|
|
139
|
+
observe: false,
|
|
140
|
+
deviceID: 'Kindle Fire HDX',
|
|
141
|
+
browserID: 'webkit',
|
|
142
|
+
lowMotion: false,
|
|
143
|
+
timeLimit: 80,
|
|
144
|
+
creationTimeStamp: '241229T0537',
|
|
145
|
+
executionTimeStamp: '250110T1200',
|
|
146
|
+
sources: {
|
|
147
|
+
script: 'ts99',
|
|
148
|
+
batch: 'departments',
|
|
149
|
+
mergeID: '7f',
|
|
150
|
+
sendReportTo: 'https://abccorp.com/api/report',
|
|
151
|
+
requester: 'malavu@abccorp.com'
|
|
152
|
+
target: {
|
|
153
|
+
what: 'Real Estate Management',
|
|
154
|
+
url: 'https://abccorp.com/mgmt/realproperty.html'
|
|
155
|
+
},
|
|
156
|
+
lastTarget: false,
|
|
157
|
+
},
|
|
146
158
|
acts: [
|
|
147
159
|
{
|
|
148
|
-
type: 'launch'
|
|
149
|
-
which: 'chromium',
|
|
150
|
-
url: 'https://www.w3c.org',
|
|
151
|
-
deviceID: 'iPhone 6',
|
|
152
|
-
what: 'Chromium browser'
|
|
160
|
+
type: 'launch'
|
|
153
161
|
},
|
|
154
162
|
{
|
|
155
163
|
type: 'test',
|
|
156
|
-
which: '
|
|
157
|
-
|
|
158
|
-
rules: ['
|
|
159
|
-
|
|
160
|
-
],
|
|
161
|
-
sources: {
|
|
162
|
-
script: 'tp99',
|
|
163
|
-
batch: 'webOrgs',
|
|
164
|
-
lastTarget: false,
|
|
165
|
-
target: {
|
|
166
|
-
id: 'w3c',
|
|
167
|
-
what: 'World Wide Web Consortium',
|
|
168
|
-
which: 'https://www.w3c.org'
|
|
164
|
+
which: 'axe',
|
|
165
|
+
detailLevel: 2,
|
|
166
|
+
rules: ['landmark-complementary-is-top-level'],
|
|
167
|
+
what: 'Axe'
|
|
169
168
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
{
|
|
170
|
+
type: 'test',
|
|
171
|
+
which: 'qualWeb',
|
|
172
|
+
withNewContent: false,
|
|
173
|
+
rules: ['QW-BP25', 'QW-BP26']
|
|
174
|
+
what: 'QualWeb'
|
|
175
|
+
}
|
|
176
|
+
]
|
|
178
177
|
}
|
|
179
178
|
```
|
|
180
179
|
|
|
181
|
-
This job contains
|
|
182
|
-
1.
|
|
183
|
-
1.
|
|
180
|
+
This job contains three _acts_, telling Testaro to:
|
|
181
|
+
1. Launch a Webkit browser without a reduced-motion setting, open a tab with the properties of a Kindle Fire HDX device, and navigate to `https://abccorp.com/mgmt/realproperty.html`.
|
|
182
|
+
1. Perform the test for the `landmark-complementary-is-top-level` rule of the `axe` tool and report the test result with Axe detail level 2.
|
|
183
|
+
1. Perform the tests for rules `QW-BP25` and `QW-BP26` of the `qualWeb` tool on the existing page.
|
|
184
184
|
|
|
185
185
|
Job properties:
|
|
186
186
|
- `id`: a string uniquely identifying the job.
|
|
187
187
|
- `what`: a description of the job.
|
|
188
188
|
- `strict`: `true` or `false`, indicating whether _substantive redirections_ should be treated as failures. These are redirections that do more than add or subtract a final slash.
|
|
189
|
-
- `timeLimit`: the number of seconds allowed for the execution of the job.
|
|
190
|
-
- `acts`: an array of the acts to be performed (documented below).
|
|
191
189
|
- `standard`: `'also'`, `'only'`, or `'no'`, indicating whether rule-violation instances are to be reported in tool-native formats and also in the Testaro standard format, only in the standard format, or only in the tool-native formats.
|
|
192
190
|
- `observe`: `true` or `false`, indicating whether tool and Testaro-rule invocations are to be reported to the server as they occur, so that the server can update a waiting client.
|
|
193
|
-
- `
|
|
191
|
+
- `deviceID`: the ID of the device that some browser properties will resemble, unless overridden by a `launch` act. It must be `'default'` or the ID of one of about 125 devices recognized by Playwright, published at `https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json`.
|
|
192
|
+
- `browserID`: the ID of the browser to be used, unless overridden by a `launch` act. It must be `'chromium'`, `'firefox'`, or `'webkit`'.
|
|
193
|
+
- `lowMotion`: whether the browser is to create tabs with the `reduce-motion` option set to `reduce` instead of `no-preference`.
|
|
194
|
+
- `timeLimit`: the number of seconds allowed for the execution of the job.
|
|
194
195
|
- `creationTimeStamp`: a string in `yymmddThhMM` format, describing when the job was created.
|
|
195
|
-
- `
|
|
196
|
-
- `
|
|
197
|
-
- `
|
|
198
|
-
- `sendReportTo`: the URL to which the report of the job is to be sent, or an empty string if the report is not to be sent to a server.
|
|
199
|
-
|
|
200
|
-
The job creator may add other properties (such as `mergeID` in this example) to a job.
|
|
201
|
-
|
|
202
|
-
### Reports
|
|
203
|
-
|
|
204
|
-
#### Introduction
|
|
205
|
-
|
|
206
|
-
Each tool produces a _tool report_ of the results of its tests. Testaro prunes the tool reports for brevity, removing content that is judged unlikely to be useful. Testaro then appends each tool report to the test act that invoked the tool.
|
|
207
|
-
|
|
208
|
-
Testaro also generates some data about the job and adds those data to the job, in a `jobData` property.
|
|
209
|
-
|
|
210
|
-
#### Formats
|
|
211
|
-
|
|
212
|
-
##### Tool-report formats
|
|
213
|
-
|
|
214
|
-
The tools listed above as dependencies write their tool reports in various formats. They differ in how they organize multiple instances of the same problem, how they classify severity and certainty, how they point to the locations of problems, how they name problems, etc.
|
|
215
|
-
|
|
216
|
-
A Testaro report can include, for each tool, either or both of these properties:
|
|
217
|
-
- `result`: the result in the native tool format.
|
|
218
|
-
- `standardResult`: the result in a standard format identical for all tools.
|
|
219
|
-
|
|
220
|
-
##### Standard result
|
|
221
|
-
|
|
222
|
-
###### Properties
|
|
223
|
-
|
|
224
|
-
The standard result includes three properties:
|
|
225
|
-
- `prevented`: a boolean (`true` or `false`) value, stating whether the page prevented the tool from performing its tests.
|
|
226
|
-
- `totals`: an array of numbers representing how many instances of rule violations at each level of severity the tool reported. There are 4 ordinal severity levels. For example, the array `[3, 0, 14, 10]` would report that there were 3 violations at level 0, 0 at level 1, 14 at level 2, and 10 at level 3.
|
|
227
|
-
- `instances`: an array of objects describing the rule violations. An instance can describe a single violation, usually by one element in the page, or can summarize multiple violations of the same rule.
|
|
228
|
-
|
|
229
|
-
###### Instances
|
|
230
|
-
|
|
231
|
-
Here is an example of a standard instance:
|
|
232
|
-
|
|
233
|
-
```javascript
|
|
234
|
-
{
|
|
235
|
-
ruleID: 'rule01',
|
|
236
|
-
what: 'Button type invalid',
|
|
237
|
-
ordinalSeverity: 2,
|
|
238
|
-
count: 1,
|
|
239
|
-
tagName: 'BUTTON'
|
|
240
|
-
id: '',
|
|
241
|
-
location: {
|
|
242
|
-
doc: 'dom',
|
|
243
|
-
type: 'xpath',
|
|
244
|
-
spec: '/html[1]/body[1]/section[1]/div[1]/div[1]/ul[1]/li[1]/a[1]'
|
|
245
|
-
},
|
|
246
|
-
excerpt: '<button type="link"></button>',
|
|
247
|
-
boxID: '12:340:46:50',
|
|
248
|
-
pathID: '/html[1]/body[1]/section[1]/div[1]/div[1]/ul[1]/li[1]/a[1]'
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
This instance describes a violation of a rule named `rule01` by a `button` element.
|
|
253
|
-
|
|
254
|
-
The element has no `id` attribute to distinguish it from other `button` elements, but the tool describes its location. This tool uses an XPath to do that. Tools use various methods for location description, namely:
|
|
255
|
-
- `line` (line number in the code of the page): Nu Html Checker
|
|
256
|
-
- `selector` (CSS selector): Axe, QualWeb, WAVE
|
|
257
|
-
- `xpath`: Alfa, ASLint, Equal Access
|
|
258
|
-
- `box` (coordinates, width, and height of the element box): Editoria11y, Testaro
|
|
259
|
-
- none: HTML CodeSniffer
|
|
260
|
-
The tool also reproduces an excerpt of the element code.
|
|
261
|
-
|
|
262
|
-
###### Element identification
|
|
263
|
-
|
|
264
|
-
While the above properties can help you find the offending element, Testaro makes this easier by adding, where practical, two standard element identifiers to each standard instance:
|
|
265
|
-
- `boxID`: a compact representation of the x, y, width, and height of the element bounding box, if the element can be identified and is visible.
|
|
266
|
-
- `pathID`: the XPath of the element, if the element can be identified.
|
|
267
|
-
|
|
268
|
-
These standard identifiers can help you determine whether violations reported by different tools belong to the same element or different elements. The `boxID` property can also support the making of images of the violating elements.
|
|
269
|
-
|
|
270
|
-
Some tools limit the efficacy of the current algorithm for standard identifiers:
|
|
271
|
-
- HTML CodeSniffer does not report element locations, and the reported code excerpts exclude all text content.
|
|
272
|
-
- Nu Html Checker reports line and column boundaries of element start tags and truncates element text content in reported code excerpts.
|
|
273
|
-
|
|
274
|
-
Testing can change the pages being tested, and such changes can cause a particular element to change its physical or logical location. In such cases, an element may appear multiple times in a tool report with different `boxID` or `pathID` values, even though it is, for practical purposes, the same element.
|
|
275
|
-
|
|
276
|
-
###### Standardization configuration
|
|
277
|
-
|
|
278
|
-
Each job can specify how Testaro is to handle report standardization. A job can contain a `standard` property, with one of the following values to determine which results the report will include:
|
|
279
|
-
- `'also'`: original and standard.
|
|
280
|
-
- `'only'`: standard only.
|
|
281
|
-
- `'no'`: original only.
|
|
282
|
-
|
|
283
|
-
If a tool has the option to be used without itemization and is being so used, the `instances` array may be empty, or may contain one or more summary instances. Summary instances disclose the numbers of instances that they summarize with the `count` property. They typically summarize violations by multiple elements, in which case their `id`, `location`, `excerpt`, `boxID`, and `pathID` properties will have empty values.
|
|
284
|
-
|
|
285
|
-
###### Standardization opinionation
|
|
286
|
-
|
|
287
|
-
This standard format reflects some judgments. For example:
|
|
288
|
-
- The `ordinalSeverity` property of an instance involves interpretation. Tools may report severity, certainty, priority, or some combination of those. They may use ordinal or metric quantifications. If they quantify ordinally, their scales may have more or fewer than 4 ranks. Testaro coerces each tool’s severity, certainty, and/or priority classification into a 4-rank ordinal classification. This classification is deemed to express the most common pattern among the tools.
|
|
289
|
-
- The `tagName` property of an instance may not always be obvious, because in some cases the rule being tested for requires a relationship among more than one element (e.g., “An X element may not have a Y element as its parent”).
|
|
290
|
-
- The `ruleID` property of an instance is a matching rule if the tool issues a message but no rule identifier for each instance. The `nuVal` tool does this. In this case, Testaro is classifying the messages into rules.
|
|
291
|
-
- The `ruleID` property of an instance may reclassify tool rules. For example, if a tool rule covers multiple situations that are dissimilar, that rule may be split into multiple rules with distinct `ruleID` properties.
|
|
292
|
-
|
|
293
|
-
You are not dependent on the judgments incorporated into the standard format, because Testaro can give you the original reports from the tools.
|
|
294
|
-
|
|
295
|
-
The standard format does not express opinions on issue classification. A rule ID identifies something deemed to be an issue by a tool. Useful reporting from multi-tool testing still requires the classification of tool **rules** into **issues**. If tool `A` has `alt-incomplete` as a rule ID and tool `B` has `image_alt_stub` as a rule ID, Testaro does not decide whether those are really the same issue or different issues. That decision belongs to you. The standardization of tool reports by Testaro eliminates some of the drudgery in issue classification, but not any of the judgment required for issue classification.
|
|
296
|
-
|
|
297
|
-
### Acts
|
|
196
|
+
- `executionTimeStamp`: a string in `yymmddThhMM` format, specifying a date and time before which the job is not to be performed.
|
|
197
|
+
- `sources`: an object describing the source of the job.
|
|
198
|
+
- `acts`: an array of the acts to be performed (documented below).
|
|
298
199
|
|
|
299
|
-
|
|
200
|
+
## Acts
|
|
300
201
|
|
|
301
|
-
|
|
202
|
+
### Introduction
|
|
302
203
|
|
|
303
204
|
Each act object 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`.
|
|
304
205
|
|
|
305
|
-
|
|
206
|
+
### Act sequence
|
|
306
207
|
|
|
307
|
-
The first act in any job has the type `launch`, as shown in the example above. It launches a browser and then uses it to visit a URL.
|
|
208
|
+
The first act in any job has the type `launch`, as shown in the example above. It launches a browser and then uses it to visit a URL.
|
|
308
209
|
|
|
309
|
-
|
|
210
|
+
### Act types
|
|
310
211
|
|
|
311
|
-
The
|
|
212
|
+
The acts after the first can tell Testaro to perform any of:
|
|
312
213
|
- _moves_ (clicks, text inputs, hovers, etc.)
|
|
313
214
|
- _navigations_ (browser launches, visits to URLs, waits for page conditions, etc.)
|
|
314
215
|
- _alterations_ (changes to the page)
|
|
315
216
|
- _tests_ (one or more of the tests defined by a tool)
|
|
316
217
|
- _branching_ (continuing from an act other than the next one)
|
|
317
218
|
|
|
318
|
-
|
|
219
|
+
#### Moves
|
|
319
220
|
|
|
320
221
|
An example of a **move** is:
|
|
321
222
|
|
|
@@ -334,9 +235,9 @@ In identifying the target element for a move, Testaro matches the `which` proper
|
|
|
334
235
|
|
|
335
236
|
When the texts of multiple elements of the same type will contain the same `which` value, you can include an `index` property to specify the index of the target element, among all those that will match.
|
|
336
237
|
|
|
337
|
-
|
|
238
|
+
#### Navigations
|
|
338
239
|
|
|
339
|
-
An example of a **navigation** is the act of type `launch` above. The
|
|
240
|
+
An example of a **navigation** is the act of type `launch` above. The launch configuration is inherited from properties of the job, except that the act may override any of those properties.
|
|
340
241
|
|
|
341
242
|
If any act alters the page, you can restore the page to its original state for the next act by inserting a new `launch` act (and, if necessary, additional page-specific acts) between them.
|
|
342
243
|
|
|
@@ -352,9 +253,7 @@ Another navigation example is:
|
|
|
352
253
|
|
|
353
254
|
In this case, Testaro waits until the page title contains the string “travel” (case-insensitively).
|
|
354
255
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
##### Alterations
|
|
256
|
+
#### Alterations
|
|
358
257
|
|
|
359
258
|
An example of an **alteration** is:
|
|
360
259
|
|
|
@@ -367,19 +266,36 @@ An example of an **alteration** is:
|
|
|
367
266
|
|
|
368
267
|
This act causes Testaro to alter the `display` and `visibility` style properties of all elements, where necessary, so those properties do not make any element invisible.
|
|
369
268
|
|
|
370
|
-
|
|
269
|
+
#### Branching
|
|
270
|
+
|
|
271
|
+
An example of a **branching** act is:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"type": "next",
|
|
276
|
+
"if": ["totals.invalid", ">", 0],
|
|
277
|
+
"jump": -4,
|
|
278
|
+
"what": "redo search if any invalid elements"
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
This act checks the result of the previous act to determine whether its `result.totals.invalid` property has a positive value. If so, it changes the next act to be performed, specifying the act 4 acts before this one.
|
|
283
|
+
|
|
284
|
+
A `next` act can use a `next` property instead of a `jump` property. The value of the `next` property is an act name. It tells Testaro to continue performing acts starting with the act having that value as the value of its `name` property.
|
|
285
|
+
|
|
286
|
+
#### Tests
|
|
371
287
|
|
|
372
|
-
|
|
288
|
+
##### Introduction
|
|
373
289
|
|
|
374
290
|
An act of type `test` performs the tests of a tool and reports a result. The result may indicate that a page passes or fails requirements. Typically, accessibility tests report successes and failures. But a test in Testaro is defined less restrictively, so it can report any result. As one example, the Testaro `elements` test reports facts about certain elements on a page, without asserting that those facts are successes or failures.
|
|
375
291
|
|
|
376
292
|
The `which` property of a `test` act identifies a tool, such as `alfa` or `testaro`.
|
|
377
293
|
|
|
378
|
-
|
|
294
|
+
#### Target modification
|
|
379
295
|
|
|
380
296
|
Some tools modify the page, so isolation of tests from one another requires that a browser be relaunched or, at least, navigate to the URL again, after a test act running any of those tools before a test act running another tool.
|
|
381
297
|
|
|
382
|
-
Of the
|
|
298
|
+
Of the 10 tools, 6 are target-modifying:
|
|
383
299
|
- `alfa`
|
|
384
300
|
- `aslint`
|
|
385
301
|
- `axe`
|
|
@@ -387,10 +303,10 @@ Of the 9 tools, 6 are target-modifying:
|
|
|
387
303
|
- `ibm`
|
|
388
304
|
- `testaro`
|
|
389
305
|
|
|
390
|
-
|
|
306
|
+
##### Configuration
|
|
391
307
|
|
|
392
308
|
Every tool invoked by Testaro must have:
|
|
393
|
-
- a property in the `tests` object defined in the `run.js` file, where the property name is the
|
|
309
|
+
- a property in the `tests` object defined in the `run.js` file, where the property name is the ID representing the tool and the value is the name of the tool
|
|
394
310
|
- a `.js` file, defining the operation of the tool, in the `tests` directory, whose name base is the name of the tool
|
|
395
311
|
|
|
396
312
|
The `actSpecs.js` file (described in detail below) contains a specification for any `test` act, namely:
|
|
@@ -406,15 +322,15 @@ test: [
|
|
|
406
322
|
],
|
|
407
323
|
```
|
|
408
324
|
|
|
409
|
-
That means that a test act (i.e. an act with a `type` property having the value `'test'`) must have a string-valued `which` property naming a tool and may optionally have an array-valued `rules` property restricting the
|
|
325
|
+
That means that a test act (i.e. an act with a `type` property having the value `'test'`) must have a string-valued `which` property naming a tool and may optionally have an array-valued `rules` property restricting the rules to be reported on and/or a string-valued `what` property describing the tool and/or the tests.
|
|
410
326
|
|
|
411
327
|
If a particular test act either must have or may have any other properties, those properties are specified in the `tools` property in `actSpecs.js`.
|
|
412
328
|
|
|
413
|
-
When you include a `rules` property, you limit the tests of the tool that are performed or reported. For some tools (`alfa`, `axe`, `htmlcs`, `qualWeb`, and `testaro`), only the specified tests are performed. Other tools (`ibm`, `nuVal`, and `wave`) do not allow such a limitation, so, for those tools, all tests are performed but results are reported from only the specified tests.
|
|
329
|
+
When you include a `rules` property, you limit the tests of the tool that are performed or reported. For some tools (`alfa`, `axe`, `htmlcs`, `qualWeb`, and `testaro`), only the specified tests are performed. Other tools (`aslint`, `ed11y`, `ibm`, `nuVal`, and `wave`) do not allow such a limitation, so, for those tools, all tests are performed but results are reported from only the specified tests.
|
|
414
330
|
|
|
415
331
|
The `nuVal`, `qualWeb`, and `testaro` tools require specific formats for the `rules` property. Those formats are described below in the sections about those tools.
|
|
416
332
|
|
|
417
|
-
|
|
333
|
+
##### Examples
|
|
418
334
|
|
|
419
335
|
An example of a `test` act is:
|
|
420
336
|
|
|
@@ -438,7 +354,7 @@ Most tools allow you to decide which of their rules to apply. In effect, this me
|
|
|
438
354
|
}
|
|
439
355
|
```
|
|
440
356
|
|
|
441
|
-
specifies that the tests for rules `r25` and `r71` of the `alfa` tool are to be
|
|
357
|
+
specifies that the tests for rules `r25` and `r71` of the `alfa` tool are to be performed. If the `'y'` in the `rules` array were `'n'` instead, the act would specify that all the tests of the `alfa` tool **except** those for rules `r25` and `r71` are to be run.
|
|
442
358
|
|
|
443
359
|
One of the tools that allows rule selection, Testaro, has some rules that take additional arguments. As prescribed in `actSpecs.js`, you can pass such additional arguments to the `reporter` functions of those Testaro tests with an `args` property. Example:
|
|
444
360
|
|
|
@@ -455,9 +371,9 @@ One of the tools that allows rule selection, Testaro, has some rules that take a
|
|
|
455
371
|
}
|
|
456
372
|
```
|
|
457
373
|
|
|
458
|
-
This act specifies that the Testaro test `hover` is to be
|
|
374
|
+
This act specifies that the Testaro test `hover` is to be performed with the additional argument `20`, and `focInd` is to be performed with the additional arguments `false` and `300`.
|
|
459
375
|
|
|
460
|
-
|
|
376
|
+
##### Expectations
|
|
461
377
|
|
|
462
378
|
Any `test` act can contain an `expect` property. If it does, the value of that property must be an array of arrays. Each array specifies expectations about the results of the operation of the tool.
|
|
463
379
|
|
|
@@ -490,32 +406,15 @@ A typical use for an `expect` property is checking the correctness of a Testaro
|
|
|
490
406
|
|
|
491
407
|
When a `test` act has an `expect` property, the result for that act has an `expectations` property reporting whether the expectations were satisfied. The value of `expectations` is an array of objects, one object per expectation. Each object includes a `property` property identifying the expectation, and a `passed` property with `true` or `false` value reporting whether the expectation was satisfied. If applicable, it also has other properties identifying what was expected and what was actually reported.
|
|
492
408
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
An example of a **branching** act is:
|
|
496
|
-
|
|
497
|
-
```json
|
|
498
|
-
{
|
|
499
|
-
"type": "next",
|
|
500
|
-
"if": ["totals.invalid", ">", 0],
|
|
501
|
-
"jump": -4,
|
|
502
|
-
"what": "redo search if any invalid elements"
|
|
503
|
-
}
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
This act checks the result of the previous act to determine whether its `result.totals.invalid` property has a positive value. If so, it changes the next act to be performed, specifying the act 4 acts before this one.
|
|
507
|
-
|
|
508
|
-
A `next` act can use a `next` property instead of a `jump` property. The value of the `next` property is an act name. It tells Testaro to continue performing acts starting with the act having that value as the value of its `name` property.
|
|
509
|
-
|
|
510
|
-
#### Tools
|
|
409
|
+
### Tools
|
|
511
410
|
|
|
512
411
|
The tools whose tests Testaro performs have particularities described below.
|
|
513
412
|
|
|
514
|
-
|
|
413
|
+
#### ASLint
|
|
515
414
|
|
|
516
415
|
The `aslint` tool makes use of the [`aslint-testaro` fork](https://www.npmjs.com/package/aslint-testaro) of the [`aslint` repository](https://github.com/essentialaccessibility/aslint), which, unlike the published `aslint` package, contains the `aslint.bundle.js` file.
|
|
517
416
|
|
|
518
|
-
|
|
417
|
+
#### HTML CodeSniffer
|
|
519
418
|
|
|
520
419
|
The `htmlcs` tool makes use of the `htmlcs/HTMLCS.js` file. That file was created, and can be recreated if necessary, as follows:
|
|
521
420
|
|
|
@@ -547,7 +446,7 @@ The changes in `htmlcs/HTMLCS.js` are:
|
|
|
547
446
|
> );
|
|
548
447
|
```
|
|
549
448
|
|
|
550
|
-
|
|
449
|
+
#### IBM Equal Access
|
|
551
450
|
|
|
552
451
|
The `ibm` tests require the `aceconfig.js` file.
|
|
553
452
|
|
|
@@ -574,13 +473,13 @@ The `ibm` tool is one of two tools (`testaro` is the other) with a `withItems` p
|
|
|
574
473
|
|
|
575
474
|
Experimentation indicates that the `ibm` tools emits untrappable errors for some targets when the content argument given to it is the page content rather than the page URL. Therefore, it is safer to use `true` as the value of `withNewContent` for the `ibm` tool.
|
|
576
475
|
|
|
577
|
-
|
|
476
|
+
#### Nu Html Checker
|
|
578
477
|
|
|
579
478
|
The `nuVal` tool performs the tests of the Nu Html Checker.
|
|
580
479
|
|
|
581
480
|
Its `rules` argument is **not** an array of rule IDs, but instead is an array of rule _specifications_. A rule specification for `nuVal` is a string with the format `=ruleID` or `~ruleID`. The `=` prefix indicates that the rule ID is invariable. The `~` prefix indicates that the rule ID is variable, in which case the `ruleID` part of the specification is a matching regular expression, rather than the exact text of a message. This `rules` format arises from the fact that `nuVal` generates customized messages and does not accompany them with rule identifiers.
|
|
582
481
|
|
|
583
|
-
|
|
482
|
+
#### QualWeb
|
|
584
483
|
|
|
585
484
|
The `qualWeb` tool performs the ACT rules, WCAG Techniques, and best-practices tests of QualWeb. Only failures and warnings are included in the report. The EARL report of QualWeb is not generated, because it is equivalent to the report of the ACT rules tests.
|
|
586
485
|
|
|
@@ -604,7 +503,7 @@ Thus, when the `rules` argument is omitted, QualWeb will test for all of the rul
|
|
|
604
503
|
|
|
605
504
|
The target can be provided to QualWeb either as an existing page or as a URL. Experience indicates that the results can differ between these methods, with each method reporting some rule violations or some instances that the other method does not report. For at least some cases, more rules are reported violated when an existing page is provided (`withNewItems: false`).
|
|
606
505
|
|
|
607
|
-
|
|
506
|
+
#### Testaro
|
|
608
507
|
|
|
609
508
|
If you do not specify rules when using the `testaro` tool, Testaro will test for the rules listed in the `evalRules` object of the `tests/testaro.js` file.
|
|
610
509
|
|
|
@@ -620,7 +519,7 @@ Several Testaro tests make use of the `init()` function in the `procs/testaro` m
|
|
|
620
519
|
|
|
621
520
|
You can add custom rules to the rules of any tool. Testaro provides a template, `data/template.js`, for the definition of a rule to be added. Once you have created a copy of the template with revisions, you can move the copy into the `testaro` directory and add an entry for your custom rule to the `evalRules` object in the `tests/testaro.js` file. Then your custom rule will act as a Testaro rule. Some `testaro` rules are simple enough to be fully specified in JSON files. You can use any of those as a template if you want to create a sufficiently simple custom rule, namely a rule whose prohibited elements are all and only the elements matching a CSS selector. More details about rule creation are in the `CONTRIBUTING.md` file.
|
|
622
521
|
|
|
623
|
-
|
|
522
|
+
#### WAVE
|
|
624
523
|
|
|
625
524
|
If a `wave` test act is included in the job, an environment variable named `WAVE_KEY` must exist, with your WAVE API key as its value. You can get it from [WebAIM](https://wave.webaim.org/api/).
|
|
626
525
|
|
|
@@ -628,9 +527,7 @@ The `wave` API does not accept a transmitted document for testing. WAVE must be
|
|
|
628
527
|
|
|
629
528
|
This limitation of WAVE may be overcome in a future version of Testaro by means of the invocation of the WAVE Chrome extension with Playwright.
|
|
630
529
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
After any act in a job, you can change the browser type by inserting a `launch` act. One reason for specifying a particular browser type is that particular tests have different results with different browser types. Another is that you may wish to perform tests with more than a single browser type.
|
|
530
|
+
### Browser types
|
|
634
531
|
|
|
635
532
|
The warning comments in the `testaro/hover.js` and `testaro/motion.js` files state that those tests operate correctly only with the `webkit` browser type. The warning comment in the `testaro/focInd.js` file states that that test operates incorrectly with the `firefox` browser type.
|
|
636
533
|
|
|
@@ -648,13 +545,13 @@ and the other test act can specify the rules as
|
|
|
648
545
|
|
|
649
546
|
Together, they get all tests of the tool performed. Before each test act, you can ensure that the latest `launch` act has specified the browser type to be used in that test act.
|
|
650
547
|
|
|
651
|
-
|
|
548
|
+
### `actSpecs` file
|
|
652
549
|
|
|
653
|
-
|
|
550
|
+
#### Introduction
|
|
654
551
|
|
|
655
552
|
The `actSpecs.js` file contains rules governing acts. The rules determine whether an act is valid.
|
|
656
553
|
|
|
657
|
-
|
|
554
|
+
#### Rule format
|
|
658
555
|
|
|
659
556
|
The rules in `actSpecs.js` are organized into two objects, `etc` and `tests`. The `etc` object contains rules for acts of all types. The `tools` object contains additional rules that apply to some acts of type `test`, depending on the values of their `which` properties, namely which tools they perform tests of.
|
|
660
557
|
|
|
@@ -700,6 +597,111 @@ The validity criterion named in item 2 may be any of these:
|
|
|
700
597
|
- `'isWaitable'`: is `'url'`, `'title'`, or `'body'`
|
|
701
598
|
- `'areStrings'`: is an array of strings
|
|
702
599
|
|
|
600
|
+
## Reports
|
|
601
|
+
|
|
602
|
+
### Introduction
|
|
603
|
+
|
|
604
|
+
Each tool produces a _tool report_ of the results of its tests. Testaro prunes the tool reports for brevity, removing content that is judged unlikely to be useful. Testaro then appends each tool report to the test act that invoked the tool.
|
|
605
|
+
|
|
606
|
+
Testaro also generates some data about the job and adds those data to the job, in a `jobData` property.
|
|
607
|
+
|
|
608
|
+
### Contents
|
|
609
|
+
|
|
610
|
+
A report discloses:
|
|
611
|
+
- raw results of tests conducted by tools
|
|
612
|
+
- standardized results of tests conducted by tools
|
|
613
|
+
- process data, including statistics on:
|
|
614
|
+
- latency (how long a time each tool takes to run its tests)
|
|
615
|
+
- test prevention (the failure of tools to run on particular targets)
|
|
616
|
+
- logging (browser messaging, including about document errors, during testing)
|
|
617
|
+
|
|
618
|
+
### Formats
|
|
619
|
+
|
|
620
|
+
#### Tool-report formats
|
|
621
|
+
|
|
622
|
+
The tools listed above as dependencies write their tool reports in various formats. They differ in how they organize multiple instances of the same problem, how they classify severity and certainty, how they point to the locations of problems, how they name problems, etc.
|
|
623
|
+
|
|
624
|
+
A Testaro report can include, for each tool, either or both of these properties:
|
|
625
|
+
- `result`: the result in the native tool format.
|
|
626
|
+
- `standardResult`: the result in a standard format identical for all tools.
|
|
627
|
+
|
|
628
|
+
#### Standard result
|
|
629
|
+
|
|
630
|
+
##### Properties
|
|
631
|
+
|
|
632
|
+
The standard result includes three properties:
|
|
633
|
+
- `prevented`: a boolean (`true` or `false`) value, stating whether the page prevented the tool from performing its tests.
|
|
634
|
+
- `totals`: an array of numbers representing how many instances of rule violations at each level of severity the tool reported. There are 4 ordinal severity levels. For example, the array `[3, 0, 14, 10]` would report that there were 3 violations at level 0, 0 at level 1, 14 at level 2, and 10 at level 3.
|
|
635
|
+
- `instances`: an array of objects describing the rule violations. An instance can describe a single violation, usually by one element in the page, or can summarize multiple violations of the same rule.
|
|
636
|
+
|
|
637
|
+
##### Instances
|
|
638
|
+
|
|
639
|
+
Here is an example of a standard instance:
|
|
640
|
+
|
|
641
|
+
```javascript
|
|
642
|
+
{
|
|
643
|
+
ruleID: 'rule01',
|
|
644
|
+
what: 'Button type invalid',
|
|
645
|
+
ordinalSeverity: 2,
|
|
646
|
+
count: 1,
|
|
647
|
+
tagName: 'BUTTON'
|
|
648
|
+
id: '',
|
|
649
|
+
location: {
|
|
650
|
+
doc: 'dom',
|
|
651
|
+
type: 'xpath',
|
|
652
|
+
spec: '/html[1]/body[1]/section[3]/div[2]/div[1]/ul[1]/li[1]/button[1]'
|
|
653
|
+
},
|
|
654
|
+
excerpt: '<button type="link"></button>',
|
|
655
|
+
boxID: '12:340:46:50',
|
|
656
|
+
pathID: '/html/body/section[3]/div[2]/div/ul/li[1]/button[1]'
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
This instance describes a violation of a rule named `rule01` by a `button` element.
|
|
661
|
+
|
|
662
|
+
The element has no `id` attribute to distinguish it from other `button` elements, but the tool describes its location. This tool uses an XPath to do that. Tools use various methods for location description, namely:
|
|
663
|
+
- `line` (line number in the code of the page): Nu Html Checker
|
|
664
|
+
- `selector` (CSS selector): Axe, QualWeb, WAVE
|
|
665
|
+
- `xpath`: Alfa, ASLint, Equal Access
|
|
666
|
+
- `box` (coordinates, width, and height of the element box): Editoria11y, Testaro
|
|
667
|
+
- none: HTML CodeSniffer
|
|
668
|
+
The tool also reproduces an excerpt of the element code.
|
|
669
|
+
|
|
670
|
+
##### Element identification
|
|
671
|
+
|
|
672
|
+
While the above properties can help you find the offending element, Testaro makes this easier by adding, where practical, two standard element identifiers to each standard instance:
|
|
673
|
+
- `boxID`: a compact representation of the x, y, width, and height of the element bounding box, if the element can be identified and is visible.
|
|
674
|
+
- `pathID`: the XPath of the element, if the element can be identified.
|
|
675
|
+
|
|
676
|
+
These standard identifiers can help you determine whether violations reported by different tools belong to the same element or different elements. The `boxID` property can also support the making of images of the violating elements.
|
|
677
|
+
|
|
678
|
+
Some tools limit the efficacy of the current algorithm for standard identifiers:
|
|
679
|
+
- HTML CodeSniffer does not report element locations, and the reported code excerpts exclude all text content.
|
|
680
|
+
- Nu Html Checker reports line and column boundaries of element start tags and truncates element text content in reported code excerpts.
|
|
681
|
+
|
|
682
|
+
Testing can change the pages being tested, and such changes can cause a particular element to change its physical or logical location. In such cases, an element may appear multiple times in a tool report with different `boxID` or `pathID` values, even though it is, for practical purposes, the same element.
|
|
683
|
+
|
|
684
|
+
##### Standardization configuration
|
|
685
|
+
|
|
686
|
+
Each job specifies how Testaro is to handle report standardization. A job contains a `standard` property, with one of the following values to determine which results the report will include:
|
|
687
|
+
- `'also'`: original and standard.
|
|
688
|
+
- `'only'`: standard only.
|
|
689
|
+
- `'no'`: original only.
|
|
690
|
+
|
|
691
|
+
If a tool has the option to be used without itemization and is being so used, the `instances` array may be empty, or may contain one or more summary instances. Summary instances disclose the numbers of instances that they summarize with the `count` property. They typically summarize violations by multiple elements, in which case their `id`, `location`, `excerpt`, `boxID`, and `pathID` properties will have empty values.
|
|
692
|
+
|
|
693
|
+
##### Standardization opinionation
|
|
694
|
+
|
|
695
|
+
This standard format reflects some judgments. For example:
|
|
696
|
+
- The `ordinalSeverity` property of an instance involves interpretation. Tools may report severity, certainty, priority, or some combination of those. They may use ordinal or metric quantifications. If they quantify ordinally, their scales may have more or fewer than 4 ranks. Testaro coerces each tool’s severity, certainty, and/or priority classification into a 4-rank ordinal classification. This classification is deemed to express the most common pattern among the tools.
|
|
697
|
+
- The `tagName` property of an instance may not always be obvious, because in some cases the rule being tested for requires a relationship among more than one element (e.g., “An X element may not have a Y element as its parent”).
|
|
698
|
+
- The `ruleID` property of an instance is a matching rule if the tool issues a message but no rule identifier for each instance. The `nuVal` tool does this. In this case, Testaro is classifying the messages into rules.
|
|
699
|
+
- The `ruleID` property of an instance may reclassify tool rules. For example, if a tool rule covers multiple situations that are dissimilar, that rule may be split into multiple rules with distinct `ruleID` properties.
|
|
700
|
+
|
|
701
|
+
You are not dependent on the judgments incorporated into the standard format, because Testaro can give you the original reports from the tools.
|
|
702
|
+
|
|
703
|
+
The standard format does not express opinions on issue classification. A rule ID identifies something deemed to be an issue by a tool. Useful reporting from multi-tool testing still requires the classification of tool **rules** into **issues**. If tool `A` has `alt-incomplete` as a rule ID and tool `B` has `image_alt_stub` as a rule ID, Testaro does not decide whether those are really the same issue or different issues. That decision belongs to you. The standardization of tool reports by Testaro eliminates some of the drudgery in issue classification, but not any of the judgment required for issue classification.
|
|
704
|
+
|
|
703
705
|
## Execution
|
|
704
706
|
|
|
705
707
|
### Introduction
|
|
@@ -907,21 +909,15 @@ The files in the `temp` directory are presumed ephemeral and are not tracked by
|
|
|
907
909
|
- produces human-oriented HTML digests from scored reports
|
|
908
910
|
- produces human-oriented HTML comparisons of the scores of targets
|
|
909
911
|
|
|
910
|
-
Testilo contains procedures that reorganize report data by issue rather than tool, and that compensate for duplicative tests when computing scores.
|
|
911
|
-
|
|
912
|
-
Testaro is derived from [Autotest](https://github.com/jrpool/autotest). Autotest was created as a monolithic accessibility testing package, but that forced functionalities to be hosted on a workstation merely because it was impractical to host Playwright elsewhere. Testaro embodies an architectural decision to isolate workstation-dependent functionalities.
|
|
912
|
+
Testilo contains procedures that reorganize report data by issue and by element, rather than tool, and that compensate for duplicative tests when computing scores.
|
|
913
913
|
|
|
914
|
-
|
|
915
|
-
- tests producing results intended to be human-inspected
|
|
916
|
-
- scoring (now in Testilo)
|
|
917
|
-
- file operations for score aggregation, report revision, and HTML reports (now in Testilo)
|
|
918
|
-
- a web user interface
|
|
914
|
+
Report standardization could be performed on a server rather than a workstation, but that would require sending the original reports to the server. They are generally much larger than standardized reports. Whenever users want only standardized reports, standardizing them on the workstation eliminates the need to send the original reports anywhere. For that reason, Testaro performs report standardization.
|
|
919
915
|
|
|
920
916
|
## Code style
|
|
921
917
|
|
|
922
918
|
The JavaScript code in this project generally conforms to the ESLint configuration file `.eslintrc.json`. However, the `htmlcs/HTMLCS.js` file implements an older version of JavaScript. Its style is regulated by the `htmlcs/.eslintrc.json` file.
|
|
923
919
|
|
|
924
|
-
##
|
|
920
|
+
## History
|
|
925
921
|
|
|
926
922
|
Work on the custom tests in this package began in 2017, and work on the multi-package ensemble that Testaro implements began in early 2018. These two aspects were combined into the [Autotest](https://github.com/jrpool/autotest) package in early 2021 and into the more single-purpose packages, Testaro and Testilo, in January 2022.
|
|
927
923
|
|