testaro 32.4.0 → 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 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 960 rules. The latest tabulation of tool rules is:
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: 36
72
+ testaro: 40
71
73
  wave: 58
72
- total: 962
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:
@@ -154,6 +142,9 @@ Here is an example of a job:
154
142
  what: 'Test W3C with 2 alfa rules',
155
143
  strict: true,
156
144
  timeLimit: 65,
145
+ standard: 'only',
146
+ observe: false,
147
+ timeStamp: '231208T1200',
157
148
  acts: [
158
149
  {
159
150
  type: 'launch',
@@ -178,8 +169,7 @@ Here is an example of a job:
178
169
  },
179
170
  requester: 'user@domain.org'
180
171
  },
181
- creationTime: '2024-12-10T14:28Z',
182
- timeStamp: '241213T1200'
172
+ creationTime: '2024-12-10T14:28Z'
183
173
  }
184
174
  ```
185
175
 
@@ -192,14 +182,16 @@ Job properties:
192
182
  - `what`: a description of the job.
193
183
  - `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.
194
184
  - `timeLimit`: the number of seconds allowed for the execution of the job.
185
+ - `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.
186
+ - `observe`: `true` or `false`, indicating whether tool and Testaro-rule invocations are to be reported as they occur to the server.
187
+ - `timeStamp`: a string in `yymmddThhMM` format, specifying a date and time before which the job is not to be performed.
195
188
  - `acts`: an array of the acts to be performed (documented below).
196
189
  - `sources`: an object describing where the job came from:
197
190
  - `script` (optional): the ID of the script from which the job was made.
198
191
  - `batch` (optional): a set of targets (URLs) from which the target of this job was drawn.
199
192
  - `target` (optional): an object describing the target being tested by this job.
200
193
  - `requester` (optional): the email address that should receive a notice of completion of the job.
201
- - `creationTime`: the time in ISO 8601 format when the job was created.
202
- - `timeStamp`: a string representing the date and time before which the job is not to be performed.
194
+ - `creationTime`: the date and time in ISO 8601 format when the job was created.
203
195
 
204
196
  ### Reports
205
197
 
@@ -426,7 +418,7 @@ When you include a `rules` property, you limit the tests of the tool that are pe
426
418
 
427
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.
428
420
 
429
- The `aslint` tool does not yet allow rule specification.
421
+ The `aslint` and `ed11y` tools do not yet allow rule specification.
430
422
 
431
423
  ###### Examples
432
424
 
@@ -504,11 +496,32 @@ A typical use for an `expect` property is checking the correctness of a Testaro
504
496
 
505
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.
506
498
 
507
- ###### ASLint
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
508
521
 
509
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.
510
523
 
511
- ###### HTML CodeSniffer
524
+ ##### HTML CodeSniffer
512
525
 
513
526
  The `htmlcs` tool makes use of the `htmlcs/HTMLCS.js` file. That file was created, and can be recreated if necessary, as follows:
514
527
 
@@ -540,7 +553,7 @@ The changes in `htmlcs/HTMLCS.js` are:
540
553
  > );
541
554
  ```
542
555
 
543
- ###### IBM Equal Access
556
+ ##### IBM Equal Access
544
557
 
545
558
  The `ibm` tests require the `aceconfig.js` file.
546
559
 
@@ -567,13 +580,13 @@ The `ibm` tool is one of two tools (`testaro` is the other) with a `withItems` p
567
580
 
568
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.
569
582
 
570
- ###### Nu Html Checker
583
+ ##### Nu Html Checker
571
584
 
572
585
  The `nuVal` tool performs the tests of the Nu Html Checker.
573
586
 
574
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.
575
588
 
576
- ###### QualWeb
589
+ ##### QualWeb
577
590
 
578
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.
579
592
 
@@ -597,7 +610,7 @@ Thus, when the `rules` argument is omitted, QualWeb will test for all of the rul
597
610
 
598
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.
599
612
 
600
- ###### Testaro
613
+ ##### Testaro
601
614
 
602
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.
603
616
 
@@ -613,7 +626,7 @@ Several Testaro tests make use of the `init()` function in the `procs/testaro` m
613
626
 
614
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.
615
628
 
616
- ###### WAVE
629
+ ##### WAVE
617
630
 
618
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/).
619
632
 
@@ -621,23 +634,6 @@ The `wave` API does not accept a transmitted document for testing. WAVE must be
621
634
 
622
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.
623
636
 
624
- ##### Branching
625
-
626
- An example of a **branching** act is:
627
-
628
- ```json
629
- {
630
- "type": "next",
631
- "if": ["totals.invalid", ">", 0],
632
- "jump": -4,
633
- "what": "redo search if any invalid elements"
634
- }
635
- ```
636
-
637
- 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.
638
-
639
- 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.
640
-
641
637
  #### Browser types
642
638
 
643
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.
@@ -884,6 +880,12 @@ Testing to determine what happens when a control or link is activated is straigh
884
880
 
885
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.
886
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
+
887
889
  ### Tool duplicativity
888
890
 
889
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 jobFileName = jobIDStart
63
- ? jobDirFileNames.find(fileName => fileName.startsWith(jobIDStart))
64
- : jobDirFileNames[0];
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(`ERROR: No to-do job ID starts with ${jobIDStart}`);
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.