playwright-ctrf-json-reporter 0.0.20 → 0.0.22
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/README.md +1 -1
- package/dist/generate-report.js +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,6 +158,7 @@ The test object in the report includes the following [CTRF properties](https://c
|
|
|
158
158
|
| `suite` | String | Optional | The suite or group to which the test belongs. |
|
|
159
159
|
| `message` | String | Optional | The failure message if the test failed. |
|
|
160
160
|
| `trace` | String | Optional | The stack trace captured if the test failed. |
|
|
161
|
+
| `snippet` | String | Optional | The code snippet that was executed during the test if the test failed. |
|
|
161
162
|
| `rawStatus` | String | Optional | The original playwright status of the test before mapping to CTRF status. |
|
|
162
163
|
| `tags` | Array of Strings | Optional | The tags retrieved from the test name |
|
|
163
164
|
| `type` | String | Optional | The type of test (e.g., `api`, `e2e`). |
|
|
@@ -169,7 +170,6 @@ The test object in the report includes the following [CTRF properties](https://c
|
|
|
169
170
|
| `stdout` | Array of Strings | Optional | The standard output of the test. |
|
|
170
171
|
| `stderr` | Array of Strings | Optional | The standard error of the test. |
|
|
171
172
|
| `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
|
|
172
|
-
| `screenshot` | String | Optional | A base64 encoded screenshot taken during the test. |
|
|
173
173
|
| `steps` | Array of Objects | Optional | Individual steps in the test, especially for BDD-style testing. |
|
|
174
174
|
|
|
175
175
|
## Advanced usage
|
package/dist/generate-report.js
CHANGED
|
@@ -116,6 +116,7 @@ class GenerateCtrfReport {
|
|
|
116
116
|
test.stop = this.calculateStopTime(testResult.startTime, testResult.duration);
|
|
117
117
|
test.message = this.extractFailureDetails(testResult).message;
|
|
118
118
|
test.trace = this.extractFailureDetails(testResult).trace;
|
|
119
|
+
test.snippet = this.extractFailureDetails(testResult).snippet;
|
|
119
120
|
test.rawStatus = testResult.status;
|
|
120
121
|
test.tags = this.extractTagsFromTitle(testCase.title);
|
|
121
122
|
test.type = (_a = this.reporterConfigOptions.testType) !== null && _a !== void 0 ? _a : 'e2e';
|
|
@@ -141,6 +142,20 @@ class GenerateCtrfReport {
|
|
|
141
142
|
if (this.reporterConfigOptions.annotations !== undefined) {
|
|
142
143
|
test.extra = { annotations: testCase.annotations };
|
|
143
144
|
}
|
|
145
|
+
if (testCase.results.length > 1) {
|
|
146
|
+
const retryResults = testCase.results.slice(0, -1);
|
|
147
|
+
test.retryAttempts = [];
|
|
148
|
+
for (const retryResult of retryResults) {
|
|
149
|
+
const retryAttempt = {
|
|
150
|
+
status: this.mapPlaywrightStatusToCtrf(retryResult.status),
|
|
151
|
+
duration: retryResult.duration,
|
|
152
|
+
message: this.extractFailureDetails(retryResult).message,
|
|
153
|
+
trace: this.extractFailureDetails(retryResult).trace,
|
|
154
|
+
snippet: this.extractFailureDetails(retryResult).snippet,
|
|
155
|
+
};
|
|
156
|
+
test.retryAttempts.push(retryAttempt);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
144
159
|
}
|
|
145
160
|
ctrfReport.results.tests.push(test);
|
|
146
161
|
}
|
|
@@ -276,6 +291,9 @@ class GenerateCtrfReport {
|
|
|
276
291
|
if (testResult.error.stack !== undefined) {
|
|
277
292
|
failureDetails.trace = testResult.error.stack;
|
|
278
293
|
}
|
|
294
|
+
if (testResult.error.snippet !== undefined) {
|
|
295
|
+
failureDetails.snippet = testResult.error.snippet;
|
|
296
|
+
}
|
|
279
297
|
return failureDetails;
|
|
280
298
|
}
|
|
281
299
|
return {};
|