testaro 13.0.2 → 14.1.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 (100) hide show
  1. package/README.md +190 -94
  2. package/actSpecs.js +17 -158
  3. package/package.json +1 -1
  4. package/run.js +31 -31
  5. package/standardize.js +338 -0
  6. package/{tests → testaro}/allHidden.js +36 -1
  7. package/{tests → testaro}/attVal.js +36 -2
  8. package/{tests → testaro}/autocomplete.js +34 -1
  9. package/{tests → testaro}/bulk.js +15 -1
  10. package/{tests → testaro}/docType.js +15 -1
  11. package/{tests → testaro}/dupAtt.js +34 -1
  12. package/{tests → testaro}/elements.js +9 -3
  13. package/testaro/embAc.js +78 -0
  14. package/{tests → testaro}/filter.js +35 -1
  15. package/{tests → testaro}/focAll.js +20 -3
  16. package/{tests → testaro}/focInd.js +45 -3
  17. package/{tests → testaro}/focOp.js +61 -2
  18. package/{tests → testaro}/focVis.js +35 -1
  19. package/{tests → testaro}/hover.js +67 -5
  20. package/{tests → testaro}/labClash.js +54 -4
  21. package/{tests → testaro}/linkTo.js +33 -1
  22. package/{tests → testaro}/linkUl.js +43 -5
  23. package/{tests → testaro}/menuNav.js +42 -1
  24. package/{tests → testaro}/miniText.js +32 -1
  25. package/{tests → testaro}/motion.js +27 -4
  26. package/{tests → testaro}/nonTable.js +32 -1
  27. package/{tests → testaro}/radioSet.js +33 -2
  28. package/{tests → testaro}/role.js +38 -1
  29. package/{tests → testaro}/styleDiff.js +43 -2
  30. package/{tests → testaro}/tabNav.js +42 -1
  31. package/{tests → testaro}/textNodes.js +6 -2
  32. package/{tests → testaro}/title.js +8 -4
  33. package/{tests → testaro}/titledEl.js +32 -1
  34. package/{tests → testaro}/zIndex.js +40 -2
  35. package/tests/alfa.js +72 -75
  36. package/tests/continuum.js +6 -2
  37. package/tests/ibm.js +14 -42
  38. package/tests/testaro.js +73 -0
  39. package/validation/tests/jobs/allHidden.json +877 -174
  40. package/validation/tests/jobs/attVal.json +57 -19
  41. package/validation/tests/jobs/autocomplete.json +34 -8
  42. package/validation/tests/jobs/bulk.json +33 -7
  43. package/validation/tests/jobs/docType.json +23 -5
  44. package/validation/tests/jobs/dupAtt.json +47 -8
  45. package/validation/tests/jobs/elements.json +231 -70
  46. package/validation/tests/jobs/embAc.json +70 -15
  47. package/validation/tests/jobs/filter.json +56 -12
  48. package/validation/tests/jobs/focAll.json +64 -16
  49. package/validation/tests/jobs/focInd.json +107 -23
  50. package/validation/tests/jobs/focOp.json +93 -21
  51. package/validation/tests/jobs/focVis.json +16 -4
  52. package/validation/tests/jobs/hover.json +246 -56
  53. package/validation/tests/jobs/labClash.json +43 -11
  54. package/validation/tests/jobs/linkTo.json +16 -4
  55. package/validation/tests/jobs/linkUl.json +79 -19
  56. package/validation/tests/jobs/menuNav.json +313 -65
  57. package/validation/tests/jobs/miniText.json +21 -5
  58. package/validation/tests/jobs/motion.json +81 -23
  59. package/validation/tests/jobs/nonTable.json +26 -6
  60. package/validation/tests/jobs/radioSet.json +43 -11
  61. package/validation/tests/jobs/role.json +93 -19
  62. package/validation/tests/jobs/styleDiff.json +124 -28
  63. package/validation/tests/jobs/tabNav.json +313 -65
  64. package/validation/tests/jobs/textNodes.json +190 -49
  65. package/validation/tests/jobs/title.json +23 -5
  66. package/validation/tests/jobs/titledEl.json +26 -6
  67. package/validation/tests/jobs/zIndex.json +28 -8
  68. package/validation/tests/old/allHidden.json +314 -0
  69. package/validation/tests/old/attVal.json +60 -0
  70. package/validation/tests/old/autocomplete.json +51 -0
  71. package/validation/tests/old/bulk.json +48 -0
  72. package/validation/tests/old/docType.json +46 -0
  73. package/validation/tests/old/dupAtt.json +51 -0
  74. package/validation/tests/old/elements.json +140 -0
  75. package/validation/tests/old/embAc.json +54 -0
  76. package/validation/tests/old/filter.json +55 -0
  77. package/validation/tests/old/focAll.json +68 -0
  78. package/validation/tests/old/focInd.json +69 -0
  79. package/validation/tests/old/focOp.json +62 -0
  80. package/validation/tests/old/focVis.json +35 -0
  81. package/validation/tests/old/hover.json +118 -0
  82. package/validation/tests/old/labClash.json +52 -0
  83. package/validation/tests/old/linkTo.json +35 -0
  84. package/validation/tests/old/linkUl.json +71 -0
  85. package/validation/tests/old/menuNav.json +106 -0
  86. package/validation/tests/old/miniText.json +36 -0
  87. package/validation/tests/old/motion.json +62 -0
  88. package/validation/tests/old/nonTable.json +37 -0
  89. package/validation/tests/old/radioSet.json +52 -0
  90. package/validation/tests/old/role.json +60 -0
  91. package/validation/tests/old/styleDiff.json +71 -0
  92. package/validation/tests/old/tabNav.json +106 -0
  93. package/validation/tests/old/temp.js +28 -0
  94. package/validation/tests/old/textNodes.json +98 -0
  95. package/validation/tests/old/title.json +46 -0
  96. package/validation/tests/old/titledEl.json +37 -0
  97. package/validation/tests/old/zIndex.json +49 -0
  98. package/validation/tests/targets/attVal/good.html +1 -1
  99. package/validation/tests/targets/elements/index.html +1 -0
  100. package/tests/embAc.js +0 -36
