testaro 14.2.0 → 14.2.2

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/actSpecs.js CHANGED
@@ -214,7 +214,6 @@ exports.actSpecs = {
214
214
  tenon: [
215
215
  'Perform Tenon tests',
216
216
  {
217
- tenonData: [true, 'object', '', 'object with accessToken and requestIDs properties'],
218
217
  id: [true, 'string', 'hasLength', 'ID of the requested test instance']
219
218
  }
220
219
  ],
@@ -223,13 +222,13 @@ exports.actSpecs = {
223
222
  {
224
223
  withItems: [true, 'boolean', '', 'itemize'],
225
224
  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'],
225
+ args: [false, 'object', 'areArrays', 'extra args (object with rule properties and arrays of argument values as values ({focInd: [false, 250], hover: [-1], motion: [2500, 2500, 5]} by default'],
227
226
  }
228
227
  ],
229
228
  wave: [
230
229
  'Perform WAVE tests',
231
230
  {
232
- reportType: [true, 'number', '', 'WAVE report type']
231
+ reportType: [true, 'number', '', 'WAVE report type (1, 2, 3, or 4)']
233
232
  }
234
233
  ]
235
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "14.2.0",
3
+ "version": "14.2.2",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -107,6 +107,8 @@ const isFocusable = string => ['a', 'button', 'input', 'select'].includes(string
107
107
  const areNumbers = array => array.every(element => typeof element === 'number');
108
108
  // Returns whether all elements of an array are strings.
109
109
  const areStrings = array => array.every(element => typeof element === 'string');
110
+ // Returns whether all properties of an object have array values.
111
+ const areArrays = object => Object.values(object).every(value => Array.isArray(value));
110
112
  // Returns whether a variable has a specified type.
111
113
  const hasType = (variable, type) => {
112
114
  if (type === 'string') {
@@ -155,6 +157,9 @@ const hasSubtype = (variable, subtype) => {
155
157
  else if (subtype === 'areStrings') {
156
158
  return areStrings(variable);
157
159
  }
160
+ else if (subtype === 'areArrays') {
161
+ return areArrays(variable);
162
+ }
158
163
  else if (subtype === 'isState') {
159
164
  return isState(variable);
160
165
  }
package/standardize.js CHANGED
@@ -107,18 +107,6 @@ const doNuVal = (result, standardResult, docType) => {
107
107
  const doQualWeb = (result, standardResult, ruleClassName) => {
108
108
  if (result.modules && result.modules[ruleClassName]) {
109
109
  const ruleClass = result.modules[ruleClassName];
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
- ];
121
- }
122
110
  const severities = {
123
111
  'best-practices': {
124
112
  warning: 0,
@@ -140,7 +128,7 @@ const doQualWeb = (result, standardResult, ruleClassName) => {
140
128
  const instance = {
141
129
  issueID: rule,
142
130
  what: ruleResult.description,
143
- ordinalSeverity: severities[ruleClass][item.verdict],
131
+ ordinalSeverity: severities[ruleClassName][item.verdict],
144
132
  location: {
145
133
  doc: 'dom',
146
134
  type: 'selector',
@@ -149,6 +137,7 @@ const doQualWeb = (result, standardResult, ruleClassName) => {
149
137
  excerpt: cap(element.htmlCode)
150
138
  };
151
139
  standardResult.instances.push(instance);
140
+ standardResult.totals[instance.ordinalSeverity]++;
152
141
  });
153
142
  });
154
143
  });
@@ -158,7 +147,7 @@ const doQualWeb = (result, standardResult, ruleClassName) => {
158
147
  const doWAVE = (result, standardResult, categoryName) => {
159
148
  if (result.categories && result.categories[categoryName]) {
160
149
  const category = result.categories[categoryName];
161
- const ordinalSeverity = categoryName === 'alert' ? 0 : 1;
150
+ const ordinalSeverity = categoryName === 'alert' ? 0 : 3;
162
151
  Object.keys(category.items).forEach(rule => {
163
152
  category.items[rule].selectors.forEach(selector => {
164
153
  const instance = {
@@ -181,12 +170,12 @@ const doWAVE = (result, standardResult, categoryName) => {
181
170
  const convert = (testName, result, standardResult) => {
182
171
  // alfa
183
172
  if (testName === 'alfa' && result.totals) {
184
- standardResult.totals = [result.totals.warnings, result.totals.failures];
173
+ standardResult.totals = [result.totals.warnings, 0, 0, result.totals.failures];
185
174
  result.items.forEach(item => {
186
175
  const instance = {
187
176
  issueID: item.rule.ruleID,
188
177
  what: item.rule.ruleSummary,
189
- ordinalSeverity: ['cantTell', 'failed'].indexOf(item.verdict),
178
+ ordinalSeverity: ['cantTell', '', '', 'failed'].indexOf(item.verdict),
190
179
  location: {
191
180
  doc: 'dom',
192
181
  type: 'xpath',
@@ -238,7 +227,9 @@ const convert = (testName, result, standardResult) => {
238
227
  const {instances} = standardResult;
239
228
  standardResult.totals = [
240
229
  instances.filter(instance => instance.ordinalSeverity === 0).length,
241
- instances.filter(instance => instance.ordinalSeverity === 1).length
230
+ 0,
231
+ 0,
232
+ instances.filter(instance => instance.ordinalSeverity === 3).length
242
233
  ];
243
234
  }
244
235
  // ibm
@@ -248,7 +239,7 @@ const convert = (testName, result, standardResult) => {
248
239
  const instance = {
249
240
  issueID: item.ruleId,
250
241
  what: item.message,
251
- ordinalSeverity: ['recommendation', 'violation'].indexOf(item.level),
242
+ ordinalSeverity: ['', 'recommendation', '', 'violation'].indexOf(item.level),
252
243
  location: {
253
244
  doc: 'dom',
254
245
  type: 'xpath',
@@ -270,8 +261,9 @@ const convert = (testName, result, standardResult) => {
270
261
  const {instances} = standardResult;
271
262
  standardResult.totals = [
272
263
  instances.filter(instance => instance.ordinalSeverity === 0).length,
273
- instances.filter(instance => instance.ordinalSeverity === 1).length,
274
- instances.filter(instance => instance.ordinalSeverity === 2).length
264
+ 0,
265
+ instances.filter(instance => instance.ordinalSeverity === 2).length,
266
+ instances.filter(instance => instance.ordinalSeverity === 3).length,
275
267
  ];
276
268
  }
277
269
  // qualWeb
@@ -284,7 +276,7 @@ const convert = (testName, result, standardResult) => {
284
276
  || result.modules['best-practices']
285
277
  )
286
278
  ) {
287
- standardResult.totals = [0, 0, 0, 0, 0, 0];
279
+ standardResult.totals = [0, 0, 0, 0];
288
280
  if (result.modules['act-rules']) {
289
281
  doQualWeb(result, standardResult, 'act-rules');
290
282
  }
@@ -325,7 +317,7 @@ const convert = (testName, result, standardResult) => {
325
317
  rules.forEach(rule => {
326
318
  const ruleResult = result.rules[rule];
327
319
  standardResult.totals.forEach((total, index) => {
328
- standardResult.totals[index] += ruleResult.totals[index];
320
+ standardResult.totals[index] += ruleResult.totals[index] || 0;
329
321
  });
330
322
  standardResult.instances.push(... ruleResult.standardInstances);
331
323
  });
@@ -343,7 +335,10 @@ const convert = (testName, result, standardResult) => {
343
335
  ) {
344
336
  const {categories} = result;
345
337
  standardResult.totals = [
346
- categories.alert.count || 0, (categories.error.count || 0) + (categories.contrast.count || 0)
338
+ categories.alert.count || 0,
339
+ 0,
340
+ 0,
341
+ (categories.error.count || 0) + (categories.contrast.count || 0)
347
342
  ];
348
343
  ['error', 'contrast', 'alert'].forEach(categoryName => {
349
344
  doWAVE(result, standardResult, categoryName);
package/testaro/filter.js CHANGED
@@ -43,7 +43,7 @@ exports.reporter = async (page, withItems) => {
43
43
  }
44
44
  return data;
45
45
  }, withItems);
46
- const totals = [0, data.totals.impactedElements, data.totals.styledElements, 0, 0];
46
+ const totals = [0, data.totals.impactedElements, data.totals.styledElements, 0];
47
47
  const standardInstances = [];
48
48
  if (data.items) {
49
49
  data.items.forEach(item => {
@@ -86,7 +86,7 @@ exports.reporter = async (page, withItems) => {
86
86
  standardInstances.push({
87
87
  issueID: 'radioSet',
88
88
  what: 'Radio button and others with its name are not grouped in their own fieldset with a legend',
89
- ordinalSeverity: 0,
89
+ ordinalSeverity: 2,
90
90
  location: {
91
91
  doc: '',
92
92
  type: '',
@@ -100,7 +100,7 @@ exports.reporter = async (page, withItems) => {
100
100
  standardInstances.push({
101
101
  issueID: 'radioSet',
102
102
  what: 'Radio buttons are not validly grouped in fieldsets with legends',
103
- ordinalSeverity: 1,
103
+ ordinalSeverity: 2,
104
104
  location: {
105
105
  doc: '',
106
106
  type: '',
@@ -111,7 +111,7 @@ exports.reporter = async (page, withItems) => {
111
111
  }
112
112
  return {
113
113
  data,
114
- totals: [0, totals.total - totals.inSet, 0, 0],
114
+ totals: [0, 0, totals.total - totals.inSet, 0],
115
115
  standardInstances
116
116
  };
117
117
  }
package/tests/testaro.js CHANGED
@@ -29,7 +29,6 @@ const evalRules = {
29
29
  role: 'invalid, inadvised, and redundant explicit roles',
30
30
  styleDiff: 'style inconsistencies',
31
31
  tabNav: 'nonstandard keyboard navigation between elements with the tab role',
32
- title: 'missing page title',
33
32
  titledEl: 'title attributes on inappropriate elements',
34
33
  zIndex: 'non-default Z indexes'
35
34
  };