testaro 67.0.0 → 68.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.
Files changed (95) hide show
  1. package/LICENSE +4 -16
  2. package/README.md +10 -2
  3. package/UPGRADES.md +1 -1
  4. package/dirWatch.js +2 -3
  5. package/ed11y/editoria11y.min.js +109 -690
  6. package/ed11y/editoria11y210.min.js +747 -0
  7. package/netWatch.js +6 -6
  8. package/package.json +1 -1
  9. package/procs/aslint.js +2 -2
  10. package/procs/catalog.js +190 -0
  11. package/procs/{dateOf.js → dateTime.js} +6 -4
  12. package/procs/doActs.js +1227 -0
  13. package/procs/doTestAct.js +63 -29
  14. package/procs/error.js +53 -0
  15. package/procs/job.js +64 -38
  16. package/procs/launch.js +596 -0
  17. package/procs/nu.js +3 -18
  18. package/procs/shoot.js +18 -2
  19. package/procs/testaro.js +102 -125
  20. package/procs/xPath.js +62 -0
  21. package/run.js +42 -1938
  22. package/scratch/README.md +9 -0
  23. package/testaro/adbID.js +3 -3
  24. package/testaro/allCaps.js +4 -5
  25. package/testaro/allHidden.js +19 -18
  26. package/testaro/allSlanted.js +4 -5
  27. package/testaro/altScheme.js +3 -3
  28. package/testaro/attVal.js +19 -35
  29. package/testaro/autocomplete.js +65 -62
  30. package/testaro/bulk.js +21 -20
  31. package/testaro/buttonMenu.js +112 -33
  32. package/testaro/captionLoc.js +3 -3
  33. package/testaro/datalistRef.js +4 -5
  34. package/testaro/distortion.js +3 -3
  35. package/testaro/docType.js +6 -9
  36. package/testaro/dupAtt.js +12 -25
  37. package/testaro/elements.js +4 -3
  38. package/testaro/embAc.js +4 -2
  39. package/testaro/focAll.js +6 -13
  40. package/testaro/focAndOp.js +3 -3
  41. package/testaro/focInd.js +3 -3
  42. package/testaro/focVis.js +4 -3
  43. package/testaro/headEl.js +5 -12
  44. package/testaro/headingAmb.js +45 -88
  45. package/testaro/hovInd.js +5 -5
  46. package/testaro/hover.js +44 -8
  47. package/testaro/hr.js +4 -4
  48. package/testaro/imageLink.js +3 -3
  49. package/testaro/labClash.js +3 -3
  50. package/testaro/legendLoc.js +3 -3
  51. package/testaro/lineHeight.js +3 -3
  52. package/testaro/linkAmb.js +25 -17
  53. package/testaro/linkExt.js +5 -5
  54. package/testaro/linkOldAtt.js +4 -3
  55. package/testaro/linkTo.js +4 -3
  56. package/testaro/linkUl.js +4 -5
  57. package/testaro/miniText.js +4 -3
  58. package/testaro/motion.js +3 -22
  59. package/testaro/nonTable.js +4 -5
  60. package/testaro/optRoleSel.js +3 -3
  61. package/testaro/phOnly.js +3 -3
  62. package/testaro/pseudoP.js +5 -5
  63. package/testaro/radioSet.js +4 -5
  64. package/testaro/role.js +4 -5
  65. package/testaro/secHeading.js +4 -5
  66. package/testaro/shoot0.js +3 -2
  67. package/testaro/shoot1.js +3 -2
  68. package/testaro/styleDiff.js +5 -12
  69. package/testaro/tabNav.js +30 -118
  70. package/testaro/targetSmall.js +30 -15
  71. package/testaro/textNodes.js +3 -1
  72. package/testaro/textSem.js +4 -5
  73. package/testaro/title.js +4 -2
  74. package/testaro/titledEl.js +3 -3
  75. package/testaro/zIndex.js +3 -3
  76. package/tests/alfa.js +28 -54
  77. package/tests/aslint.js +20 -53
  78. package/tests/axe.js +76 -13
  79. package/tests/ed11y.js +69 -141
  80. package/tests/htmlcs.js +69 -38
  81. package/tests/ibm.js +54 -9
  82. package/tests/nuVal.js +65 -12
  83. package/tests/nuVnu.js +76 -26
  84. package/tests/qualWeb.js +89 -44
  85. package/tests/testaro.js +288 -273
  86. package/tests/wave.js +142 -117
  87. package/tests/wax.js +61 -42
  88. package/procs/getLocatorData.js +0 -192
  89. package/procs/identify.js +0 -250
  90. package/procs/isInlineLink.js +0 -42
  91. package/procs/screenShot.js +0 -32
  92. package/procs/standardize.js +0 -524
  93. package/procs/target.js +0 -90
  94. package/procs/tellServer.js +0 -43
  95. package/scripts/dumpAlts.js +0 -28
