allure-playwright 3.14.0 → 3.15.0
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 +27 -1
- package/dist/cjs/index.js +71 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/utils.js +39 -3
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +73 -31
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/utils.js +39 -3
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +5 -1
- package/dist/types/model.d.ts +6 -0
- package/dist/types/utils.d.ts +9 -1
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ npm install -D allure-playwright
|
|
|
34
34
|
|
|
35
35
|
Install Allure Report separately when you want to render the generated `allure-results`:
|
|
36
36
|
|
|
37
|
-
- follow the [Allure Report 2 installation guide](https://allurereport.org/docs/install/) to use the `allure` CLI
|
|
37
|
+
- follow the [Allure Report 2 installation guide](https://allurereport.org/docs/v2/install/) to use the `allure` CLI
|
|
38
38
|
- or install Allure Report 3 with `npm install -D allure` to use `npx allure`
|
|
39
39
|
|
|
40
40
|
## Supported versions and platforms
|
|
@@ -77,6 +77,32 @@ directory.
|
|
|
77
77
|
|
|
78
78
|
You may select another location, or further customize the reporter's behavior with [the configuration options](https://allurereport.org/docs/playwright-configuration/).
|
|
79
79
|
|
|
80
|
+
To hide steps generated from Playwright annotations that are not mapped to Allure metadata, set
|
|
81
|
+
`reportAnnotations: false`:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
export default defineConfig({
|
|
85
|
+
reporter: [["allure-playwright", { reportAnnotations: false }]],
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Annotation steps are enabled by default, independently of `detail`. This option only controls their
|
|
90
|
+
presentation as steps: labels, links, descriptions, and skip/fixme handling are preserved. The original
|
|
91
|
+
annotations remain available to Playwright and other reporters.
|
|
92
|
+
|
|
93
|
+
To hide Playwright API calls while keeping `expect` assertions as steps, set `reportMatchers: true`
|
|
94
|
+
with `detail: false`:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
reporter: [["allure-playwright", { detail: false, reportMatchers: true }]],
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`reportMatchers` controls Playwright `expect` steps, including assertions in hooks. When omitted,
|
|
103
|
+
it follows `detail` (`true` by default). Set `reportMatchers: false` to hide assertion steps while
|
|
104
|
+
keeping other details enabled. User-created steps and attachments are reported independently.
|
|
105
|
+
|
|
80
106
|
To use name-based test selectors instead of source locations, enable the legacy full name format:
|
|
81
107
|
|
|
82
108
|
```js
|
package/dist/cjs/index.js
CHANGED
|
@@ -83,6 +83,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
83
83
|
_defineProperty(this, "testFullNames", new WeakMap());
|
|
84
84
|
_defineProperty(this, "emittedHookGlobalErrorKeys", new Set());
|
|
85
85
|
_defineProperty(this, "testPlan", (0, _reporter.parseTestPlan)());
|
|
86
|
+
_defineProperty(this, "replayedBlobCount", 0);
|
|
87
|
+
_defineProperty(this, "activeBlobIndex", void 0);
|
|
86
88
|
this.options = _objectSpread({
|
|
87
89
|
suiteTitle: true,
|
|
88
90
|
detail: true
|
|
@@ -197,8 +199,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
197
199
|
key: "onConfigure",
|
|
198
200
|
value: function onConfigure(config) {
|
|
199
201
|
this.config = config;
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
+
this.replayedBlobCount = 0;
|
|
203
|
+
this.activeBlobIndex = undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Playwright's v2 merge dispatcher brackets each blob with these callbacks.
|
|
207
|
+
}, {
|
|
208
|
+
key: "onReportConfigure",
|
|
209
|
+
value: function onReportConfigure() {
|
|
210
|
+
this.activeBlobIndex = ++this.replayedBlobCount;
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
key: "onReportEnd",
|
|
214
|
+
value: function onReportEnd() {
|
|
215
|
+
this.activeBlobIndex = undefined;
|
|
202
216
|
}
|
|
203
217
|
}, {
|
|
204
218
|
key: "onError",
|
|
@@ -215,7 +229,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
215
229
|
}, {
|
|
216
230
|
key: "onBegin",
|
|
217
231
|
value: function onBegin(suite) {
|
|
232
|
+
var _this$config$projects, _this$config$projects2;
|
|
218
233
|
this.suite = suite;
|
|
234
|
+
this.outputDir = (_this$config$projects = this.config.projects[0]) === null || _this$config$projects === void 0 ? void 0 : _this$config$projects.outputDir;
|
|
235
|
+
this.snapshotDir = (_this$config$projects2 = this.config.projects[0]) === null || _this$config$projects2 === void 0 ? void 0 : _this$config$projects2.snapshotDir;
|
|
219
236
|
this.emittedHookGlobalErrorKeys.clear();
|
|
220
237
|
this.allureRuntime = new _reporter.ReporterRuntime(_objectSpread(_objectSpread({}, this.options), {}, {
|
|
221
238
|
writer: (0, _reporter.createDefaultWriter)({
|
|
@@ -225,12 +242,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
225
242
|
}
|
|
226
243
|
}, {
|
|
227
244
|
key: "onTestBegin",
|
|
228
|
-
value: function onTestBegin(test) {
|
|
245
|
+
value: function onTestBegin(test, testResult) {
|
|
229
246
|
var _metadata$relativeFil, _metadata$project, _metadata$project2;
|
|
230
247
|
var metadata = this.getStaticTestMetadata(test);
|
|
231
248
|
var titlePath = metadata.projectName ? [metadata.projectName].concat(_toConsumableArray(metadata.relativeFileParts), _toConsumableArray(metadata.suiteTitles)) : (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles));
|
|
232
249
|
var result = {
|
|
233
250
|
name: metadata.titleMetadata.cleanTitle,
|
|
251
|
+
start: testResult.startTime.getTime(),
|
|
234
252
|
labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
235
253
|
links: _toConsumableArray(metadata.titleMetadata.links),
|
|
236
254
|
parameters: [],
|
|
@@ -293,6 +311,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
293
311
|
result.labels.push(annotationLabel);
|
|
294
312
|
continue;
|
|
295
313
|
}
|
|
314
|
+
if (this.options.reportAnnotations === false) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
296
317
|
result.steps.push({
|
|
297
318
|
name: "".concat(annotation.type, ": ").concat(annotation.description),
|
|
298
319
|
status: _allureJsCommons.Status.PASSED,
|
|
@@ -581,7 +602,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
581
602
|
}, {
|
|
582
603
|
key: "onStepBegin",
|
|
583
604
|
value: function onStepBegin(test, _result, step) {
|
|
584
|
-
var
|
|
605
|
+
var _assertClassBrand$cal;
|
|
585
606
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
586
607
|
if (!testUuid) {
|
|
587
608
|
// eslint-disable-next-line no-console
|
|
@@ -604,11 +625,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
604
625
|
uuid: (0, _reporter.randomUuid)()
|
|
605
626
|
});
|
|
606
627
|
if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
|
|
607
|
-
var _this$pwStepUuid$get;
|
|
608
|
-
var parent = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
|
|
609
628
|
this.attachmentTargetByStep.set(step, {
|
|
610
629
|
name: (0, _utils.normalizeAttachStepTitle)(step.title),
|
|
611
|
-
stepUuid:
|
|
630
|
+
stepUuid: _assertClassBrand(_AllureReporter_brand, this, _getReportedParentUuid).call(this, step)
|
|
612
631
|
});
|
|
613
632
|
return;
|
|
614
633
|
}
|
|
@@ -650,7 +669,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
650
669
|
}
|
|
651
670
|
return;
|
|
652
671
|
}
|
|
653
|
-
var parentUuid =
|
|
672
|
+
var parentUuid = (_assertClassBrand$cal = _assertClassBrand(_AllureReporter_brand, this, _getReportedParentUuid).call(this, step)) !== null && _assertClassBrand$cal !== void 0 ? _assertClassBrand$cal : null;
|
|
654
673
|
var createdUuid = this.allureRuntime.startStep(testUuid, parentUuid, baseStep);
|
|
655
674
|
if (createdUuid) {
|
|
656
675
|
this.pwStepUuid.set(step, createdUuid);
|
|
@@ -736,7 +755,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
736
755
|
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(test, result) {
|
|
737
756
|
var _this2 = this,
|
|
738
757
|
_this$attachmentTarge2;
|
|
739
|
-
var testUuid, threadId,
|
|
758
|
+
var testUuid, threadId, blob, thread, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator7, _step7, _targetsByName$get, t, q, takeByName, _iterator8, _step8, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu2, _stepInfo$hookStep2, message, targetStack, _targetStack, stepUuid, _targetStack2, stepResult, fileName, _t3;
|
|
740
759
|
return _regenerator().w(function (_context3) {
|
|
741
760
|
while (1) switch (_context3.n) {
|
|
742
761
|
case 0:
|
|
@@ -751,8 +770,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
751
770
|
case 1:
|
|
752
771
|
// We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
753
772
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
754
|
-
|
|
755
|
-
|
|
773
|
+
blob = this.activeBlobIndex === undefined ? "" : "-blob-".concat(this.activeBlobIndex);
|
|
774
|
+
thread = "pid-".concat(_nodeProcess["default"].pid).concat(blob, "-worker-").concat(threadId); // only apply default suites if not set by user
|
|
756
775
|
_test$parent$titlePat = test.parent.titlePath(), _test$parent$titlePat2 = _toArray(_test$parent$titlePat), projectSuiteTitle = _test$parent$titlePat2[1], fileSuiteTitle = _test$parent$titlePat2[2], suiteTitles = _test$parent$titlePat2.slice(3);
|
|
757
776
|
beforeHooksStack = this.beforeHooksStepsStack.get(test.id);
|
|
758
777
|
afterHooksStack = this.afterHooksStepsStack.get(test.id);
|
|
@@ -777,8 +796,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
777
796
|
value: suiteTitles.join(" > ")
|
|
778
797
|
});
|
|
779
798
|
}
|
|
780
|
-
if (
|
|
781
|
-
|
|
799
|
+
if (result.errors.length > 0) {
|
|
800
|
+
var details = result.errors.map(function (error) {
|
|
801
|
+
return (0, _utils.getStatusDetails)(error);
|
|
802
|
+
});
|
|
803
|
+
testResult.statusDetails = _objectSpread(_objectSpread({}, details[0]), {}, {
|
|
804
|
+
message: details.map(function (_ref3) {
|
|
805
|
+
var message = _ref3.message;
|
|
806
|
+
return message;
|
|
807
|
+
}).filter(Boolean).join("\n\n") || undefined,
|
|
808
|
+
trace: details.map(function (_ref4) {
|
|
809
|
+
var trace = _ref4.trace;
|
|
810
|
+
return trace;
|
|
811
|
+
}).filter(Boolean).join("\n\n") || undefined
|
|
812
|
+
});
|
|
782
813
|
} else {
|
|
783
814
|
var _test$annotations;
|
|
784
815
|
var skipReason = (_test$annotations = test.annotations) === null || _test$annotations === void 0 || (_test$annotations = _test$annotations.find(function (annotation) {
|
|
@@ -955,7 +986,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
955
986
|
testResult.labels = newLabels;
|
|
956
987
|
});
|
|
957
988
|
this.allureRuntime.stopTest(testUuid, {
|
|
958
|
-
|
|
989
|
+
stop: result.startTime.getTime() + result.duration
|
|
959
990
|
});
|
|
960
991
|
this.allureRuntime.writeTest(testUuid);
|
|
961
992
|
this.attachmentTargets["delete"](test.id);
|
|
@@ -974,10 +1005,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
974
1005
|
key: "emitGlobalErrorFromHookStep",
|
|
975
1006
|
value: function emitGlobalErrorFromHookStep(step) {
|
|
976
1007
|
var _details$message, _details$trace;
|
|
977
|
-
if (!step.error || !isGlobalErrorHookStep(step)) {
|
|
1008
|
+
if (!step.error || !isGlobalErrorHookStep(step) || (0, _utils.getSkipModifierError)(step.error)) {
|
|
978
1009
|
return;
|
|
979
1010
|
}
|
|
980
|
-
var details = (0,
|
|
1011
|
+
var details = (0, _utils.getStatusDetails)(step.error);
|
|
981
1012
|
var key = [step.title, step.startTime.getTime(), (_details$message = details.message) !== null && _details$message !== void 0 ? _details$message : "", (_details$trace = details.trace) !== null && _details$trace !== void 0 ? _details$trace : ""].join("\0");
|
|
982
1013
|
if (this.emittedHookGlobalErrorKeys.has(key)) {
|
|
983
1014
|
return;
|
|
@@ -994,7 +1025,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
994
1025
|
value: function () {
|
|
995
1026
|
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
996
1027
|
var _this3 = this;
|
|
997
|
-
var unprocessedCases, _iterator9, _step9, testCase, _t4;
|
|
1028
|
+
var unprocessedCases, _iterator9, _step9, testCase, result, _t4;
|
|
998
1029
|
return _regenerator().w(function (_context4) {
|
|
999
1030
|
while (1) switch (_context4.n) {
|
|
1000
1031
|
case 0:
|
|
@@ -1012,9 +1043,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1012
1043
|
break;
|
|
1013
1044
|
}
|
|
1014
1045
|
testCase = _step9.value;
|
|
1015
|
-
|
|
1016
|
-
_context4.n = 3;
|
|
1017
|
-
return this.onTestEnd(testCase, {
|
|
1046
|
+
result = {
|
|
1018
1047
|
status: _allureJsCommons.Status.SKIPPED,
|
|
1019
1048
|
attachments: [],
|
|
1020
1049
|
duration: 0,
|
|
@@ -1027,7 +1056,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1027
1056
|
stdout: [],
|
|
1028
1057
|
startTime: this.globalStartTime,
|
|
1029
1058
|
annotations: []
|
|
1030
|
-
}
|
|
1059
|
+
};
|
|
1060
|
+
this.onTestBegin(testCase, result);
|
|
1061
|
+
_context4.n = 3;
|
|
1062
|
+
return this.onTestEnd(testCase, result);
|
|
1031
1063
|
case 3:
|
|
1032
1064
|
_context4.n = 2;
|
|
1033
1065
|
break;
|
|
@@ -1122,11 +1154,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1122
1154
|
}, {
|
|
1123
1155
|
key: "getStaticTestMetadata",
|
|
1124
1156
|
value: function getStaticTestMetadata(test) {
|
|
1125
|
-
var
|
|
1157
|
+
var _ref5, _test$parent$project, _titleMetadata$labels;
|
|
1126
1158
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
1127
|
-
var project = (
|
|
1159
|
+
var project = (_ref5 = (_test$parent$project = test.parent.project()) !== null && _test$parent$project !== void 0 ? _test$parent$project : this.config.projects.find(function (candidate) {
|
|
1128
1160
|
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(_nodePath["default"].sep));
|
|
1129
|
-
})) !== null &&
|
|
1161
|
+
})) !== null && _ref5 !== void 0 ? _ref5 : this.config.projects[0];
|
|
1130
1162
|
var testFilePath = _nodePath["default"].relative(project.testDir, test.location.file);
|
|
1131
1163
|
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
1132
1164
|
var relativeFile = relativeFileParts.join("/");
|
|
@@ -1310,7 +1342,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1310
1342
|
return _context8.a(2);
|
|
1311
1343
|
case 8:
|
|
1312
1344
|
fileExists = /*#__PURE__*/function () {
|
|
1313
|
-
var
|
|
1345
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(filePath) {
|
|
1314
1346
|
return _regenerator().w(function (_context6) {
|
|
1315
1347
|
while (1) switch (_context6.n) {
|
|
1316
1348
|
case 0:
|
|
@@ -1326,11 +1358,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1326
1358
|
}, _callee6);
|
|
1327
1359
|
}));
|
|
1328
1360
|
return function fileExists(_x8) {
|
|
1329
|
-
return
|
|
1361
|
+
return _ref6.apply(this, arguments);
|
|
1330
1362
|
};
|
|
1331
1363
|
}();
|
|
1332
1364
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
1333
|
-
var
|
|
1365
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(modifier) {
|
|
1334
1366
|
var defaultPath, snapshotPath;
|
|
1335
1367
|
return _regenerator().w(function (_context7) {
|
|
1336
1368
|
while (1) switch (_context7.n) {
|
|
@@ -1366,7 +1398,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1366
1398
|
}, _callee7);
|
|
1367
1399
|
}));
|
|
1368
1400
|
return function readImageFromDirs(_x9) {
|
|
1369
|
-
return
|
|
1401
|
+
return _ref7.apply(this, arguments);
|
|
1370
1402
|
};
|
|
1371
1403
|
}();
|
|
1372
1404
|
_context8.n = 9;
|
|
@@ -1413,7 +1445,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1413
1445
|
* @deprecated for removal, import functions directly from "allure-js-commons".
|
|
1414
1446
|
*/
|
|
1415
1447
|
function _shouldIgnoreStep(step) {
|
|
1416
|
-
|
|
1448
|
+
var _this$options$reportM;
|
|
1449
|
+
var detail = step.category === "expect" ? (_this$options$reportM = this.options.reportMatchers) !== null && _this$options$reportM !== void 0 ? _this$options$reportM : this.options.detail : this.options.detail;
|
|
1450
|
+
if (!detail && !["test.step", "attach", "test.attach"].includes(step.category)) {
|
|
1417
1451
|
return true;
|
|
1418
1452
|
}
|
|
1419
1453
|
|
|
@@ -1428,6 +1462,14 @@ function _shouldIgnoreStep(step) {
|
|
|
1428
1462
|
}
|
|
1429
1463
|
return false;
|
|
1430
1464
|
}
|
|
1465
|
+
function _getReportedParentUuid(step) {
|
|
1466
|
+
for (var parent = step.parent; parent; parent = parent.parent) {
|
|
1467
|
+
var uuid = this.pwStepUuid.get(parent);
|
|
1468
|
+
if (uuid !== undefined) {
|
|
1469
|
+
return uuid;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1431
1473
|
function _getOrCreateHookStack(testId, isBeforeHook, startTime) {
|
|
1432
1474
|
var map = isBeforeHook ? this.beforeHooksStepsStack : this.afterHooksStepsStack;
|
|
1433
1475
|
var stack = map.get(testId);
|