@zohodesk/testinglibrary 0.0.64-n20-experimental → 0.0.65-n20-experimental
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/build/core/playwright/builtInFixtures/context.js +6 -3
- package/build/core/playwright/helpers/logCollector.js +20 -21
- package/build/core/playwright/readConfigFile.js +5 -1
- package/build/core/playwright/runner/SpawnRunner.js +1 -1
- package/npm-shrinkwrap.json +2418 -1360
- package/package.json +2 -2
- package/unit_reports/unit-report.html +277 -0
|
@@ -10,10 +10,13 @@ var _readConfigFile = require("../readConfigFile");
|
|
|
10
10
|
var _logCollector = require("../helpers/logCollector");
|
|
11
11
|
const {
|
|
12
12
|
testSetup,
|
|
13
|
-
|
|
13
|
+
uatDirectory,
|
|
14
14
|
runtimeLogs = {}
|
|
15
15
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
// Keep runtime logs OUTSIDE reportPath (HTML reporter wipes it on onEnd) and
|
|
18
|
+
// outside test-results (Playwright outputDir is cleaned each run).
|
|
19
|
+
const LOGS_DIR = _path.default.join(uatDirectory, 'runtime-logs');
|
|
17
20
|
async function performDefaultContextSteps({
|
|
18
21
|
context
|
|
19
22
|
}) {
|
|
@@ -54,7 +57,7 @@ var _default = exports.default = {
|
|
|
54
57
|
body: Buffer.from(JSON.stringify({
|
|
55
58
|
schemaVersion: 1,
|
|
56
59
|
summary,
|
|
57
|
-
file: filePath
|
|
60
|
+
file: filePath
|
|
58
61
|
}))
|
|
59
62
|
});
|
|
60
63
|
}
|
|
@@ -5,8 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.LogCollector = void 0;
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _fileUtils = require("../../../utils/fileUtils");
|
|
10
|
+
// Per-context Playwright runtime event collector — network failures,
|
|
11
|
+
// console errors, page errors and crashes. Buffered in-memory and flushed
|
|
12
|
+
// once per test via writeFileContents.
|
|
13
|
+
|
|
10
14
|
const DEFAULT_LIMITS = {
|
|
11
15
|
maxEvents: 2000,
|
|
12
16
|
maxBodyBytes: 0,
|
|
@@ -53,21 +57,16 @@ class LogCollector {
|
|
|
53
57
|
context.pages().forEach(p => this._attachPage(p));
|
|
54
58
|
this._bind(context, 'page', p => this._attachPage(p));
|
|
55
59
|
this._bind(context, 'request', req => {
|
|
56
|
-
if (this._shouldIgnore(req.url()))
|
|
60
|
+
if (this._shouldIgnore(req.url())) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
57
63
|
this.counts.request++;
|
|
58
|
-
this._push({
|
|
59
|
-
kind: 'request',
|
|
60
|
-
method: req.method(),
|
|
61
|
-
url: req.url(),
|
|
62
|
-
resourceType: req.resourceType(),
|
|
63
|
-
...(this.limits.captureHeaders ? {
|
|
64
|
-
headers: req.headers()
|
|
65
|
-
} : {})
|
|
66
|
-
});
|
|
67
64
|
});
|
|
68
65
|
this._bind(context, 'response', res => {
|
|
69
66
|
const url = res.url();
|
|
70
|
-
if (this._shouldIgnore(url))
|
|
67
|
+
if (this._shouldIgnore(url)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
71
70
|
this.counts.response++;
|
|
72
71
|
if (res.status() >= 400) {
|
|
73
72
|
this._push({
|
|
@@ -95,8 +94,10 @@ class LogCollector {
|
|
|
95
94
|
this._bind(page, 'console', msg => {
|
|
96
95
|
const type = msg.type();
|
|
97
96
|
this.counts.console++;
|
|
98
|
-
if (type
|
|
99
|
-
|
|
97
|
+
if (type !== 'error') {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.counts.consoleError++;
|
|
100
101
|
this._push({
|
|
101
102
|
kind: 'console',
|
|
102
103
|
level: type,
|
|
@@ -139,14 +140,12 @@ class LogCollector {
|
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
flushToFile(dir, baseName) {
|
|
142
|
-
if (this.events.length === 0)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
143
|
+
if (this.events.length === 0) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
146
|
const file = _path.default.join(dir, `${baseName}.jsonl`);
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
stream.end();
|
|
147
|
+
const body = this.events.map(e => JSON.stringify(e)).join('\n') + '\n';
|
|
148
|
+
(0, _fileUtils.writeFileContents)(file, body);
|
|
150
149
|
this.events.length = 0;
|
|
151
150
|
return file;
|
|
152
151
|
}
|
|
@@ -56,7 +56,10 @@ function getDefaultConfig() {
|
|
|
56
56
|
stepDefinitionsFolder: 'steps',
|
|
57
57
|
testSetup: {},
|
|
58
58
|
editionOrder: ['Free', 'Express', 'Standard', 'Professional', 'Enterprise'],
|
|
59
|
-
showCaseTimings: true
|
|
59
|
+
showCaseTimings: true,
|
|
60
|
+
runtimeLogs: {
|
|
61
|
+
mode: 'failure-only'
|
|
62
|
+
}
|
|
60
63
|
};
|
|
61
64
|
}
|
|
62
65
|
function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
@@ -115,6 +118,7 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
115
118
|
* @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
|
|
116
119
|
* @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
|
|
117
120
|
* @property {boolean} showCaseTimings: When true, the console reporter prints per-case start/end wall-clock times (h:mm:ss AM/PM) and a case-timings.json sidecar is written to reportPath for the HTML report addon. Default: true.
|
|
121
|
+
* @property {Object} runtimeLogs: Runtime browser log capture. { mode: 'failure-only' | 'always', limits?: { maxEvents, captureHeaders, ignoreUrlPatterns } }. Default: { mode: 'failure-only' }.
|
|
118
122
|
*/
|
|
119
123
|
|
|
120
124
|
/**
|