package/tests/qualWeb.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  © 2023–2024 CVS Health and/or one of its affiliates. All rights reserved.
3
- © 2025 Jonathan Robert Pool.
3
+ © 2025–2026 Jonathan Robert Pool.
4
4
 
5
5
  Licensed under the MIT License. See LICENSE file at the project root or
6
6
  https://opensource.org/license/mit/ for details.
@@ -19,8 +19,7 @@ const {QualWeb} = require('@qualweb/core');
19
19
  const {ACTRules} = require('@qualweb/act-rules');
20
20
  const {WCAGTechniques} = require('@qualweb/wcag-techniques');
21
21
  const {BestPractices} = require('@qualweb/best-practices');
22
- const {addTestaroIDs} = require('../procs/testaro');
23
- const {getElementData} = require('../procs/getLocatorData');
22
+ const {getAttributeXPath, getXPathCatalogIndex} = require('../procs/xPath');
24
23
 
25
24
  // CONSTANTS
26
25
 
@@ -31,6 +30,20 @@ const qualWeb = new QualWeb({
31
30
  const actRulesModule = new ACTRules({});
32
31
  const wcagModule = new WCAGTechniques({});
33
32
  const bpModule = new BestPractices({});
33
+ const ordinalSeverities = {
34
+ 'act-rules': {
35
+ 'warning': 1,
36
+ 'failure': 3
37
+ },
38
+ 'wcag-techniques': {
39
+ 'warning': 0,
40
+ 'failure': 2
41
+ },
42
+ 'best-practices': {
43
+ 'warning': 0,
44
+ 'failure': 1
45
+ }
46
+ }
34
47
 
35
48
  // FUNCTIONS
36
49
 
@@ -38,15 +51,27 @@ const bpModule = new BestPractices({});
38
51
  exports.reporter = async (page, report, actIndex, timeLimit) => {
39
52
  const act = report.acts[actIndex];
40
53
  const {withNewContent, rules} = act;
41
- const data = {};
42
- let result = {};
43
54
  const clusterOptions = {
44
55
  maxConcurrency: 1,
45
56
  timeout: timeLimit * 1000,
46
57
  monitor: false
47
58
  };
48
- // Annotate all elements on the page with unique identifiers.
49
- await addTestaroIDs(page);
59
+ // Initialize the act report.
60
+ const data = {};
61
+ const result = {
62
+ nativeResult: {},
63
+ standardResult: {}
64
+ };
65
+ const standard = report.standard !== 'no';
66
+ // If standard results are to be reported:
67
+ if (standard) {
68
+ // Initialize the standard result.
69
+ result.standardResult = {
70
+ prevented: false,
71
+ totals: [0, 0, 0, 0],
72
+ instances: []
73
+ };
74
+ }
50
75
  try {
51
76
  // Start the QualWeb core engine.
52
77
  await qualWeb.start(clusterOptions, {
@@ -162,12 +187,13 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
162
187
  };
163
188
  }
164
189
  // Otherwise, i.e. if the evaluation succeeded, get the report.
165
- result = qwReport[withNewContent ? qualWebOptions.url : 'customHtml'];
190
+ result.nativeResult = qwReport[withNewContent ? qualWebOptions.url : 'customHtml'];
191
+ const {nativeResult, standardResult} = result;
166
192
  // If it contains a copy of the DOM:
167
- if (result && result.system && result.system.page && result.system.page.dom) {
193
+ if (nativeResult?.system?.page?.dom) {
168
194
  // Delete the copy.
169
- delete result.system.page.dom;
170
- const {modules} = result;
195
+ delete nativeResult.system.page.dom;
196
+ const {modules} = nativeResult;
171
197
  // If the report contains a modules property:
172
198
  if (modules) {
173
199
  // For each test section in it:
@@ -184,41 +210,60 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
184
210
  for (const ruleID of ruleIDs) {
185
211
  const ruleAssertions = assertions[ruleID];
186
212
  const {metadata} = ruleAssertions;
187
- // If result data exist for the rule:
188
- if (metadata) {
189
- // If there were no warnings or failures:
190
- if (metadata.warning === 0 && metadata.failed === 0) {
191
- // Delete the rule data.
192
- delete assertions[ruleID];
193
- }
194
- // Otherwise, i.e. if there was at least 1 warning or failure:
195
- else {
196
- if (ruleAssertions.results) {
197
- // Delete nonviolations from the results.
198
- ruleAssertions.results = ruleAssertions.results.filter(
199
- raResult => raResult.verdict !== 'passed'
200
- );
213
+ // If there were any warnings or failures:
214
+ if (metadata?.warning || metadata?.failed) {
215
+ // Delete nonviolations from the results.
216
+ ruleAssertions.results = ruleAssertions.results.filter(
217
+ raResult => raResult.verdict !== 'passed'
218
+ );
219
+ // For each test result:
220
+ for (const raResult of ruleAssertions.results) {
221
+ const {elements, verdict} = raResult;
222
+ // If any violations are reported:
223
+ if (elements?.length) {
224
+ // For each violating element:
225
+ for (const element of elements) {
226
+ // Limit the size of its reported excerpt.
227
+ if (element.htmlCode?.length > 2000) {
228
+ element.htmlCode = `${element.htmlCode.slice(0, 2000)} …`;
229
+ }
230
+ // If standard results are to be reported:
231
+ if (standard) {
232
+ // Initialize a standard instance.
233
+ const what = `[${verdict}] ${raResult.description}`;
234
+ const instance = {
235
+ ruleID,
236
+ what,
237
+ ordinalSeverity: ordinalSeverities[section][verdict],
238
+ count: 1
239
+ };
240
+ // Get the pathID of the element or, if none, the document pathID.
241
+ const pathID = getAttributeXPath(element.htmlCode) || '/html';
242
+ const {catalog} = report;
243
+ // Use it to get the catalog index.
244
+ const catalogIndex = getXPathCatalogIndex(catalog, pathID);
245
+ // If the acquisition succeeded:
246
+ if (catalogIndex) {
247
+ // Add the catalog index to the instance.
248
+ instance.catalogIndex = catalogIndex;
249
+ }
250
+ // Otherwise, i.e. if the acquisition failed:
251
+ else {
252
+ // Add the XPath to the instance.
253
+ instance.pathID = pathID;
254
+ }
255
+ // Add the instance to the standard result.
256
+ standardResult.instances.push(instance);
257
+ }
258
+ };
201
259
  }
202
- }
260
+ };
261
+ }
262
+ // Otherwise, i.e. if there were no warnings or failures:
263
+ else {
264
+ // Delete the rule.
265
+ delete assertions[ruleID];
203
266
  }
204
- // Shorten long HTML codes of elements.
205
- const {results} = ruleAssertions;
206
- // For each test result:
207
- for (const raResult of results) {
208
- const {elements} = raResult;
209
- // If any violations are reported:
210
- if (elements && elements.length) {
211
- // For each violating element:
212
- for (const element of elements) {
213
- // Add location data from its excerpt to the element data.
214
- element.locationData = await getElementData(page, element.htmlCode);
215
- // Limit the size of its reported excerpt.
216
- if (element.htmlCode && element.htmlCode.length > 700) {
217
- element.htmlCode = `${element.htmlCode.slice(0, 700)} …`;
218
- }
219
- };
220
- }
221
- };
222
267
  };
223
268
  }
224
269
  else {