testaro 32.4.1 → 33.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 +40 -42
- package/call.js +6 -4
- package/ed11y/editoria11y.min.js +747 -0
- package/package.json +1 -1
- package/procs/standardize.js +39 -0
- package/run.js +2 -1
- package/tests/alfa.js +1 -1
- package/tests/aslint.js +1 -1
- package/tests/axe.js +1 -1
- package/tests/ed11y.js +142 -0
- package/tests/htmlcs.js +1 -1
- package/tests/ibm.js +1 -1
- package/tests/nuVal.js +1 -0
- package/tests/qualWeb.js +1 -1
- package/tests/testaro.js +1 -1
- package/tests/wave.js +7 -0
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ Testaro performs tests of these tools:
|
|
|
47
47
|
- [alfa](https://alfa.siteimprove.com/) (Siteimprove)
|
|
48
48
|
- [aslint](https://www.npmjs.com/package/@essentialaccessibility/aslint) (eSSENTIAL Accessibility)
|
|
49
49
|
- [axe-playwright](https://www.npmjs.com/package/axe-playwright) (Deque)
|
|
50
|
+
- [Editoria11y](https://github.com/itmaybejj/editoria11y) (Princeton University)
|
|
50
51
|
- [HTML CodeSniffer](https://www.npmjs.com/package/html_codesniffer) (Squiz Labs)
|
|
51
52
|
- [Nu Html Checker](https://github.com/validator/validator) (World Wide Web Consortium)
|
|
52
53
|
- [QualWeb core](https://www.npmjs.com/package/@qualweb/core) (University of Lisbon)
|
|
@@ -57,37 +58,24 @@ Some of the tests of Testaro are designed to act as approximate alternatives to
|
|
|
57
58
|
|
|
58
59
|
## Rules
|
|
59
60
|
|
|
60
|
-
Each tool accessed with Testaro defines _rules_ and tests _targets_ for compliance with its rules. In total, the nine tools define about
|
|
61
|
+
Each tool accessed with Testaro defines _rules_ and tests _targets_ for compliance with its rules. In total, the nine tools define about a thousand rules. The latest tabulation of tool rules is:
|
|
61
62
|
|
|
62
63
|
```
|
|
63
64
|
alfa: 59
|
|
64
65
|
aslint: 136
|
|
65
66
|
axe: 80
|
|
67
|
+
ed11y: 24
|
|
66
68
|
htmlcs: 115
|
|
67
69
|
ibm: 132
|
|
68
70
|
nuVal: 215
|
|
69
71
|
qualWeb: 131
|
|
70
|
-
testaro:
|
|
72
|
+
testaro: 40
|
|
71
73
|
wave: 58
|
|
72
|
-
total:
|
|
74
|
+
total: 990
|
|
73
75
|
```
|
|
74
76
|
|
|
75
77
|
Some of the tools are under active development, and their rule counts change over time.
|
|
76
78
|
|
|
77
|
-
When you ask Testaro to run tests of a tool, you may specify a subset of the rules of that tool, and the report will give you the results of only the tests for those rules. These tools will perform only those tests:
|
|
78
|
-
- `alfa`
|
|
79
|
-
- `axe`
|
|
80
|
-
- `htmlcs`
|
|
81
|
-
- `qualWeb`
|
|
82
|
-
- `testaro`
|
|
83
|
-
|
|
84
|
-
These tools always perform a fixed set of tests, and Testaro disregards irrelevant results when you specify a set of rules:
|
|
85
|
-
- `ibm`
|
|
86
|
-
- `nuVal`
|
|
87
|
-
- `wave`
|
|
88
|
-
|
|
89
|
-
The `aslint` tool does not yet allow rule specification.
|
|
90
|
-
|
|
91
79
|
## Job data
|
|
92
80
|
|
|
93
81
|
A report produced by Testaro discloses:
|
|
@@ -430,7 +418,7 @@ When you include a `rules` property, you limit the tests of the tool that are pe
|
|
|
430
418
|
|
|
431
419
|
The `nuVal`, `qualWeb`, and `testaro` tools require specific formats for the `rules` property. Those formats are described below in the sections about those tools.
|
|
432
420
|
|
|
433
|
-
The `aslint`
|
|
421
|
+
The `aslint` and `ed11y` tools do not yet allow rule specification.
|
|
434
422
|
|
|
435
423
|
###### Examples
|
|
436
424
|
|
|
@@ -508,11 +496,32 @@ A typical use for an `expect` property is checking the correctness of a Testaro
|
|
|
508
496
|
|
|
509
497
|
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.
|
|
510
498
|
|
|
511
|
-
|
|
499
|
+
##### Branching
|
|
500
|
+
|
|
501
|
+
An example of a **branching** act is:
|
|
502
|
+
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
"type": "next",
|
|
506
|
+
"if": ["totals.invalid", ">", 0],
|
|
507
|
+
"jump": -4,
|
|
508
|
+
"what": "redo search if any invalid elements"
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
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.
|
|
513
|
+
|
|
514
|
+
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.
|
|
515
|
+
|
|
516
|
+
#### Tools
|
|
517
|
+
|
|
518
|
+
The tools whose tests Testaro performs have particularities described below.
|
|
519
|
+
|
|
520
|
+
##### ASLint
|
|
512
521
|
|
|
513
522
|
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.
|
|
514
523
|
|
|
515
|
-
|
|
524
|
+
##### HTML CodeSniffer
|
|
516
525
|
|
|
517
526
|
The `htmlcs` tool makes use of the `htmlcs/HTMLCS.js` file. That file was created, and can be recreated if necessary, as follows:
|
|
518
527
|
|
|
@@ -544,7 +553,7 @@ The changes in `htmlcs/HTMLCS.js` are:
|
|
|
544
553
|
> );
|
|
545
554
|
```
|
|
546
555
|
|
|
547
|
-
|
|
556
|
+
##### IBM Equal Access
|
|
548
557
|
|
|
549
558
|
The `ibm` tests require the `aceconfig.js` file.
|
|
550
559
|
|
|
@@ -571,13 +580,13 @@ The `ibm` tool is one of two tools (`testaro` is the other) with a `withItems` p
|
|
|
571
580
|
|
|
572
581
|
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.
|
|
573
582
|
|
|
574
|
-
|
|
583
|
+
##### Nu Html Checker
|
|
575
584
|
|
|
576
585
|
The `nuVal` tool performs the tests of the Nu Html Checker.
|
|
577
586
|
|
|
578
587
|
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.
|
|
579
588
|
|
|
580
|
-
|
|
589
|
+
##### QualWeb
|
|
581
590
|
|
|
582
591
|
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.
|
|
583
592
|
|
|
@@ -601,7 +610,7 @@ Thus, when the `rules` argument is omitted, QualWeb will test for all of the rul
|
|
|
601
610
|
|
|
602
611
|
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.
|
|
603
612
|
|
|
604
|
-
|
|
613
|
+
##### Testaro
|
|
605
614
|
|
|
606
615
|
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.
|
|
607
616
|
|
|
@@ -617,7 +626,7 @@ Several Testaro tests make use of the `init()` function in the `procs/testaro` m
|
|
|
617
626
|
|
|
618
627
|
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.
|
|
619
628
|
|
|
620
|
-
|
|
629
|
+
##### WAVE
|
|
621
630
|
|
|
622
631
|
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/).
|
|
623
632
|
|
|
@@ -625,23 +634,6 @@ The `wave` API does not accept a transmitted document for testing. WAVE must be
|
|
|
625
634
|
|
|
626
635
|
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.
|
|
627
636
|
|
|
628
|
-
##### Branching
|
|
629
|
-
|
|
630
|
-
An example of a **branching** act is:
|
|
631
|
-
|
|
632
|
-
```json
|
|
633
|
-
{
|
|
634
|
-
"type": "next",
|
|
635
|
-
"if": ["totals.invalid", ">", 0],
|
|
636
|
-
"jump": -4,
|
|
637
|
-
"what": "redo search if any invalid elements"
|
|
638
|
-
}
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
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.
|
|
642
|
-
|
|
643
|
-
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.
|
|
644
|
-
|
|
645
637
|
#### Browser types
|
|
646
638
|
|
|
647
639
|
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.
|
|
@@ -888,6 +880,12 @@ Testing to determine what happens when a control or link is activated is straigh
|
|
|
888
880
|
|
|
889
881
|
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.
|
|
890
882
|
|
|
883
|
+
### Test prevention
|
|
884
|
+
|
|
885
|
+
Test targets employ mechanisms to prevent scraping, automated form submission, and other automated actions. These mechanisms may interfere with testing. When a test act is prevented by a target, Testaro reports this prevention.
|
|
886
|
+
|
|
887
|
+
Some targets prohibit the execution of alien scripts unless the client can demonstrate that it is the requester of the page. Failure to provide that evidence results in the script being blocked and an error message being logged, saying “Refused to execute a script because its hash, its nonce, or unsafe-inline does not appear in the script-src directive of the Content Security Policy”. This mechanism affects tools that insert scripts into a target in order to test it. Those tools include `axe`, `asLint`, `ed11y`, and `htmlcs`. To comply with this requirement, Testaro obtains a _nonce_ from the response that serves the target. Then the file that runs the tool adds that nonce to the script as the value of a `nonce` attribute when it inserts its script into the target.
|
|
888
|
+
|
|
891
889
|
### Tool duplicativity
|
|
892
890
|
|
|
893
891
|
Tools sometimes do redundant testing, in that two or more tools test for the same defects, although such duplications are not necessarily perfect. This fact creates three problems:
|
package/call.js
CHANGED
|
@@ -59,9 +59,11 @@ const rawDir = `${reportDir}/raw`;
|
|
|
59
59
|
const callRun = async jobIDStart => {
|
|
60
60
|
// Find the job.
|
|
61
61
|
const jobDirFileNames = await fs.readdir(todoDir);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const jobFileNames = jobDirFileNames.filter(fileName => fileName.endsWith('.json'));
|
|
63
|
+
const specifiedJobFileNames = jobIDStart
|
|
64
|
+
? jobFileNames.filter(fileName => fileName.startsWith(jobIDStart))
|
|
65
|
+
: jobFileNames;
|
|
66
|
+
const jobFileName = specifiedJobFileNames[0];
|
|
65
67
|
// If it exists:
|
|
66
68
|
if (jobFileName) {
|
|
67
69
|
// Get it.
|
|
@@ -78,7 +80,7 @@ const callRun = async jobIDStart => {
|
|
|
78
80
|
// Otherwise, i.e. if the job does not exist.
|
|
79
81
|
else {
|
|
80
82
|
// Report the error.
|
|
81
|
-
console.log(
|
|
83
|
+
console.log('ERROR: No specified job exists');
|
|
82
84
|
}
|
|
83
85
|
};
|
|
84
86
|
// Starts a directory watch, converting the interval argument to a number.
|