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/tests/ibm.js CHANGED
@@ -2,9 +2,8 @@
2
2
  ibm
3
3
  This test implements the IBM Equal Access ruleset for accessibility.
4
4
  The 'withNewContent' argument determines whether the test package should be
5
- given the URL of the page to be tested (true), should be given the page content
6
- (false), or should test in both ways (omitted).
7
-
5
+ given the URL of the page to be tested (true) or the page content (false).
6
+
8
7
  This test depends on aceconfig.js.
9
8
 
10
9
  This test is compatible with Windows only if the accessibility-checker package
@@ -122,49 +121,22 @@ const doTest = async (content, withItems, timeLimit, rules) => {
122
121
  };
123
122
  }
124
123
  };
125
- // Returns results of one or two IBM tests.
124
+ // Returns results of an IBM test.
126
125
  exports.reporter = async (page, withItems, withNewContent, rules) => {
127
- let contentType = 'both';
128
- if (withNewContent) {
129
- contentType = 'new';
130
- }
131
- else if (withNewContent === false) {
132
- contentType = 'existing';
133
- }
126
+ const contentType = withNewContent ? 'new' : 'existing';
134
127
  console.log(`>>>>>> Content type: ${contentType}`);
135
- // If a test with existing content is to be performed:
136
- const result = {};
137
- const timeLimit = 20;
138
- if (['existing', 'both'].includes(contentType)) {
139
- try {
140
- console.log('>>>>>> With existing content');
141
- const typeContent = await page.content();
142
- result.content = await doTest(typeContent, withItems, timeLimit, rules);
143
- if (result.content.prevented) {
144
- result.prevented = true;
145
- console.log(`ERROR: Getting ibm test report from page timed out at ${timeLimit} seconds`);
146
- }
147
- }
148
- catch(error) {
149
- result.prevented = true;
150
- console.log(`ERROR: ibm test on page crashed with error ${error.message.slice(0, 200)}`);
128
+ let result;
129
+ const timeLimit = 30;
130
+ const typeContent = contentType === 'existing' ? await page.content() : await page.url();
131
+ try {
132
+ result = await doTest(typeContent, withItems, timeLimit, rules);
133
+ if (result.prevented) {
134
+ console.log(`ERROR: Getting ibm test report timed out at ${timeLimit} seconds`);
151
135
  }
152
136
  }
153
- // If a test with new content is to be performed:
154
- if (['new', 'both'].includes(contentType)) {
155
- try {
156
- console.log('>>>>>> With new content');
157
- const typeContent = page.url();
158
- result.url = await doTest(typeContent, withItems, timeLimit, rules);
159
- if (result.url.prevented) {
160
- result.prevented = true;
161
- console.log(`ERROR: Getting ibm test report from URL timed out at ${timeLimit} seconds`);
162
- }
163
- }
164
- catch(error) {
165
- result.prevented = true;
166
- console.log(`ERROR: ibm test on URL crashed with error ${error.message.slice(0, 200)}`);
167
- }
137
+ catch(error) {
138
+ result.prevented = true;
139
+ console.log(`ERROR: ibm test crashed with error ${error.message.slice(0, 200)}`);
168
140
  }
169
141
  // Return the result. Execution of close() crashed the Node process.
170
142
  return {result};
@@ -0,0 +1,73 @@
1
+ /*
2
+ testaro
3
+ This test implements the Testaro evaluative ruleset for accessibility.
4
+ */
5
+
6
+ // CONSTANTS
7
+
8
+ const evalRules = {
9
+ allHidden: 'page that is entirely or mostly hidden',
10
+ autocomplete: 'name and email inputs without autocomplete attributes',
11
+ bulk: 'large count of visible elements',
12
+ docType: 'document without a doctype property',
13
+ dupAtt: 'elements with duplicate attributes',
14
+ embAc: 'active elements embedded in links or buttons',
15
+ filter: 'filter styles on elements',
16
+ focAll: 'discrepancies between focusable and Tab-focused elements',
17
+ focInd: 'missing and nonstandard focus indicators',
18
+ focOp: 'discrepancies between focusability and operability',
19
+ focVis: 'links that are invisible when focused',
20
+ hover: 'hover-caused content changes',
21
+ labClash: 'labeling inconsistencies',
22
+ linkTo: 'links without destinations',
23
+ linkUl: 'missing underlines on inline links',
24
+ menuNav: 'nonstandard keyboard navigation between focusable menu items',
25
+ miniText: 'text smaller than 11 pixels',
26
+ motion: 'motion without user request',
27
+ nonTable: 'table elements used for layout',
28
+ radioSet: 'radio buttons not grouped into standard field sets',
29
+ role: 'invalid, inadvised, and redundant explicit roles',
30
+ styleDiff: 'style inconsistencies',
31
+ tabNav: 'nonstandard keyboard navigation between elements with the tab role',
32
+ title: 'missing page title',
33
+ titledEl: 'title attributes on inappropriate elements',
34
+ zIndex: 'non-default Z indexes'
35
+ };
36
+ const etcRules = {
37
+ attVal: 'elements with attributes having illicit values',
38
+ elements: 'data on specified elements',
39
+ textNodes: 'data on specified text nodes',
40
+ title: 'page title',
41
+ };
42
+
43
+ // FUNCTIONS
44
+
45
+ // Conducts and reports a Testaro test.
46
+ exports.reporter = async (
47
+ page, withItems, rules = ['y', ... Object.keys(evalRules)], args = null
48
+ ) => {
49
+ // Initialize the data.
50
+ const data = {
51
+ rules: {}
52
+ };
53
+ // For each rule invoked:
54
+ const argRules = args && Object.keys(args);
55
+ const realRules = rules[0] === 'y'
56
+ ? rules.slice(1)
57
+ : Object.keys(evalRules).filter(ruleName => ! rules.slice(1).includes(ruleName));
58
+ for (const rule of realRules) {
59
+ // Initialize an argument array.
60
+ const ruleArgs = [page, withItems];
61
+ // If the rule has extra arguments:
62
+ if (argRules && argRules.includes(rule)) {
63
+ // Add them to the argument array.
64
+ ruleArgs.push(... args[rule]);
65
+ }
66
+ // Test the page.
67
+ data.rules[rule] = await require(`../testaro/${rule}`).reporter(... ruleArgs);
68
+ const what = evalRules[rule] || etcRules[rule];
69
+ data.rules[rule].what = what;
70
+ console.log(`>>>>>> ${rule} (${what})`);
71
+ }
72
+ return {result: data};
73
+ };