testaro 8.5.2 → 9.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 +94 -155
- package/{commands.js → actSpecs.js} +1 -1
- package/call.js +35 -13
- package/package.json +2 -3
- package/run.js +99 -148
- package/samples/00000-ts18-example.json +3 -3
- package/validation/executors/run.js +40 -0
- package/validation/executors/watchDir.js +7 -6
- package/validation/executors/watchNet.js +5 -6
- package/validation/jobs/done/README.md +3 -0
- package/validation/jobs/{00000-simple-example.json → todo/00000-simple-example.json} +6 -7
- package/validation/jobs/{README.md → todo/README.md} +0 -0
- package/validation/tests/jobs/allHidden.json +3 -2
- package/validation/tests/jobs/bulk.json +3 -2
- package/validation/tests/jobs/docType.json +3 -2
- package/validation/tests/jobs/elements.json +3 -2
- package/validation/tests/jobs/embAc.json +3 -2
- package/validation/tests/jobs/filter.json +3 -2
- package/validation/tests/jobs/focAll.json +3 -2
- package/validation/tests/jobs/focInd.json +3 -2
- package/validation/tests/jobs/focOp.json +3 -2
- package/validation/tests/jobs/focVis.json +3 -2
- package/validation/tests/jobs/hover.json +3 -2
- package/validation/tests/jobs/labClash.json +3 -2
- package/validation/tests/jobs/linkTo.json +3 -2
- package/validation/tests/jobs/linkUl.json +3 -2
- package/validation/tests/jobs/menuNav.json +3 -2
- package/validation/tests/jobs/miniText.json +3 -2
- package/validation/tests/jobs/motion.json +3 -2
- package/validation/tests/jobs/nonTable.json +3 -2
- package/validation/tests/jobs/radioSet.json +3 -2
- package/validation/tests/jobs/role.json +3 -2
- package/validation/tests/jobs/styleDiff.json +3 -2
- package/validation/tests/jobs/tabNav.json +3 -2
- package/validation/tests/jobs/textNodes.json +3 -2
- package/validation/tests/jobs/title.json +3 -2
- package/validation/tests/jobs/titledEl.json +3 -2
- package/validation/tests/jobs/zIndex.json +3 -2
- package/validation/validateTest.js +3 -8
- package/validation/watch/{README.md → done/README.md} +0 -0
- package/validation/watch/todo/README.md +3 -0
- package/watch.js +16 -22
- package/high.js +0 -60
- package/validation/executors/high.js +0 -52
- package/validation/executors/low.js +0 -53
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ All of the tests that Testaro can perform are free of cost, except those in the
|
|
|
111
111
|
|
|
112
112
|
A _job_ is an object containing instructions for Testaro.
|
|
113
113
|
|
|
114
|
-
A _report_ is
|
|
114
|
+
A _report_ is a job with added properties describing the results from Testaro running the job.
|
|
115
115
|
|
|
116
116
|
### Jobs
|
|
117
117
|
|
|
@@ -123,7 +123,7 @@ Here is an example of a job:
|
|
|
123
123
|
what: 'Test host with alfa',
|
|
124
124
|
strict: true,
|
|
125
125
|
timeLimit: 65,
|
|
126
|
-
|
|
126
|
+
acts: [
|
|
127
127
|
{
|
|
128
128
|
type: 'launch',
|
|
129
129
|
which: 'chromium',
|
|
@@ -143,10 +143,10 @@ Here is an example of a job:
|
|
|
143
143
|
],
|
|
144
144
|
sources: {
|
|
145
145
|
script: 'tp25',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
batch: 'weborgs',
|
|
147
|
+
target: {
|
|
148
|
+
id: 'w3c',
|
|
149
|
+
what: 'World Wide Web Consortium'
|
|
150
150
|
},
|
|
151
151
|
requester: 'user@domain.org'
|
|
152
152
|
},
|
|
@@ -155,94 +155,51 @@ Here is an example of a job:
|
|
|
155
155
|
}
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
This job contains three `
|
|
158
|
+
This job contains three `acts`, telling Testaro to:
|
|
159
159
|
1. open a page in the Chromium browser
|
|
160
160
|
1. navigate to some URL
|
|
161
161
|
1. perform the tests in the `alfa` package on that URL
|
|
162
162
|
|
|
163
163
|
Job properties:
|
|
164
|
-
- `id`: This is a string consisting of alphanumeric ASCII characters and hyphen-minus (-), intended to be unique. When this job is saved as a JSON file, the file name is `be76p-sp25-w3c.json`. Typically, a job is created from a _script_, and the job ID adds a timestamp prefix and a
|
|
165
|
-
- `what`: This is a description of the
|
|
164
|
+
- `id`: This is a string consisting of alphanumeric ASCII characters and hyphen-minus (-), intended to be unique. When this job is saved as a JSON file, the file name is `be76p-sp25-w3c.json`. Typically, a job is created from a _script_, and the job ID adds a timestamp prefix and a target suffix to the script ID. Here the script ID would have been `ts25`.
|
|
165
|
+
- `what`: This is a description of the job.
|
|
166
166
|
- `strict`: This is `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. For example, if `strict` is true, a redirection from `xyz.com` to `www.xyz.com` or to `xyz.com/en` will abort the job.
|
|
167
|
-
- `timeLimit`: This
|
|
168
|
-
- `
|
|
167
|
+
- `timeLimit`: This property is the number of seconds allowed for the execution of the job.
|
|
168
|
+
- `acts`: This is an array of the acts to be performed. Acts are documented below.
|
|
169
169
|
- `sources`: This object has properties describing where the job came from:
|
|
170
|
-
- `script`: This is the ID of the script from which the job was made. Other applications, such as Testilo, can make jobs from scripts.
|
|
171
|
-
- `
|
|
170
|
+
- `script`: This is the ID of the script from which the job was made. Other applications, such as Testilo, can make jobs from scripts. When Testilo creates a job, the job inherits its `id`, `what`, `strict`, `timeLimit`, and `acts` properties from the script. However, Testilo can create multiple jobs from a single script, replacing acts of type `placeholder` with one or more target-specific acts. Examples of scripts can be found in the Testilo package.
|
|
171
|
+
- `batch`: If the job was one of a set of jobs created by a merger of a script and a batch of targets, this property’s value is the ID of the batch, or otherwise is an empty string.
|
|
172
|
+
- `target`: If the job was made from a script with placeholder acts, this property describes the target whose target-specific acts have replaced the placeholder acts. Otherwise `target` is an empty object. Testilo also makes the `id` property of the target the third segment of the job ID.
|
|
172
173
|
- `requester`: This string is the email address to receive a notice of completion of the running of the job.
|
|
173
|
-
- `
|
|
174
|
-
- `timeStamp`: This string is a compact representation of the job creation time, for inclusion in the ID of the job.
|
|
174
|
+
- `creationTime`: This is the time when the job was created from a script.
|
|
175
|
+
- `timeStamp`: This string is a compact representation of the job creation time, suitable for inclusion in the ID of the job.
|
|
175
176
|
|
|
176
177
|
### Reports
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
A _report_ is a copy of a job file. It begins as a pure copy. Testaro adds data to it as Testaro runs the job. Specifically, Testaro:
|
|
180
|
+
- Adds a `jobData` property and populates it with data about the job.
|
|
181
|
+
- Adds properties to the acts, describing the results of the performance of the acts.
|
|
179
182
|
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
job: {
|
|
183
|
-
id: 'be76p-tp25-w3c',
|
|
184
|
-
what: 'Test host with alfa',
|
|
185
|
-
strict: true,
|
|
186
|
-
timeLimit: 65,
|
|
187
|
-
commands: [
|
|
188
|
-
{
|
|
189
|
-
type: 'launch',
|
|
190
|
-
which: 'chromium',
|
|
191
|
-
what: 'Chromium browser'
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
type: 'url',
|
|
195
|
-
which: 'https://www.w3c.org',
|
|
196
|
-
what: 'World Wide Web Consortium',
|
|
197
|
-
id: 'w3c'
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
type: 'test',
|
|
201
|
-
which: 'alfa',
|
|
202
|
-
what: 'Siteimprove alfa package'
|
|
203
|
-
}
|
|
204
|
-
],
|
|
205
|
-
sources: {
|
|
206
|
-
script: 'tp25',
|
|
207
|
-
host: {
|
|
208
|
-
which: 'https://www.w3c.org',
|
|
209
|
-
what: 'World Wide Web Consortium',
|
|
210
|
-
id: 'w3c'
|
|
211
|
-
},
|
|
212
|
-
requester: 'user@domain.org'
|
|
213
|
-
},
|
|
214
|
-
jobCreationTime: '2023-05-26T14:28:22',
|
|
215
|
-
timeStamp: 'be76p'
|
|
216
|
-
},
|
|
217
|
-
acts: [],
|
|
218
|
-
jobData: {}
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
This report is an object produced by Testaro when it is about to run a job. The `job` property has the job as its value. The report also has two additional properties:
|
|
223
|
-
- `acts`: This is an empty array. Testaro will copy the `job.commands` property into `acts` and then modify the array. Testaro can add more acts to the original ones. Testaro will also add results to the acts.
|
|
224
|
-
- `jobData`: Some results pertain to a job as a whole, not to any specific act. This property is an object where Testaro will record such job-level results.
|
|
225
|
-
|
|
226
|
-
### Commands
|
|
183
|
+
### Acts
|
|
227
184
|
|
|
228
185
|
#### Introduction
|
|
229
186
|
|
|
230
|
-
The `
|
|
187
|
+
The `acts` array was introduced above. This section provides more detail.
|
|
231
188
|
|
|
232
|
-
Each
|
|
189
|
+
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`.
|
|
233
190
|
|
|
234
|
-
####
|
|
191
|
+
#### Act sequence
|
|
235
192
|
|
|
236
|
-
The first two
|
|
193
|
+
The first two acts in any job have the types `launch` and `url`, respectively, as shown in the example above. They launch a browser and then use it to visit a URL.
|
|
237
194
|
|
|
238
|
-
####
|
|
195
|
+
#### Act types
|
|
239
196
|
|
|
240
|
-
The subsequent
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
197
|
+
The subsequent acts can tell Testaro to perform any of:
|
|
198
|
+
- _moves_ (clicks, text inputs, hovers, etc.)
|
|
199
|
+
- _navigations_ (browser launches, visits to URLs, waits for page conditions, etc.)
|
|
200
|
+
- _alterations_ (changes to the page)
|
|
201
|
+
- _tests_ (whether in dependency packages or defined within Testaro)
|
|
202
|
+
- _branching_ (continuing from an act other than the next one)
|
|
246
203
|
|
|
247
204
|
##### Moves
|
|
248
205
|
|
|
@@ -261,15 +218,15 @@ In this case, Testaro checks the third radio button whose text includes the stri
|
|
|
261
218
|
|
|
262
219
|
In identifying the target element for a move, Testaro matches the `which` property with the texts of the elements of the applicable type (such as radio buttons). It defines the text of an `input` element as the concatenated texts of its implicit label or explicit labels, if any, plus, for the first input in a `fieldset` element, the text content of the `legend` element of that `fieldset` element. For any other element, Testaro defines the text as the text content of the element.
|
|
263
220
|
|
|
264
|
-
When the texts of multiple elements of the same type will contain the `which` value, you can include an `index` property to specify the index of the target element, among all those that will match.
|
|
221
|
+
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.
|
|
265
222
|
|
|
266
223
|
##### Navigations
|
|
267
224
|
|
|
268
225
|
An example of a **navigation** is the command of type `url` above.
|
|
269
226
|
|
|
270
|
-
Once you have included a `url` command in a job, you do not need to add more `url` commands unless you want the browser to visit a different URL.
|
|
227
|
+
Once you have included a `url` command in a job, you do not need to add more `url` commands unless you want the browser to visit a different URL or revisit the same URL.
|
|
271
228
|
|
|
272
|
-
|
|
229
|
+
If any act alters the page, you can restore the page to its original state for the next act by inserting new `launch` and `url` acts (and, if necessary, additional page-specific acts) between them.
|
|
273
230
|
|
|
274
231
|
Another navigation example is:
|
|
275
232
|
|
|
@@ -305,8 +262,8 @@ This command causes Testaro to alter the `display` and `visibility` style proper
|
|
|
305
262
|
A test performs operations and reports results. The results may or may not directly 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 results. As one example, the Testaro `elements` test reports facts about certain elements on a page, without asserting that those facts are successes or failures.
|
|
306
263
|
|
|
307
264
|
The term “test” has two meanings for Testaro:
|
|
308
|
-
-
|
|
309
|
-
-
|
|
265
|
+
- An act is a test (_test command_) if its `type` property has the value `test`.
|
|
266
|
+
- An act with type `test` whose `which` value is the name of a package, such as Continuum, performs multiple tests defined by that _test package_.
|
|
310
267
|
|
|
311
268
|
Thus, if a command of type `test` runs Continuum, Continuum performs multiple tests and reports their results.
|
|
312
269
|
|
|
@@ -316,7 +273,7 @@ Every test in Testaro must have:
|
|
|
316
273
|
- a property in the `tests` object defined in the `run.js` file, where the property name is the name of the test and the value is a description of the test
|
|
317
274
|
- a `.js` file, defining the test, in the `tests` directory, whose name base is the name of the test
|
|
318
275
|
|
|
319
|
-
The `
|
|
276
|
+
The `actSpecs.js` file (described in detail below) contains a specification for any `test` act, namely:
|
|
320
277
|
|
|
321
278
|
```json
|
|
322
279
|
test: [
|
|
@@ -330,7 +287,7 @@ test: [
|
|
|
330
287
|
|
|
331
288
|
That means that a test (i.e. a command with a `type` property having the value `'test'`) must have a string-valued `which` property naming a test and may optionally have a string-valued `what` property describing the test.
|
|
332
289
|
|
|
333
|
-
If a particular test either must have or may have any other properties, those properties must be specified in the `tests` property in `
|
|
290
|
+
If a particular test either must have or may have any other properties, those properties must be specified in the `tests` property in `actSpecs.js`.
|
|
334
291
|
|
|
335
292
|
###### Examples
|
|
336
293
|
|
|
@@ -378,7 +335,7 @@ If you choose to invoke this packaged test with the `withNewContent` property sp
|
|
|
378
335
|
|
|
379
336
|
The `htmlcs` packaged test makes use of the`htmlcs/HTMLCS.js` file. That file was created, and can be recreated if necessary, as follows:
|
|
380
337
|
|
|
381
|
-
1. Clone the
|
|
338
|
+
1. Clone the [HTML CodeSniffer package](https://github.com/squizlabs/HTML_CodeSniffer).
|
|
382
339
|
1. Make that package’s directory the active directory.
|
|
383
340
|
1. Install the HTML CodeSniffer dependencies by executing `npm install`.
|
|
384
341
|
1. Build the HTML CodeSniffer auditor by executing `grunt build`.
|
|
@@ -408,9 +365,9 @@ The changes in `htmlcs/HTMLCS.js` are:
|
|
|
408
365
|
|
|
409
366
|
###### Tenon
|
|
410
367
|
|
|
411
|
-
Most packaged tests require only one
|
|
412
|
-
-
|
|
413
|
-
-
|
|
368
|
+
Most packaged tests require only one act, but the `tenon` packaged test requires two acts:
|
|
369
|
+
- An act of type `tenonRequest`.
|
|
370
|
+
- An act of type `test` with `tenon` as the value of `which`.
|
|
414
371
|
|
|
415
372
|
Example:
|
|
416
373
|
|
|
@@ -438,13 +395,13 @@ The reason for this is that the Tenon API operates asynchronously. You ask it to
|
|
|
438
395
|
|
|
439
396
|
Tenon says that tests are typically completed in 3 to 6 seconds but that the latency can be longer, depending on demand.
|
|
440
397
|
|
|
441
|
-
Therefore, you can include a `tenonRequest`
|
|
398
|
+
Therefore, you can include a `tenonRequest` act early in your job, and a `tenon` test act late in your job. Tenon will move your request through its queue while Testaro is processing your job. When Testaro reaches your `tenon` test act, Tenon will most likely have completed your test. If not, the `tenon` test will wait and then make a second request before giving up.
|
|
442
399
|
|
|
443
|
-
Thus, a `tenon` test actually does not perform any test; it merely collects the result. The page that was active when the `tenonRequest`
|
|
400
|
+
Thus, a `tenon` test actually does not perform any test; it merely collects the result. The page that was active when the `tenonRequest` act was performed is the one that Tenon tests.
|
|
444
401
|
|
|
445
|
-
In case you want to perform more than one `tenon` test with the same job, you can do so. Just give each pair of
|
|
402
|
+
In case you want to perform more than one `tenon` test with the same job, you can do so. Just give each pair of acts a distinct `id` property, so each `tenon` test act will request the correct result.
|
|
446
403
|
|
|
447
|
-
Tenon recommends giving it a public URL rather than giving it the content of a page, if possible. So, it is best to give the `withNewContent` property of the `tenonRequest`
|
|
404
|
+
Tenon recommends giving it a public URL rather than giving it the content of a page, if possible. So, it is best to give the `withNewContent` property of the `tenonRequest` act the value `true`, unless the page is not public.
|
|
448
405
|
|
|
449
406
|
If a `tenon` test is included in a job, environment variables named `TENON_USER` and `TENON_PASSWORD` must exist, with your Tenon username and password, respectively, as their values. You can obtain those from [Tenon](https://tenon.io/documentation/overview).
|
|
450
407
|
|
|
@@ -454,6 +411,8 @@ If a `wave` test is included in the job, an environment variable named `WAVE_KEY
|
|
|
454
411
|
|
|
455
412
|
The `wave` API does not accept a transmitted document for testing. WAVE must be given only a URL, which it then visits to perform its tests. Therefore, you cannot manipulate a page and then have WAVE test it, or ask WAVE to test a page that cannot be reached directly with a URL.
|
|
456
413
|
|
|
414
|
+
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.
|
|
415
|
+
|
|
457
416
|
###### BBC Accessibility Standards Checker
|
|
458
417
|
|
|
459
418
|
The BBC Accessibility Standards Checker has obsolete dependencies with security vulnerabilities. Therefore, it is not used as a dependency of Testaro. Instead, 6 of its tests are reimplemented, in some cases with revisions, as Testaro tests. They are drawn from the 18 automated tests of the Checker. The other 12 tests were found too duplicative of other tests to justify reimplementation.
|
|
@@ -475,17 +434,17 @@ This command checks the result of the previous act to determine whether its `res
|
|
|
475
434
|
|
|
476
435
|
A `next`-type command can use a `next` property instead of a `jump` property. The value of the `next` property is a command name. It tells Testaro to continue performing commands starting with the command having that value as the value of its `name` property.
|
|
477
436
|
|
|
478
|
-
####
|
|
437
|
+
#### `actSpecs` file
|
|
479
438
|
|
|
480
439
|
##### Introduction
|
|
481
440
|
|
|
482
|
-
The `
|
|
441
|
+
The `actSpecs.js` file contains rules governing acts. The rules determine whether an act is valid.
|
|
483
442
|
|
|
484
443
|
##### Rule format
|
|
485
444
|
|
|
486
|
-
The rules in `
|
|
445
|
+
The rules in `actSpecs.js` are organized into two objects, `etc` and `tests`. The `etc` object contains rules for acts of all types. The `tests` object contains additional rules that apply to some acts of type `test`, depending on the values of their `which` properties, namely which tests they perform.
|
|
487
446
|
|
|
488
|
-
Here is an example of
|
|
447
|
+
Here is an example of an act:
|
|
489
448
|
|
|
490
449
|
```json
|
|
491
450
|
{
|
|
@@ -495,7 +454,7 @@ Here is an example of a command:
|
|
|
495
454
|
}
|
|
496
455
|
```
|
|
497
456
|
|
|
498
|
-
And here is the applicable property of the `etc` object in `
|
|
457
|
+
And here is the applicable property of the `etc` object in `actSpecs.js`:
|
|
499
458
|
|
|
500
459
|
```js
|
|
501
460
|
link: [
|
|
@@ -507,15 +466,15 @@ link: [
|
|
|
507
466
|
]
|
|
508
467
|
```
|
|
509
468
|
|
|
510
|
-
The rule is an array with two elements: a string ('Click a link') describing the
|
|
469
|
+
The rule is an array with two elements: a string ('Click a link') describing the act and an object containing requirements for any act of type `link`.
|
|
511
470
|
|
|
512
|
-
The requirement `which: [true, 'string', 'hasLength', 'substring of the link text']` specifies what is required for the `which` property of a `link`-type
|
|
471
|
+
The requirement `which: [true, 'string', 'hasLength', 'substring of the link text']` specifies what is required for the `which` property of a `link`-type act. The requirement is an array.
|
|
513
472
|
|
|
514
473
|
In most cases, the array has length 4:
|
|
515
|
-
- 0. Is the property (here `which`) required (`true` or `false`)? The value `true` here means that every `link`-type
|
|
474
|
+
- 0. Is the property (here `which`) required (`true` or `false`)? The value `true` here means that every `link`-type act **must** contain a `which` property.
|
|
516
475
|
- 1. What format must the property value have (`'string'`, `'array'`, `'boolean'`, or `'number'`)?
|
|
517
476
|
- 2. What other validity criterion applies (if any)? (Empty string if none.) The `hasLength` criterion means that the string must be at least 1 character long.
|
|
518
|
-
- 3. Description of the property. In this example, the description says that the value of `which` must be a substring of the text content of the link that is to be clicked. Thus, a `link`
|
|
477
|
+
- 3. Description of the property. In this example, the description says that the value of `which` must be a substring of the text content of the link that is to be clicked. Thus, a `link` act tells Testaro to find the first link whose text content has this substring and click it.
|
|
519
478
|
|
|
520
479
|
The validity criterion named in item 2 may be any of these:
|
|
521
480
|
- `'hasLength'`: is not a blank string
|
|
@@ -527,20 +486,20 @@ The validity criterion named in item 2 may be any of these:
|
|
|
527
486
|
- `'isWaitable'`: is `'url'`, `'title'`, or `'body'`
|
|
528
487
|
- `'areStrings'`: is an array of strings
|
|
529
488
|
|
|
530
|
-
Any `test`
|
|
489
|
+
Any `test` act can also (in addition to the requirements in `actSpecs.js`) 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 test.
|
|
531
490
|
|
|
532
491
|
For example, a `test` command might have this `expect` property:
|
|
533
492
|
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
[
|
|
537
|
-
[
|
|
538
|
-
[
|
|
539
|
-
[
|
|
493
|
+
```javaScript
|
|
494
|
+
'expect': [
|
|
495
|
+
['total.links', '=', 5],
|
|
496
|
+
['total.links.underlined', '<', 6],
|
|
497
|
+
['total.links.outlined'],
|
|
498
|
+
['docLang', '!', 'es-ES']
|
|
540
499
|
]
|
|
541
500
|
```
|
|
542
501
|
|
|
543
|
-
That would state the expectation that the `result` property of the
|
|
502
|
+
That would state the expectation that the `result` property of the act for that test in the report will have a `total.links` property with the value 5, a `total.links.underlined` property with a value less than 6, **no** `total.links.outlined` property, and a `docLang` property with a value different from `es-ES`.
|
|
544
503
|
|
|
545
504
|
The first item in each array is an identifier of a property within the `result` property. The item has the format of a string with `.` delimiters. Each `.`-delimited segment its the name of the next property in the hierarchy. If the current object is an array, the next segment must be a non-negative integer, representing the index of an element of the array. For example, `items.1.attributes.0` references the first element of the array that is the `attributes` property of the object that is the second element of the array that is the `items` property of `result`. (In JavaScript, this would be written `items[1].attributes[0]`, but in the `expect` property all property names are `.`-delimited.)
|
|
546
505
|
|
|
@@ -566,8 +525,7 @@ Testaro can be called by modules and by users.
|
|
|
566
525
|
### Functions
|
|
567
526
|
|
|
568
527
|
Testaro contains these modules that export executable functions:
|
|
569
|
-
- `run.js` exports `doJob` for
|
|
570
|
-
- `high.js` exports `runJob` for high-level execution.
|
|
528
|
+
- `run.js` exports `doJob` for immediate execution.
|
|
571
529
|
- `watch.js` exports `cycle` for watch-triggered execution.
|
|
572
530
|
|
|
573
531
|
#### Imports
|
|
@@ -582,79 +540,65 @@ The argument of `require` is a path relative to the directory of the module in w
|
|
|
582
540
|
|
|
583
541
|
A module in another Node.js package that has Testaro as a dependency can execute the same statements, except changing `'./m'` to `'testaro/m'`.
|
|
584
542
|
|
|
585
|
-
####
|
|
543
|
+
#### Immediate
|
|
544
|
+
|
|
545
|
+
A job can be immediately executed as follows:
|
|
586
546
|
|
|
587
|
-
|
|
547
|
+
##### By a module
|
|
588
548
|
|
|
589
549
|
```javascript
|
|
590
|
-
const report = {
|
|
591
|
-
job: {…},
|
|
592
|
-
acts: [],
|
|
593
|
-
jobData: {}
|
|
594
|
-
};
|
|
595
550
|
const {doJob} = require('./run');
|
|
596
551
|
doJob(report)
|
|
597
552
|
.then(() => …);
|
|
598
553
|
```
|
|
599
554
|
|
|
600
|
-
|
|
555
|
+
The `report` variable here references a copy of a job to be used as a report.
|
|
601
556
|
|
|
602
557
|
Testaro will run the job and modify the `report` object. When Testaro finishes, the `acts` and `jobData` properties of `report` will contain the results. The final statement can further process the `report` object as desired in the `then` callback.
|
|
603
558
|
|
|
604
|
-
The Testilo package contains functions that can create jobs from scripts.
|
|
605
|
-
|
|
606
|
-
#### High-level
|
|
607
|
-
|
|
608
|
-
High-level execution is designed for either modules or users.
|
|
609
|
-
|
|
610
|
-
Execution by a module:
|
|
611
|
-
|
|
612
|
-
```javaScript
|
|
613
|
-
const {runJob} = require('./high');
|
|
614
|
-
runJob('be76p-tp25-w3c');
|
|
615
|
-
```
|
|
559
|
+
The Testilo package contains functions that can create jobs from scripts and add scores and explanations to reports.
|
|
616
560
|
|
|
617
|
-
|
|
561
|
+
##### By a user
|
|
618
562
|
|
|
619
563
|
```bash
|
|
620
|
-
node call
|
|
564
|
+
node call run be76p
|
|
621
565
|
```
|
|
622
566
|
|
|
623
|
-
In
|
|
567
|
+
In this example, `be76p` is the initial characters of the ID of a job saved as a JSON file in the `todo` subdirectory of the `process.env.JOBDIR` directory.
|
|
624
568
|
|
|
625
|
-
|
|
569
|
+
The `call` module will find the first job file with a matching name, execute the `doJob` function of the `run` module on the job, save the report in the `raw` subdirectory of the `process.env.REPORTDIR` directory, and archive the job file in the `done` subdirectory of the `process.env.JOBDIR` directory.
|
|
626
570
|
|
|
627
571
|
#### Watch
|
|
628
572
|
|
|
629
|
-
Watch execution is designed for either modules or users.
|
|
630
|
-
|
|
631
573
|
In watch mode, Testaro periodically checks for a job to run. When such a job exists, Testaro runs it and produces a report. Testaro may continue watching after the first report, or may quit.
|
|
632
574
|
|
|
633
|
-
|
|
575
|
+
##### By a module
|
|
634
576
|
|
|
635
577
|
```javaScript
|
|
636
578
|
const {cycle} = require('./watch');
|
|
637
579
|
cycle(true, true, 30);
|
|
638
580
|
```
|
|
639
581
|
|
|
640
|
-
|
|
582
|
+
##### By a user
|
|
641
583
|
|
|
642
584
|
```javaScript
|
|
643
585
|
node call watch true true 30
|
|
644
586
|
```
|
|
645
587
|
|
|
646
|
-
|
|
588
|
+
##### Arguments
|
|
589
|
+
|
|
590
|
+
The arguments passed to `cycle` by a module or to `watch` by a user are:
|
|
647
591
|
- whether to watch a directory (`true`) or the network (`false`)
|
|
648
592
|
- whether to continue watching indefinitely after the first report (`true` or `false`)
|
|
649
593
|
- how many seconds to wait after finding no job before checking again (a nonnegative number)
|
|
650
594
|
|
|
651
595
|
##### Directory watch
|
|
652
596
|
|
|
653
|
-
With directory watch, Testaro checks whether the job directory (`process.env.JOBDIR`)
|
|
597
|
+
With directory watch, Testaro checks whether the `todo` subdirectory of the job directory (`process.env.JOBDIR`) contains a job.
|
|
654
598
|
|
|
655
|
-
When Testaro finds one or more jobs
|
|
599
|
+
When Testaro finds one or more jobs to do, the `watch` module runs the first job, saves the report in the `raw` subdirectory of the `process.env.REPORTDIR` directory, and moves the job file from the `todo` subdirectory to the `done` subdirectory of the `process.env.JOBDIR` directory.
|
|
656
600
|
|
|
657
|
-
Since Testaro runs the first job (i.e. the job whose name is first in ASCII order), whoever populates the `process.env.JOBDIR` directory with job files has control over the order in which Testaro runs them. For example, to force a new job to be run before the already waiting jobs, one can give it a filename that comes before that of the first waiting job.
|
|
601
|
+
Since Testaro runs the first job (i.e. the job whose file name is first in ASCII order), whoever populates the `todo` subdirectory of the `process.env.JOBDIR` directory with job files has control over the order in which Testaro runs them. For example, to force a new job to be run before the already waiting jobs, one can give it a filename that comes before that of the first waiting job.
|
|
658
602
|
|
|
659
603
|
##### Network watch
|
|
660
604
|
|
|
@@ -682,10 +626,8 @@ WAVE_KEY=yourwavekey
|
|
|
682
626
|
PROTOCOL=https
|
|
683
627
|
JOB_URL=yourserver.tld/job
|
|
684
628
|
REPORT_URL=yourserver.tld/report
|
|
685
|
-
|
|
686
|
-
REPORTDIR=../testing/reports
|
|
687
|
-
JOBDIR=../testing/watch/ThisWorkstation
|
|
688
|
-
DONEDIR=../testing/done
|
|
629
|
+
JOBDIR=../testing/jobs/ThisWorkstation
|
|
630
|
+
REPORTDIR=../testing/reports
|
|
689
631
|
AGENT=ThisWorkstation
|
|
690
632
|
DEBUG=false
|
|
691
633
|
```
|
|
@@ -696,18 +638,16 @@ DEBUG=false
|
|
|
696
638
|
|
|
697
639
|
Testaro and its custom tests can be validated with the _executors_ located in the `validation/executors` directory.
|
|
698
640
|
|
|
699
|
-
The
|
|
641
|
+
The executor for a single test is `test`. To execute it for any test `xyz`, call it with the statement `npm test xyz`.
|
|
642
|
+
|
|
643
|
+
The other executors are:
|
|
700
644
|
|
|
701
|
-
- `
|
|
702
|
-
- `high`: validates high-level invocation
|
|
645
|
+
- `run`: validates immediate test execution
|
|
703
646
|
- `watchDir`: validates directory watching
|
|
704
647
|
- `watchNet`: validates network watching
|
|
705
|
-
- `test`: validates a Testaro test
|
|
706
648
|
- `tests`: validates all the Testaro tests
|
|
707
649
|
|
|
708
|
-
To
|
|
709
|
-
|
|
710
|
-
To execute any other executor `xyz`, call it with the statement `npm run xyz`.
|
|
650
|
+
To execute any executor `xyz` among these, call it with the statement `npm run xyz`.
|
|
711
651
|
|
|
712
652
|
The `tests` executor makes use of the jobs in the `validation/tests/jobs` directory, and they, in turn, run tests on HTML files in the `validation/tests/targets` directory.
|
|
713
653
|
|
|
@@ -733,7 +673,7 @@ Testing to determine what happens when a control or link is activated is straigh
|
|
|
733
673
|
|
|
734
674
|
The Playwright “Receives Events” actionability check does **not** check whether an event is dispatched on an element. It checks only whether a click on the location of the element makes the element the target of that click, rather than some other element occupying the same location.
|
|
735
675
|
|
|
736
|
-
### Test-package
|
|
676
|
+
### Test-package duplicativity
|
|
737
677
|
|
|
738
678
|
Test packages sometimes do redundant testing, in that two or more packages test for the same issues, although such duplications are not necessarily perfect. This fact creates three problems:
|
|
739
679
|
- One cannot be confident in excluding some tests of some packages on the assumption that they perfectly duplicate tests of other packages.
|
|
@@ -756,11 +696,10 @@ The files in the `temp` directory are presumed ephemeral and are not tracked by
|
|
|
756
696
|
## Related packages
|
|
757
697
|
|
|
758
698
|
[Testilo](https://www.npmjs.com/package/testilo) is an application that:
|
|
759
|
-
-
|
|
760
|
-
- merges batches of hosts into scripts to produce multiple jobs
|
|
699
|
+
- merges batches of targets and scripts to produce jobs
|
|
761
700
|
- produces scores and adds them to the raw reports of Testaro
|
|
762
701
|
- produces human-oriented HTML digests from scored reports
|
|
763
|
-
- produces human-oriented HTML comparisons of the scores of
|
|
702
|
+
- produces human-oriented HTML comparisons of the scores of targets
|
|
764
703
|
|
|
765
704
|
Testilo contains procedures that reorganize report data by defect rather than test package, and that compensate for duplicative tests when computing scores.
|
|
766
705
|
|
package/call.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
0. function to execute.
|
|
7
7
|
1+. arguments to pass to the function.
|
|
8
8
|
Usage examples:
|
|
9
|
-
node call
|
|
9
|
+
node call run ts25
|
|
10
10
|
node call watch true true 30
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
// Module to keep secrets.
|
|
16
16
|
require('dotenv').config();
|
|
17
|
-
//
|
|
18
|
-
const
|
|
17
|
+
// Module to process files.
|
|
18
|
+
const fs = require('fs/promises');
|
|
19
|
+
// Function to process a testing request.
|
|
20
|
+
const {doJob} = require('./run');
|
|
19
21
|
// Function to watch for jobs.
|
|
20
22
|
const {cycle} = require('./watch');
|
|
21
23
|
|
|
@@ -23,30 +25,50 @@ const {cycle} = require('./watch');
|
|
|
23
25
|
|
|
24
26
|
const fn = process.argv[2];
|
|
25
27
|
const fnArgs = process.argv.slice(3);
|
|
28
|
+
const jobDir = process.env.JOBDIR;
|
|
29
|
+
const toDoDir = `${jobDir}/todo`;
|
|
26
30
|
const reportDir = process.env.REPORTDIR;
|
|
31
|
+
const rawDir = `${reportDir}/raw`;
|
|
27
32
|
|
|
28
33
|
// ########## FUNCTIONS
|
|
29
34
|
|
|
30
|
-
// Fulfills a
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// Fulfills a testing request.
|
|
36
|
+
const callRun = async jobIDStart => {
|
|
37
|
+
// Find the job.
|
|
38
|
+
const jobDirFileNames = await fs.readdir(toDoDir);
|
|
39
|
+
const jobFileName = jobDirFileNames.find(fileName => fileName.startsWith(jobIDStart));
|
|
40
|
+
// If it exists:
|
|
41
|
+
if (jobFileName) {
|
|
42
|
+
// Get it.
|
|
43
|
+
const jobJSON = await fs.readFile(`${toDoDir}/${jobFileName}`, 'utf8');
|
|
44
|
+
const report = JSON.parse(jobJSON);
|
|
45
|
+
// Run it.
|
|
46
|
+
await doJob(report);
|
|
47
|
+
// Archive it.
|
|
48
|
+
await fs.rename(`${toDoDir}/${jobFileName}`, `${jobDir}/done/${jobFileName}`);
|
|
49
|
+
// Save the report.
|
|
50
|
+
await fs.writeFile(`${rawDir}/${jobFileName}`, JSON.stringify(report, null, 2));
|
|
51
|
+
console.log(`Job completed and report ${report.id}.json saved in ${rawDir}`);
|
|
52
|
+
}
|
|
53
|
+
// Otherwise, i.e. if the job does not exist.
|
|
54
|
+
else {
|
|
55
|
+
// Report the error.
|
|
56
|
+
console.log(`ERROR: No to-do job ID starts with ${jobIDStart}`);
|
|
35
57
|
}
|
|
36
58
|
};
|
|
37
59
|
// Starts a watch.
|
|
38
60
|
const callWatch = async (isDirWatch, isForever, interval) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
61
|
+
const whenType = isForever === 'true' ? 'repeating' : 'one-time';
|
|
62
|
+
const whereType = isDirWatch === 'true' ? 'directory' : 'network';
|
|
63
|
+
console.log(`Starting ${whenType} ${whereType} watch`);
|
|
42
64
|
await cycle(isDirWatch === 'true', isForever === 'true', Number.parseInt(interval, 10));
|
|
43
65
|
};
|
|
44
66
|
|
|
45
67
|
// ########## OPERATION
|
|
46
68
|
|
|
47
69
|
// Execute the requested function.
|
|
48
|
-
if (fn === '
|
|
49
|
-
|
|
70
|
+
if (fn === 'run' && fnArgs.length === 1) {
|
|
71
|
+
callRun(fnArgs)
|
|
50
72
|
.then(() => {
|
|
51
73
|
console.log('Execution completed');
|
|
52
74
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testaro",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Automation of accessibility testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"tests": "node validation/executors/tests",
|
|
8
8
|
"test": "node validation/executors/test",
|
|
9
|
-
"
|
|
10
|
-
"high": "node validation/executors/high",
|
|
9
|
+
"run": "node validation/executors/run",
|
|
11
10
|
"watchDir": "node validation/executors/watchDir",
|
|
12
11
|
"watchNet": "node validation/executors/watchNet"
|
|
13
12
|
},
|