testaro 4.10.3 → 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/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;
|