playwright-ctrf-json-reporter 0.0.21 → 0.0.23
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/dist/generate-report.js +20 -0
- package/package.json +1 -1
package/dist/generate-report.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
9
|
class GenerateCtrfReport {
|
|
9
10
|
constructor(config) {
|
|
10
11
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
@@ -32,6 +33,11 @@ class GenerateCtrfReport {
|
|
|
32
33
|
testEnvironment: (_t = config === null || config === void 0 ? void 0 : config.testEnvironment) !== null && _t !== void 0 ? _t : undefined,
|
|
33
34
|
};
|
|
34
35
|
this.ctrfReport = {
|
|
36
|
+
reportFormat: 'CTRF',
|
|
37
|
+
specVersion: '0.0.0',
|
|
38
|
+
reportId: crypto_1.default.randomUUID(),
|
|
39
|
+
timestamp: new Date().toISOString(),
|
|
40
|
+
generatedBy: 'playwright-ctrf-json-reporter',
|
|
35
41
|
results: {
|
|
36
42
|
tool: {
|
|
37
43
|
name: 'playwright',
|
|
@@ -142,6 +148,20 @@ class GenerateCtrfReport {
|
|
|
142
148
|
if (this.reporterConfigOptions.annotations !== undefined) {
|
|
143
149
|
test.extra = { annotations: testCase.annotations };
|
|
144
150
|
}
|
|
151
|
+
if (testCase.results.length > 1) {
|
|
152
|
+
const retryResults = testCase.results.slice(0, -1);
|
|
153
|
+
test.retryAttempts = [];
|
|
154
|
+
for (const retryResult of retryResults) {
|
|
155
|
+
const retryAttempt = {
|
|
156
|
+
status: this.mapPlaywrightStatusToCtrf(retryResult.status),
|
|
157
|
+
duration: retryResult.duration,
|
|
158
|
+
message: this.extractFailureDetails(retryResult).message,
|
|
159
|
+
trace: this.extractFailureDetails(retryResult).trace,
|
|
160
|
+
snippet: this.extractFailureDetails(retryResult).snippet,
|
|
161
|
+
};
|
|
162
|
+
test.retryAttempts.push(retryAttempt);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
145
165
|
}
|
|
146
166
|
ctrfReport.results.tests.push(test);
|
|
147
167
|
}
|