testaro 4.10.1 → 4.10.4
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/package.json +1 -1
- package/run.js +32 -3
- package/tests/focOp.js +5 -0
- package/tests/wave.js +17 -3
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -64,10 +64,25 @@ const tenonData = {
|
|
|
64
64
|
accessToken: '',
|
|
65
65
|
requestIDs: {}
|
|
66
66
|
};
|
|
67
|
+
// Keywords in log messages indicating errors.
|
|
68
|
+
const errorWords = [
|
|
69
|
+
'failed',
|
|
70
|
+
'error',
|
|
71
|
+
'suspicious',
|
|
72
|
+
'refused',
|
|
73
|
+
'content security policy',
|
|
74
|
+
'unrecognized',
|
|
75
|
+
'requires',
|
|
76
|
+
'warning',
|
|
77
|
+
'missing',
|
|
78
|
+
'deprecated'
|
|
79
|
+
];
|
|
67
80
|
// ########## VARIABLES
|
|
68
81
|
// Facts about the current session.
|
|
69
82
|
let logCount = 0;
|
|
70
83
|
let logSize = 0;
|
|
84
|
+
let errorLogCount = 0;
|
|
85
|
+
let errorLogSize = 0;
|
|
71
86
|
let prohibitedCount = 0;
|
|
72
87
|
let visitTimeoutCount = 0;
|
|
73
88
|
let visitRejectionCount = 0;
|
|
@@ -253,12 +268,18 @@ const launch = async typeName => {
|
|
|
253
268
|
browserContext = await browser.newContext(viewport);
|
|
254
269
|
// When a page is added to the browser context:
|
|
255
270
|
browserContext.on('page', page => {
|
|
256
|
-
// Make its console messages appear in the Playwright console.
|
|
271
|
+
// Make its console messages get reported and appear in the Playwright console.
|
|
257
272
|
page.on('console', msg => {
|
|
258
273
|
const msgText = msg.text();
|
|
259
274
|
console.log(`[${msgText}]`);
|
|
275
|
+
const msgTextLC = msgText.toLowerCase();
|
|
276
|
+
const msgLength = msgText.length;
|
|
260
277
|
logCount++;
|
|
261
|
-
logSize +=
|
|
278
|
+
logSize += msgLength;
|
|
279
|
+
if (errorWords.some(word => msgTextLC.includes(word))) {
|
|
280
|
+
errorLogCount++;
|
|
281
|
+
errorLogSize += msgLength;
|
|
282
|
+
}
|
|
262
283
|
const msgLC = msgText.toLowerCase();
|
|
263
284
|
if (msgText.includes('403') && (msgLC.includes('status') || msgLC.includes('prohibited'))) {
|
|
264
285
|
prohibitedCount++;
|
|
@@ -1224,7 +1245,13 @@ const doActs = async (report, actIndex, page) => {
|
|
|
1224
1245
|
// Performs the commands in a script.
|
|
1225
1246
|
const doScript = async (report) => {
|
|
1226
1247
|
// Reinitialize the log statistics.
|
|
1227
|
-
logCount =
|
|
1248
|
+
logCount = 0;
|
|
1249
|
+
logSize = 0;
|
|
1250
|
+
errorLogCount = 0;
|
|
1251
|
+
errorLogSize = 0;
|
|
1252
|
+
prohibitedCount = 0;
|
|
1253
|
+
visitTimeoutCount = 0;
|
|
1254
|
+
visitRejectionCount = 0;
|
|
1228
1255
|
// Add the start time to the report.
|
|
1229
1256
|
const startTime = new Date();
|
|
1230
1257
|
report.startTime = startTime.toISOString().slice(0, 19);
|
|
@@ -1239,6 +1266,8 @@ const doScript = async (report) => {
|
|
|
1239
1266
|
// Add the log statistics to the report.
|
|
1240
1267
|
report.logCount = logCount;
|
|
1241
1268
|
report.logSize = logSize;
|
|
1269
|
+
report.errorLogCount = errorLogCount;
|
|
1270
|
+
report.errorLogSize = errorLogSize;
|
|
1242
1271
|
report.prohibitedCount = prohibitedCount;
|
|
1243
1272
|
report.visitTimeoutCount = visitTimeoutCount;
|
|
1244
1273
|
report.visitRejectionCount = visitRejectionCount;
|
package/tests/focOp.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
focOp
|
|
3
|
+
|
|
4
|
+
WARNING: The chromium and firefox browsers in Playwright make errors on this test by
|
|
5
|
+
misclassifying the cursor property values of the computed styles of elements. Launch the
|
|
6
|
+
webkit browser to run this test.
|
|
7
|
+
|
|
3
8
|
This test reports descrepancies between Tab-focusability and operability. The standard
|
|
4
9
|
practice is to make focusable elements operable and vice versa. If focusable elements are not
|
|
5
10
|
operable, users are likely to be surprised that nothing happens when they try to operate such
|
package/tests/wave.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
specifies a WAVE report type: 1, 2, 3, or 4. The larger the number, the more detailed (and
|
|
5
5
|
expensive) the report.
|
|
6
6
|
*/
|
|
7
|
+
const fs = require('fs/promises');
|
|
7
8
|
const https = require('https');
|
|
8
9
|
exports.reporter = async (page, reportType) => {
|
|
9
10
|
const waveKey = process.env.WAVE_KEY;
|
|
@@ -20,20 +21,33 @@ exports.reporter = async (page, reportType) => {
|
|
|
20
21
|
response.on('data', chunk => {
|
|
21
22
|
report += chunk;
|
|
22
23
|
});
|
|
23
|
-
// When the data arrive
|
|
24
|
-
response.on('end', () => {
|
|
24
|
+
// When the data arrive:
|
|
25
|
+
response.on('end', async () => {
|
|
25
26
|
try {
|
|
27
|
+
// Delete unnecessary properties.
|
|
26
28
|
const result = JSON.parse(report);
|
|
27
29
|
const {categories} = result;
|
|
28
30
|
delete categories.feature;
|
|
29
31
|
delete categories.structure;
|
|
30
32
|
delete categories.aria;
|
|
33
|
+
// Add WCAG information from the WAVE documentation.
|
|
34
|
+
const waveDocJSON = await fs.readFile('procs/wavedoc.json');
|
|
35
|
+
const waveDoc = JSON.parse(waveDocJSON);
|
|
36
|
+
Object.keys(categories).forEach(categoryName => {
|
|
37
|
+
const category = categories[categoryName];
|
|
38
|
+
const {items} = category;
|
|
39
|
+
Object.keys(items).forEach(issueName => {
|
|
40
|
+
const issueDoc = waveDoc.find((issue => issue.name === issueName));
|
|
41
|
+
const {guidelines} = issueDoc;
|
|
42
|
+
items[issueName].wcag = guidelines;
|
|
43
|
+
});
|
|
44
|
+
})
|
|
31
45
|
return resolve(result);
|
|
32
46
|
}
|
|
33
47
|
catch (error) {
|
|
34
48
|
return resolve({
|
|
35
49
|
prevented: true,
|
|
36
|
-
error:
|
|
50
|
+
error: error.message,
|
|
37
51
|
report
|
|
38
52
|
});
|
|
39
53
|
}
|