testaro 14.2.1 → 14.2.3
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 +2 -3
- package/package.json +1 -1
- package/run.js +5 -0
- package/standardize.js +15 -9
- package/testaro/filter.js +1 -1
- package/testaro/focAll.js +6 -1
- package/testaro/focInd.js +6 -1
- package/testaro/focOp.js +6 -1
- package/testaro/hover.js +6 -1
- package/testaro/menuNav.js +6 -1
- package/testaro/radioSet.js +3 -3
- package/testaro/tabNav.js +6 -1
- package/tests/testaro.js +0 -1
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
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
|
@@ -147,7 +147,7 @@ const doQualWeb = (result, standardResult, ruleClassName) => {
|
|
|
147
147
|
const doWAVE = (result, standardResult, categoryName) => {
|
|
148
148
|
if (result.categories && result.categories[categoryName]) {
|
|
149
149
|
const category = result.categories[categoryName];
|
|
150
|
-
const ordinalSeverity = categoryName === 'alert' ? 0 :
|
|
150
|
+
const ordinalSeverity = categoryName === 'alert' ? 0 : 3;
|
|
151
151
|
Object.keys(category.items).forEach(rule => {
|
|
152
152
|
category.items[rule].selectors.forEach(selector => {
|
|
153
153
|
const instance = {
|
|
@@ -170,12 +170,12 @@ const doWAVE = (result, standardResult, categoryName) => {
|
|
|
170
170
|
const convert = (testName, result, standardResult) => {
|
|
171
171
|
// alfa
|
|
172
172
|
if (testName === 'alfa' && result.totals) {
|
|
173
|
-
standardResult.totals = [result.totals.warnings, result.totals.failures];
|
|
173
|
+
standardResult.totals = [result.totals.warnings, 0, 0, result.totals.failures];
|
|
174
174
|
result.items.forEach(item => {
|
|
175
175
|
const instance = {
|
|
176
176
|
issueID: item.rule.ruleID,
|
|
177
177
|
what: item.rule.ruleSummary,
|
|
178
|
-
ordinalSeverity: ['cantTell', 'failed'].indexOf(item.verdict),
|
|
178
|
+
ordinalSeverity: ['cantTell', '', '', 'failed'].indexOf(item.verdict),
|
|
179
179
|
location: {
|
|
180
180
|
doc: 'dom',
|
|
181
181
|
type: 'xpath',
|
|
@@ -227,7 +227,9 @@ const convert = (testName, result, standardResult) => {
|
|
|
227
227
|
const {instances} = standardResult;
|
|
228
228
|
standardResult.totals = [
|
|
229
229
|
instances.filter(instance => instance.ordinalSeverity === 0).length,
|
|
230
|
-
|
|
230
|
+
0,
|
|
231
|
+
0,
|
|
232
|
+
instances.filter(instance => instance.ordinalSeverity === 3).length
|
|
231
233
|
];
|
|
232
234
|
}
|
|
233
235
|
// ibm
|
|
@@ -237,7 +239,7 @@ const convert = (testName, result, standardResult) => {
|
|
|
237
239
|
const instance = {
|
|
238
240
|
issueID: item.ruleId,
|
|
239
241
|
what: item.message,
|
|
240
|
-
ordinalSeverity: ['recommendation', 'violation'].indexOf(item.level),
|
|
242
|
+
ordinalSeverity: ['', 'recommendation', '', 'violation'].indexOf(item.level),
|
|
241
243
|
location: {
|
|
242
244
|
doc: 'dom',
|
|
243
245
|
type: 'xpath',
|
|
@@ -259,8 +261,9 @@ const convert = (testName, result, standardResult) => {
|
|
|
259
261
|
const {instances} = standardResult;
|
|
260
262
|
standardResult.totals = [
|
|
261
263
|
instances.filter(instance => instance.ordinalSeverity === 0).length,
|
|
262
|
-
|
|
263
|
-
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,
|
|
264
267
|
];
|
|
265
268
|
}
|
|
266
269
|
// qualWeb
|
|
@@ -314,7 +317,7 @@ const convert = (testName, result, standardResult) => {
|
|
|
314
317
|
rules.forEach(rule => {
|
|
315
318
|
const ruleResult = result.rules[rule];
|
|
316
319
|
standardResult.totals.forEach((total, index) => {
|
|
317
|
-
standardResult.totals[index] += ruleResult.totals[index];
|
|
320
|
+
standardResult.totals[index] += ruleResult.totals[index] || 0;
|
|
318
321
|
});
|
|
319
322
|
standardResult.instances.push(... ruleResult.standardInstances);
|
|
320
323
|
});
|
|
@@ -332,7 +335,10 @@ const convert = (testName, result, standardResult) => {
|
|
|
332
335
|
) {
|
|
333
336
|
const {categories} = result;
|
|
334
337
|
standardResult.totals = [
|
|
335
|
-
categories.alert.count || 0,
|
|
338
|
+
categories.alert.count || 0,
|
|
339
|
+
0,
|
|
340
|
+
0,
|
|
341
|
+
(categories.error.count || 0) + (categories.contrast.count || 0)
|
|
336
342
|
];
|
|
337
343
|
['error', 'contrast', 'alert'].forEach(categoryName => {
|
|
338
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
|
|
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 => {
|
package/testaro/focAll.js
CHANGED
|
@@ -54,7 +54,12 @@ exports.reporter = async page => {
|
|
|
54
54
|
discrepancy: tabFocused - tabFocusables
|
|
55
55
|
};
|
|
56
56
|
// Reload the page.
|
|
57
|
-
|
|
57
|
+
try {
|
|
58
|
+
await page.reload({timeout: 15000});
|
|
59
|
+
}
|
|
60
|
+
catch(error) {
|
|
61
|
+
console.log('ERROR: page reload timed out');
|
|
62
|
+
}
|
|
58
63
|
// Return the result.
|
|
59
64
|
return {
|
|
60
65
|
data,
|
package/testaro/focInd.js
CHANGED
|
@@ -200,7 +200,12 @@ exports.reporter = async (page, withItems, revealAll = false, allowedDelay = 250
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
// Reload the page.
|
|
203
|
-
|
|
203
|
+
try {
|
|
204
|
+
await page.reload({timeout: 15000});
|
|
205
|
+
}
|
|
206
|
+
catch(error) {
|
|
207
|
+
console.log('ERROR: page reload timed out');
|
|
208
|
+
}
|
|
204
209
|
return {
|
|
205
210
|
data,
|
|
206
211
|
totals,
|
package/testaro/focOp.js
CHANGED
|
@@ -188,7 +188,12 @@ exports.reporter = async (page, withItems) => {
|
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
// Reload the page.
|
|
191
|
-
|
|
191
|
+
try {
|
|
192
|
+
await page.reload({timeout: 15000});
|
|
193
|
+
}
|
|
194
|
+
catch(error) {
|
|
195
|
+
console.log('ERROR: page reload timed out');
|
|
196
|
+
}
|
|
192
197
|
return {
|
|
193
198
|
data,
|
|
194
199
|
totals,
|
package/testaro/hover.js
CHANGED
|
@@ -433,7 +433,12 @@ exports.reporter = async (page, withItems, sampleSize = -1) => {
|
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
// Reload the page.
|
|
436
|
-
|
|
436
|
+
try {
|
|
437
|
+
await page.reload({timeout: 15000});
|
|
438
|
+
}
|
|
439
|
+
catch(error) {
|
|
440
|
+
console.log('ERROR: page reload timed out');
|
|
441
|
+
}
|
|
437
442
|
// Return the result.
|
|
438
443
|
return {
|
|
439
444
|
data,
|
package/testaro/menuNav.js
CHANGED
|
@@ -296,7 +296,12 @@ exports.reporter = async (page, withItems) => {
|
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
// Reload the page.
|
|
299
|
-
|
|
299
|
+
try {
|
|
300
|
+
await page.reload({timeout: 15000});
|
|
301
|
+
}
|
|
302
|
+
catch(error) {
|
|
303
|
+
console.log('ERROR: page reload timed out');
|
|
304
|
+
}
|
|
300
305
|
return {
|
|
301
306
|
data,
|
|
302
307
|
totals,
|
package/testaro/radioSet.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
|
114
|
+
totals: [0, 0, totals.total - totals.inSet, 0],
|
|
115
115
|
standardInstances
|
|
116
116
|
};
|
|
117
117
|
}
|
package/testaro/tabNav.js
CHANGED
|
@@ -360,7 +360,12 @@ exports.reporter = async (page, withItems) => {
|
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
// Reload the page.
|
|
363
|
-
|
|
363
|
+
try {
|
|
364
|
+
await page.reload({timeout: 15000});
|
|
365
|
+
}
|
|
366
|
+
catch(error) {
|
|
367
|
+
console.log('ERROR: page reload timed out');
|
|
368
|
+
}
|
|
364
369
|
return {
|
|
365
370
|
data,
|
|
366
371
|
totals,
|
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
|
};
|