testaro 14.1.0 → 14.2.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
@@ -218,7 +218,7 @@ The original result of a test act is recorded as the value of a `result` propert
218
218
 
219
219
  ``` javascript
220
220
  standardResult: {
221
- totals: [2, 0, 1],
221
+ totals: [2, 0, 1, 0],
222
222
  instances: [
223
223
  {
224
224
  issueID: 'rule01',
package/actSpecs.js CHANGED
@@ -147,7 +147,7 @@ exports.actSpecs = {
147
147
  wait: [
148
148
  'Wait until something appears',
149
149
  {
150
- what: [true, 'string', 'isWaitable', 'waitable item type'],
150
+ what: [true, 'string', 'isWaitable', 'waitable item type (url, title, or body)'],
151
151
  which: [true, 'string', 'hasLength', 'substring of waitable-item text']
152
152
  }
153
153
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -1532,7 +1532,6 @@ exports.doJob = async report => {
1532
1532
  report.jobData.errorLogCount = 0;
1533
1533
  report.jobData.errorLogSize = 0;
1534
1534
  report.jobData.prohibitedCount = 0;
1535
- report.jobData.visitTimeoutCount = 0;
1536
1535
  report.jobData.visitRejectionCount = 0;
1537
1536
  report.jobData.aborted = false;
1538
1537
  report.jobData.abortedAct = null;
package/standardize.js CHANGED
@@ -28,12 +28,17 @@ const doAxe = (result, standardResult, certainty) => {
28
28
  ... node.any.map(anyItem => anyItem.message),
29
29
  ... node.all.map(allItem => allItem.message)
30
30
  ]);
31
- const initialSeverity = ['minor', 'moderate', 'serious', 'critical'].indexOf(node.impact);
32
- const moreSeverity = certainty === 'violations' ? 4 : 0;
31
+ const severityWeights = {
32
+ minor: 0,
33
+ moderate: 0,
34
+ serious: 1,
35
+ critical: 1
36
+ };
37
+ const ordinalSeverity = severityWeights[node.impact] + (certainty === 'violations' ? 2 : 0);
33
38
  const instance = {
34
39
  issueID: rule.id,
35
40
  what: Array.from(whatSet.values()).join('; '),
36
- ordinalSeverity: initialSeverity + moreSeverity,
41
+ ordinalSeverity,
37
42
  location: {
38
43
  doc: 'dom',
39
44
  type: 'selector',
@@ -57,7 +62,7 @@ const doHTMLCS = (result, standardResult, severity) => {
57
62
  const instance = {
58
63
  issueID: ruleID,
59
64
  what,
60
- ordinalSeverity: ['Warning', 'Error'].indexOf(severity),
65
+ ordinalSeverity: ['Warning', '', '', 'Error'].indexOf(severity),
61
66
  location: {
62
67
  doc: 'dom',
63
68
  type: '',
@@ -92,7 +97,7 @@ const doNuVal = (result, standardResult, docType) => {
92
97
  instance.ordinalSeverity = 0;
93
98
  }
94
99
  else if (type === 'error') {
95
- instance.ordinalSeverity = subType === 'fatal' ? 2 : 1;
100
+ instance.ordinalSeverity = subType === 'fatal' ? 3 : 2;
96
101
  }
97
102
  standardResult.instances.push(instance);
98
103
  });
@@ -102,21 +107,40 @@ const doNuVal = (result, standardResult, docType) => {
102
107
  const doQualWeb = (result, standardResult, ruleClassName) => {
103
108
  if (result.modules && result.modules[ruleClassName]) {
104
109
  const ruleClass = result.modules[ruleClassName];
105
- let classSeverity = 0;
106
- if (ruleClass.metadata) {
107
- classSeverity = 2 * [
108
- 'best-practices', 'wcag-techniques', 'act-rules'
109
- ].indexOf(ruleClassName);
110
- standardResult.totals[classSeverity] += ruleClass.metadata.warning;
111
- standardResult.totals[classSeverity + 1] += ruleClass.metadata.failed;
110
+ if (ruleClass.metadata && ruleClass.modules) {
111
+ const {modules} = ruleClass;
112
+ const ruleTotals = modules['act-rules'] && modules['act-rules'].metadata;
113
+ const techniqueTotals = modules['wcag-techniques'] && modules['wcag-techniques'].metadata;
114
+ const practiceTotals = modules['best-practices'] && modules['best-practices'].metadata;
115
+ standardResult.totals = [
116
+ practiceTotals.warning + techniqueTotals.warning,
117
+ practiceTotals.failed + ruleTotals.warning,
118
+ techniqueTotals.failed,
119
+ ruleTotals.failed
120
+ ];
112
121
  }
122
+ const severities = {
123
+ 'best-practices': {
124
+ warning: 0,
125
+ failed: 1
126
+ },
127
+ 'wcag-techniques': {
128
+ warning: 0,
129
+ failed: 2
130
+ },
131
+ 'act-rules': {
132
+ warning: 1,
133
+ failed: 3
134
+ }
135
+ };
113
136
  Object.keys(ruleClass.assertions).forEach(rule => {
114
- ruleClass.assertions[rule].results.forEach(item => {
137
+ const ruleResult = ruleClass.assertions[rule];
138
+ ruleResult.results.forEach(item => {
115
139
  item.elements.forEach(element => {
116
140
  const instance = {
117
- issueID: ruleClass.assertions[rule].name,
118
- what: ruleClass.assertions[rule].description,
119
- ordinalSeverity: classSeverity + (item.verdict === 'failed' ? 1 : 0),
141
+ issueID: rule,
142
+ what: ruleResult.description,
143
+ ordinalSeverity: severities[ruleClass][item.verdict],
120
144
  location: {
121
145
  doc: 'dom',
122
146
  type: 'selector',
@@ -181,21 +205,17 @@ const convert = (testName, result, standardResult) => {
181
205
  ) {
182
206
  const {totals} = result;
183
207
  standardResult.totals = [
184
- totals.warnings.minor,
185
- totals.warnings.moderate,
186
- totals.warnings.serious,
187
- totals.warnings.critical,
188
- totals.violations.minor,
189
- totals.violations.moderate,
190
- totals.violations.serious,
191
- totals.violations.critical
208
+ totals.warnings.minor + totals.warnings.moderate,
209
+ totals.warnings.serious + totals.warnings.critical,
210
+ totals.violations.minor + totals.violations.moderate,
211
+ totals.violations.serious + totals.violations.critical
192
212
  ];
193
213
  doAxe(result, standardResult, 'incomplete');
194
214
  doAxe(result, standardResult, 'violations');
195
215
  }
196
216
  // continuum
197
217
  else if (testName === 'continuum' && Array.isArray(result) && result.length) {
198
- standardResult.totals = [result.length];
218
+ standardResult.totals = [0, 0, 0, result.length];
199
219
  result.forEach(item => {
200
220
  const instance = {
201
221
  issueID: item.engineTestId.toString(),
@@ -223,7 +243,7 @@ const convert = (testName, result, standardResult) => {
223
243
  }
224
244
  // ibm
225
245
  else if (testName === 'ibm' && result.totals) {
226
- standardResult.totals = [result.totals.recommendation, result.totals.violation];
246
+ standardResult.totals = [0, result.totals.recommendation, 0, result.totals.violation];
227
247
  result.items.forEach(item => {
228
248
  const instance = {
229
249
  issueID: item.ruleId,
@@ -282,7 +302,7 @@ const convert = (testName, result, standardResult) => {
282
302
  issueID: item.tID ? item.tID.toString() : '',
283
303
  what: item.errorTitle || '',
284
304
  ordinalSeverity: Math.min(
285
- 5, Math.max(0, Math.round((item.certainty || 0) * (item.priority || 0) / 2000))
305
+ 3, Math.max(0, Math.round((item.certainty || 0) * (item.priority || 0) / 3333))
286
306
  ),
287
307
  location: {
288
308
  doc: 'dom',
@@ -293,7 +313,7 @@ const convert = (testName, result, standardResult) => {
293
313
  };
294
314
  standardResult.instances.push(instance);
295
315
  });
296
- standardResult.totals = [0, 0, 0, 0, 0, 0];
316
+ standardResult.totals = [0, 0, 0, 0];
297
317
  standardResult.instances.forEach(instance => {
298
318
  standardResult.totals[instance.ordinalSeverity]++;
299
319
  });