allure-playwright 3.10.2 → 3.11.1
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 +13 -0
- package/dist/cjs/index.js +62 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/esm/index.js +61 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/model.d.ts +1 -0
- package/package.json +6 -6
package/dist/esm/index.js
CHANGED
|
@@ -61,6 +61,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
61
61
|
_defineProperty(this, "pendingAttachmentTasks", new Map());
|
|
62
62
|
_defineProperty(this, "attachmentTargetByStep", new WeakMap());
|
|
63
63
|
_defineProperty(this, "pwStepUuid", new WeakMap());
|
|
64
|
+
_defineProperty(this, "emittedHookGlobalErrorKeys", new Set());
|
|
64
65
|
_defineProperty(this, "testPlan", parseTestPlan());
|
|
65
66
|
this.options = _objectSpread({
|
|
66
67
|
suiteTitle: true,
|
|
@@ -153,6 +154,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
153
154
|
key: "onBegin",
|
|
154
155
|
value: function onBegin(suite) {
|
|
155
156
|
this.suite = suite;
|
|
157
|
+
this.emittedHookGlobalErrorKeys.clear();
|
|
156
158
|
this.allureRuntime = new ReporterRuntime(_objectSpread(_objectSpread({}, this.options), {}, {
|
|
157
159
|
writer: createDefaultWriter({
|
|
158
160
|
resultsDir: this.options.resultsDir
|
|
@@ -172,7 +174,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
172
174
|
parameters: [],
|
|
173
175
|
steps: [],
|
|
174
176
|
testCaseId: md5(metadata.testCaseIdBase),
|
|
175
|
-
fullName: metadata.fullName,
|
|
177
|
+
fullName: this.options.useLegacyFullName ? metadata.legacyFullName : metadata.fullName,
|
|
176
178
|
titlePath: titlePath
|
|
177
179
|
};
|
|
178
180
|
result.labels.push(getLanguageLabel());
|
|
@@ -611,6 +613,10 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
611
613
|
|
|
612
614
|
// If stack exists (was lazily created), finalize the root hook step
|
|
613
615
|
if (stack) {
|
|
616
|
+
var rootStep = stack.currentStep();
|
|
617
|
+
if (step.error && rootStep && !rootStep.steps.length) {
|
|
618
|
+
this.emitGlobalErrorFromHookStep(step);
|
|
619
|
+
}
|
|
614
620
|
stack.updateStep(function (stepResult) {
|
|
615
621
|
return finalizeStepResult(stepResult, step);
|
|
616
622
|
});
|
|
@@ -638,6 +644,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
638
644
|
if (!_stack3) {
|
|
639
645
|
return;
|
|
640
646
|
}
|
|
647
|
+
this.emitGlobalErrorFromHookStep(step);
|
|
641
648
|
_stack3.updateStep(function (stepResult) {
|
|
642
649
|
return finalizeStepResult(stepResult, step);
|
|
643
650
|
});
|
|
@@ -722,6 +729,13 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
722
729
|
}
|
|
723
730
|
}
|
|
724
731
|
testResult.status = statusToAllureStats(result.status, test.expectedStatus);
|
|
732
|
+
if (result.retry > 0) {
|
|
733
|
+
testResult.parameters.push({
|
|
734
|
+
name: "Retry",
|
|
735
|
+
value: String(result.retry),
|
|
736
|
+
excluded: true
|
|
737
|
+
});
|
|
738
|
+
}
|
|
725
739
|
testResult.stage = Stage.FINISHED;
|
|
726
740
|
});
|
|
727
741
|
if (result.stdout.length > 0) {
|
|
@@ -894,6 +908,21 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
894
908
|
}
|
|
895
909
|
return onTestEnd;
|
|
896
910
|
}()
|
|
911
|
+
}, {
|
|
912
|
+
key: "emitGlobalErrorFromHookStep",
|
|
913
|
+
value: function emitGlobalErrorFromHookStep(step) {
|
|
914
|
+
var _details$message, _details$trace;
|
|
915
|
+
if (!step.error || !isGlobalErrorHookStep(step)) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
var details = getMessageAndTraceFromError(step.error);
|
|
919
|
+
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");
|
|
920
|
+
if (this.emittedHookGlobalErrorKeys.has(key)) {
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
this.emittedHookGlobalErrorKeys.add(key);
|
|
924
|
+
this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage(normalizeHookTitle(step.title), details)]);
|
|
925
|
+
}
|
|
897
926
|
}, {
|
|
898
927
|
key: "addSkippedResults",
|
|
899
928
|
value: function () {
|
|
@@ -1139,12 +1168,23 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1139
1168
|
}, {
|
|
1140
1169
|
key: "getPlaywrightSuitePrototype",
|
|
1141
1170
|
value: function getPlaywrightSuitePrototype() {
|
|
1171
|
+
var playwrightTestRequire = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createRequire(localRequire.resolve("@playwright/test"));
|
|
1142
1172
|
try {
|
|
1143
1173
|
var _playwrightCommon$tes;
|
|
1144
|
-
var playwrightTestRequire = createRequire(localRequire.resolve("@playwright/test"));
|
|
1145
1174
|
var playwrightCommon = playwrightTestRequire("playwright/lib/common");
|
|
1146
|
-
|
|
1175
|
+
var suitePrototype = (_playwrightCommon$tes = playwrightCommon.test) === null || _playwrightCommon$tes === void 0 || (_playwrightCommon$tes = _playwrightCommon$tes.Suite) === null || _playwrightCommon$tes === void 0 ? void 0 : _playwrightCommon$tes.prototype;
|
|
1176
|
+
if (suitePrototype) {
|
|
1177
|
+
return suitePrototype;
|
|
1178
|
+
}
|
|
1147
1179
|
} catch (_unused) {
|
|
1180
|
+
// Playwright 1.53-1.59 didn't export playwright/lib/common, but the Suite lived in lib/common/test.js.
|
|
1181
|
+
}
|
|
1182
|
+
try {
|
|
1183
|
+
var _playwrightCommonTest;
|
|
1184
|
+
var playwrightPackagePath = playwrightTestRequire.resolve("playwright/package.json");
|
|
1185
|
+
var playwrightCommonTest = playwrightTestRequire(path.join(path.dirname(playwrightPackagePath), "lib/common/test.js"));
|
|
1186
|
+
return (_playwrightCommonTest = playwrightCommonTest.Suite) === null || _playwrightCommonTest === void 0 ? void 0 : _playwrightCommonTest.prototype;
|
|
1187
|
+
} catch (_unused2) {
|
|
1148
1188
|
return undefined;
|
|
1149
1189
|
}
|
|
1150
1190
|
}
|
|
@@ -1395,5 +1435,23 @@ export var allure = allurePlaywrightLegacyApi;
|
|
|
1395
1435
|
* @deprecated for removal, import functions directly from "@playwright/test".
|
|
1396
1436
|
*/
|
|
1397
1437
|
export { test, expect } from "@playwright/test";
|
|
1438
|
+
var toGlobalErrorMessage = function toGlobalErrorMessage(name, details) {
|
|
1439
|
+
return {
|
|
1440
|
+
type: "global_error",
|
|
1441
|
+
data: _objectSpread(_objectSpread({}, details), {}, {
|
|
1442
|
+
message: details.message ? "".concat(name, " failed: ").concat(details.message) : "".concat(name, " failed")
|
|
1443
|
+
})
|
|
1444
|
+
};
|
|
1445
|
+
};
|
|
1446
|
+
var isDirectHookStep = function isDirectHookStep(step) {
|
|
1447
|
+
var _step$parent, _step$parent2;
|
|
1448
|
+
return (((_step$parent = step.parent) === null || _step$parent === void 0 ? void 0 : _step$parent.title) === BEFORE_HOOKS_ROOT_STEP_TITLE || ((_step$parent2 = step.parent) === null || _step$parent2 === void 0 ? void 0 : _step$parent2.title) === AFTER_HOOKS_ROOT_STEP_TITLE) && step.category === "hook";
|
|
1449
|
+
};
|
|
1450
|
+
var isRootHookStep = function isRootHookStep(step) {
|
|
1451
|
+
return step.title === BEFORE_HOOKS_ROOT_STEP_TITLE || step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
1452
|
+
};
|
|
1453
|
+
var isGlobalErrorHookStep = function isGlobalErrorHookStep(step) {
|
|
1454
|
+
return isRootHookStep(step) || isDirectHookStep(step);
|
|
1455
|
+
};
|
|
1398
1456
|
export default AllureReporter;
|
|
1399
1457
|
//# sourceMappingURL=index.js.map
|