package/actSpecs.js CHANGED
@@ -122,7 +122,7 @@ exports.actSpecs = {
122
122
  }
123
123
  ],
124
124
  test: [
125
- 'Perform a test',
125
+ 'Perform test of a tool',
126
126
  {
127
127
  which: [true, 'string', 'isTest', 'test name'],
128
128
  what: [false, 'string', 'hasLength', 'comment']
@@ -154,95 +154,26 @@ exports.actSpecs = {
154
154
  },
155
155
  tests: {
156
156
  alfa: [
157
- 'Perform an alfa test',
157
+ 'Perform alfa tests',
158
158
  {
159
159
  rules: [false, 'array', 'areStrings', 'rule names (e.g., r25), if not all']
160
160
  }
161
161
  ],
162
- attVal: [
163
- 'Perform an attVal test',
164
- {
165
- attributeName: [true, 'string', 'hasLength', 'name of attribute'],
166
- areLicit: [true, 'boolean', '', 'whether values are licit'],
167
- values: [true, 'array', 'areStrings', 'values of attribute'],
168
- withItems: [true, 'boolean', '', 'itemize']
169
- }
170
- ],
171
- autocomplete: [
172
- 'Perform an autocomplete test',
173
- {
174
- withItems: [true, 'boolean', '', 'itemize']
175
- }
176
- ],
177
162
  axe: [
178
- 'Perform an Axe test',
163
+ 'Perform Axe tests',
179
164
  {
180
165
  detailLevel: [true, 'number', '', '0 = least, 4 = most'],
181
166
  rules: [true, 'array', 'areStrings', 'rule names, or empty if all']
182
167
  }
183
168
  ],
184
169
  continuum: [
185
- 'Perform a continuum test',
170
+ 'Perform Continuum tests',
186
171
  {
187
172
  rules: [false, 'array', 'areNumbers', 'rule numbers (e.g., 25), if not all']
188
173
  }
189
174
  ],
190
- dupAtt: [
191
- 'Perform a dupAtt test',
192
- {
193
- withItems: [true, 'boolean', '', 'itemize']
194
- }
195
- ],
196
- elements: [
197
- 'Perform an elements test',
198
- {
199
- detailLevel: [true, 'number', '', '0 to 3, to specify the level of detail'],
200
- tagName: [false, 'string', 'hasLength', 'tag name (upper-case) of elements'],
201
- onlyVisible: [false, 'boolean', '', 'whether to exclude invisible elements'],
202
- attribute: [false, 'string', 'hasLength', 'required attribute selector']
203
- }
204
- ],
205
- embAc: [
206
- 'Perform an embAc test',
207
- {
208
- withItems: [true, 'boolean', '', 'itemize']
209
- }
210
- ],
211
- filter: [
212
- 'Perform a filter test',
213
- {
214
- withItems: [true, 'boolean', '', 'itemize']
215
- }
216
- ],
217
- focInd: [
218
- 'Perform a focInd test',
219
- {
220
- revealAll: [true, 'boolean', '', 'whether to make all elements visible first'],
221
- allowedDelay: [true, 'number', '', 'milliseconds to wait for an outline'],
222
- withItems: [true, 'boolean', '', 'itemize']
223
- }
224
- ],
225
- focOp: [
226
- 'Perform a focOp test',
227
- {
228
- withItems: [true, 'boolean', '', 'itemize']
229
- }
230
- ],
231
- focVis: [
232
- 'Perform a focVis test',
233
- {
234
- withItems: [true, 'boolean', '', 'itemize']
235
- }
236
- ],
237
- hover: [
238
- 'Perform a hover test',
239
- {
240
- sampleSize: [false, 'number', '', 'limit on sample size of triggers, if any'],
241
- withItems: [true, 'boolean', '', 'itemize']
242
- }
243
- ],
244
175
  htmlcs: [
245
- 'Perform an htmlcs test',
176
+ 'Perform HTML CodeSniffer tests',
246
177
  {
247
178
  rules: [
248
179
  false,
@@ -253,61 +184,17 @@ exports.actSpecs = {
253
184
  }
254
185
  ],
255
186
  ibm: [
256
- 'Perform an IBM Equal Access test',
187
+ 'Perform IBM Equal Access tests',
257
188
  {
258
189
  withItems: [true, 'boolean', '', 'itemize'],
259
190
  withNewContent: [
260
- false, 'boolean', '', 'true: use a URL; false: use page content; omitted: both'
191
+ true, 'boolean', '', 'true: use a URL; false: use page content'
261
192
  ],
262
193
  rules: [false, 'array', 'areStrings', 'rule names (e.g., RPT_Elem_UniqueId), if not all']
263
194
  }
264
195
  ],
265
- labClash: [
266
- 'Perform a labClash test',
267
- {
268
- withItems: [true, 'boolean', '', 'itemize']
269
- }
270
- ],
271
- linkTo: [
272
- 'Perform a linkTo test',
273
- {
274
- withItems: [true, 'boolean', '', 'itemize']
275
- }
276
- ],
277
- linkUl: [
278
- 'Perform a linkUl test',
279
- {
280
- withItems: [true, 'boolean', '', 'itemize']
281
- }
282
- ],
283
- menuNav: [
284
- 'Perform a menuNav test',
285
- {
286
- withItems: [true, 'boolean', '', 'itemize']
287
- }
288
- ],
289
- miniText: [
290
- 'Perform a miniText test',
291
- {
292
- withItems: [true, 'boolean', '', 'itemize']
293
- }
294
- ],
295
- motion: [
296
- 'Perform a motion test',
297
- {
298
- delay: [true, 'number', '', 'ms to wait before first screen shot'],
299
- interval: [true, 'number', '', 'ms between screen shots'],
300
- count: [true, 'number', '', 'count of screen shots to make']
301
- }
302
- ],
303
- nonTable: [
304
- 'Perform a nonTable test',
305
- {
306
- withItems: [true, 'boolean', '', 'itemize']
307
- }
308
- ],
309
196
  nuVal: [
310
- 'Perform a nuVal test',
197
+ 'Perform Nu Html Checker tests',
311
198
  {
312
199
  messages: [
313
200
  false,
@@ -318,60 +205,32 @@ exports.actSpecs = {
318
205
  }
319
206
  ],
320
207
  qualWeb: [
321
- 'Perform a qualWeb test',
208
+ 'Perform QualWeb tests',
322
209
  {
323
210
  withNewContent: [true, 'boolean', '', 'whether to use a URL instead of page content'],
324
211
  rules: [false, 'array', 'areStrings', 'QualWeb or ACT IDs of ACT rules to include, if not all']
325
212
  }
326
213
  ],
327
- radioSet: [
328
- 'Perform a radioSet test',
329
- {
330
- withItems: [true, 'boolean', '', 'itemize']
331
- }
332
- ],
333
- styleDiff: [
334
- 'Perform a styleDiff test',
335
- {
336
- withItems: [true, 'boolean', '', 'itemize']
337
- }
338
- ],
339
- tabNav: [
340
- 'Perform a tabNav test',
341
- {
342
- withItems: [true, 'boolean', '', 'itemize']
343
- }
344
- ],
345
214
  tenon: [
346
- 'Perform a Tenon test',
215
+ 'Perform Tenon tests',
347
216
  {
217
+ tenonData: [true, 'object', '', 'object with accessToken and requestIDs properties'],
348
218
  id: [true, 'string', 'hasLength', 'ID of the requested test instance']
349
219
  }
350
220
  ],
351
- textNodes: [
352
- 'Perform a textNodes test',
221
+ testaro: [
222
+ 'Perform Testaro tests',
353
223
  {
354
- detailLevel: [true, 'number', '', '0 to 3, to specify the level of detail'],
355
- text: [false, 'string', 'hasLength', 'case-insensitive substring of the text node']
356
- }
357
- ],
358
- titledEl: [
359
- 'Perform a titledEl test',
360
- {
361
- withItems: [true, 'boolean', '', 'itemize']
224
+ withItems: [true, 'boolean', '', 'itemize'],
225
+ rules: [false, 'array', 'areStrings', 'IDs of rules to include if array starts with y or exclude if with n, if not all evaluative rules'],
226
+ args: [false, 'object', '', 'extra args (object with rule properties and arrays of argument values as values ({focInd: [false, 250], hover: [-1], motion: [2500, 2500, 5]} by default'],
362
227
  }
363
228
  ],
364
229
  wave: [
365
- 'Perform a WebAIM WAVE test',
230
+ 'Perform WAVE tests',
366
231
  {
367
232
  reportType: [true, 'number', '', 'WAVE report type']
368
233
  }
369
- ],
370
- zIndex: [
371
- 'Perform a zIndex test',
372
- {
373
- withItems: [true, 'boolean', '', 'itemize']
374
- }
375
234
  ]
376
235
  }
377
236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "13.0.2",
3
+ "version": "14.1.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -9,6 +9,8 @@
9
9
  require('dotenv').config();
10
10
  // Requirements for acts.
11
11
  const {actSpecs} = require('./actSpecs');
12
+ // Module to standardize report formats.
13
+ const {standardize} = require('./standardize');
12
14
  // Playwright package.
13
15
  const playwright = require('playwright');
14
16
 
@@ -27,48 +29,23 @@ const moves = {
27
29
  radio: 'input[type=radio]',
28
30
  search: 'input[type=search], input[aria-label*=search i], input[placeholder*=search i]',
29
31
  select: 'select',
30
- text: 'input[type=text], input:not([type])'
32
+ text: 'input'
31
33
  };
32
34
  // Names and descriptions of tests.
33
35
  const tests = {
34
36
  alfa: 'alfa',
35
- allHidden: 'page that is entirely or mostly hidden',
36
- attVal: 'elements with attributes having illicit values',
37
- autocomplete: 'name and email inputs without autocomplete attributes',
38
37
  axe: 'Axe',
39
- bulk: 'count of visible elements',
40
38
  continuum: 'Level Access Continuum, community edition',
41
- docType: 'document without a doctype property',
42
- dupAtt: 'elements with duplicate attributes',
43
39
  elements: 'data on specified elements',
44
- embAc: 'active elements embedded in links or buttons',
45
- filter: 'filter styles on elements',
46
- focAll: 'focusable and Tab-focused elements',
47
- focInd: 'focus indicators',
48
- focOp: 'focusability and operability',
49
- focVis: 'links that are invisible when focused',
50
- hover: 'hover-caused content changes',
51
40
  htmlcs: 'HTML CodeSniffer WCAG 2.1 AA ruleset',
52
41
  ibm: 'IBM Accessibility Checker',
53
- labClash: 'labeling inconsistencies',
54
- linkTo: 'links without destinations',
55
- linkUl: 'adjacent-link underlining',
56
- menuNav: 'keyboard navigation between focusable menu items',
57
- miniText: 'text smaller than 11 pixels',
58
- motion: 'motion',
59
- nonTable: 'table elements used for layout',
60
42
  nuVal: 'Nu Html Checker',
61
43
  qualWeb: 'QualWeb',
62
- radioSet: 'fieldset grouping of radio buttons',
63
- role: 'roles',
64
- styleDiff: 'style inconsistencies',
65
- tabNav: 'keyboard navigation between tab elements',
66
44
  tenon: 'Tenon',
45
+ testaro: 'Testaro',
67
46
  textNodes: 'data on specified text nodes',
68
47
  title: 'page title',
69
- titledEl: 'title attributes on inappropriate elements',
70
48
  wave: 'WAVE',
71
- zIndex: 'z indexes'
72
49
  };
73
50
  // Browser types available in PlayWright.
74
51
  const browserTypeNames = {
@@ -144,6 +121,9 @@ const hasType = (variable, type) => {
144
121
  else if (type === 'number') {
145
122
  return typeof variable === 'number';
146
123
  }
124
+ else if (type === 'object') {
125
+ return typeof variable === 'object' && ! Array.isArray(variable);
126
+ }
147
127
  else {
148
128
  return false;
149
129
  }
@@ -325,8 +305,8 @@ const launch = async (report, typeName, lowMotion = false) => {
325
305
  // Launch a browser of that type.
326
306
  const browserOptions = {
327
307
  logger: {
328
- isEnabled: (name, severity) => false,
329
- log: (name, severity, message, args) => console.log(message.slice(0, 100))
308
+ isEnabled: () => false,
309
+ log: (name, severity, message) => console.log(message.slice(0, 100))
330
310
  }
331
311
  };
332
312
  if (debug) {
@@ -538,6 +518,10 @@ const isTrue = (object, specs) => {
538
518
  else if (relation === '!i') {
539
519
  satisfied = typeof actual === 'string' && ! actual.includes(criterion);
540
520
  }
521
+ else if (relation === 'e') {
522
+ satisfied = typeof actual === 'object'
523
+ && JSON.stringify(actual) === JSON.stringify(criterion);
524
+ }
541
525
  return [actual, satisfied];
542
526
  }
543
527
  // Otherwise, i.e. if the specifications are invalid:
@@ -708,7 +692,7 @@ const doActs = async (report, actIndex, page) => {
708
692
  requestedURL = resolved;
709
693
  const {strict} = report;
710
694
  // Visit it and wait until the DOM is loaded.
711
- response = await goTo(report, page, requestedURL, 15000, 'domcontentloaded', strict);
695
+ let response = await goTo(report, page, requestedURL, 15000, 'domcontentloaded', strict);
712
696
  // If the visit fails:
713
697
  if (response.error) {
714
698
  // Launch another browser type.
@@ -1014,7 +998,7 @@ const doActs = async (report, actIndex, page) => {
1014
998
  let failureCount = 0;
1015
999
  // For each expectation:
1016
1000
  expectations.forEach(spec => {
1017
- const truth = isTrue(testReport.result, spec);
1001
+ const truth = isTrue(testReport, spec);
1018
1002
  testReport.result.expectations.push({
1019
1003
  property: spec[0],
1020
1004
  relation: spec[1],
@@ -1034,6 +1018,22 @@ const doActs = async (report, actIndex, page) => {
1034
1018
  // Add the result object (possibly an array) to the act.
1035
1019
  const resultCount = Object.keys(testReport.result).length;
1036
1020
  act.result = resultCount ? testReport.result : {success: false};
1021
+ // If a standard-format result is to be included in the report:
1022
+ const standard = process.env.STANDARD;
1023
+ if (['also', 'only'].includes(standard)) {
1024
+ // Initialize it.
1025
+ act.standardResult = {
1026
+ totals: [],
1027
+ instances: []
1028
+ };
1029
+ // Populate it.
1030
+ standardize(act);
1031
+ // If the original-format result is not to be included in the report:
1032
+ if (standard === 'only') {
1033
+ // Remove it.
1034
+ delete act.result;
1035
+ }
1036
+ }
1037
1037
  }
1038
1038
  // Otherwise, if the act is a move:
1039
1039
  else if (moves[act.type]) {