allure-playwright 3.8.0 → 3.10.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/dist/cjs/index.js +139 -63
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +140 -64
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/legacy.d.ts +0 -2
- package/dist/types/model.d.ts +0 -2
- package/dist/types/playwrightInternals.d.ts +0 -2
- package/dist/types/runtime.d.ts +0 -2
- package/dist/types/utils.d.ts +2 -2
- package/package.json +9 -8
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
@@ -13,6 +12,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
13
12
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
13
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
14
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -26,6 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
26
26
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
27
27
|
import { existsSync } from "node:fs";
|
|
28
28
|
import { access } from "node:fs/promises";
|
|
29
|
+
import { createRequire } from "node:module";
|
|
29
30
|
import path from "node:path";
|
|
30
31
|
import process from "node:process";
|
|
31
32
|
|
|
@@ -33,9 +34,12 @@ import process from "node:process";
|
|
|
33
34
|
|
|
34
35
|
import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
|
|
35
36
|
import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
|
|
36
|
-
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
37
|
+
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
37
38
|
import { allurePlaywrightLegacyApi } from "./legacy.js";
|
|
38
39
|
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, finalizeStepResult, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
|
|
40
|
+
var localRequire = typeof require === "function" ? require : createRequire(import.meta.url);
|
|
41
|
+
var testPlanFilterSymbol = Symbol["for"]("allure-playwright.testPlanFilter");
|
|
42
|
+
var testPlanFilterPatchSymbol = Symbol["for"]("allure-playwright.testPlanFilterPatch");
|
|
39
43
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
40
44
|
export var AllureReporter = /*#__PURE__*/function () {
|
|
41
45
|
function AllureReporter(config) {
|
|
@@ -66,7 +70,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
66
70
|
return _createClass(AllureReporter, [{
|
|
67
71
|
key: "onConfigure",
|
|
68
72
|
value: function onConfigure(config) {
|
|
69
|
-
var
|
|
73
|
+
var _configElement$preOnl,
|
|
74
|
+
_this = this;
|
|
70
75
|
this.config = config;
|
|
71
76
|
this.outputDir = config.projects[0].outputDir;
|
|
72
77
|
this.snapshotDir = config.projects[0].snapshotDir;
|
|
@@ -74,13 +79,13 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
74
79
|
if (!testPlan) {
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
configElement.preOnlyTestFilters.push(function (test) {
|
|
82
|
+
this.installTestPlanExecutionFilter();
|
|
83
|
+
var configElement = Object.getOwnPropertySymbols(config).map(function (symbol) {
|
|
84
|
+
return config[symbol];
|
|
85
|
+
}).find(function (value) {
|
|
86
|
+
return _typeof(value) === "object" && value !== null && ("preOnlyTestFilters" in value || "cliArgs" in value);
|
|
87
|
+
});
|
|
88
|
+
configElement === null || configElement === void 0 || (_configElement$preOnl = configElement.preOnlyTestFilters) === null || _configElement$preOnl === void 0 || _configElement$preOnl.push(function (test) {
|
|
84
89
|
return _this.isInTestPlan(test);
|
|
85
90
|
});
|
|
86
91
|
if (testPlan.tests.some(function (test) {
|
|
@@ -128,7 +133,9 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
128
133
|
if (!cliArgs.length) {
|
|
129
134
|
return;
|
|
130
135
|
}
|
|
131
|
-
configElement
|
|
136
|
+
if (configElement) {
|
|
137
|
+
configElement.cliArgs = cliArgs;
|
|
138
|
+
}
|
|
132
139
|
}
|
|
133
140
|
}, {
|
|
134
141
|
key: "onError",
|
|
@@ -157,6 +164,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
157
164
|
value: function onTestBegin(test) {
|
|
158
165
|
var _metadata$relativeFil, _metadata$project, _metadata$project2;
|
|
159
166
|
var metadata = this.getStaticTestMetadata(test);
|
|
167
|
+
var titlePath = metadata.projectName ? [metadata.projectName].concat(_toConsumableArray(metadata.relativeFileParts), _toConsumableArray(metadata.suiteTitles)) : (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles));
|
|
160
168
|
var result = {
|
|
161
169
|
name: metadata.titleMetadata.cleanTitle,
|
|
162
170
|
labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray(getEnvironmentLabels())),
|
|
@@ -165,11 +173,12 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
165
173
|
steps: [],
|
|
166
174
|
testCaseId: md5(metadata.testCaseIdBase),
|
|
167
175
|
fullName: metadata.fullName,
|
|
168
|
-
titlePath:
|
|
176
|
+
titlePath: titlePath
|
|
169
177
|
};
|
|
170
178
|
result.labels.push(getLanguageLabel());
|
|
171
179
|
result.labels.push(getFrameworkLabel("playwright"));
|
|
172
|
-
result.labels.push(getPackageLabel(metadata.testFilePath));
|
|
180
|
+
result.labels.push(getPackageLabel(metadata.testFilePath, metadata.projectRootSearchFrom));
|
|
181
|
+
result.labels.push(getFallbackTestCaseIdLabel(md5(metadata.legacyTestCaseIdBase)));
|
|
173
182
|
result.labels.push({
|
|
174
183
|
name: "titlePath",
|
|
175
184
|
value: test.parent.titlePath().join(" > ")
|
|
@@ -509,13 +518,18 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
509
518
|
key: "onStepBegin",
|
|
510
519
|
value: function onStepBegin(test, _result, step) {
|
|
511
520
|
var _this$pwStepUuid$get2;
|
|
521
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
522
|
+
if (!testUuid) {
|
|
523
|
+
// eslint-disable-next-line no-console
|
|
524
|
+
console.warn("[allure-playwright] Ignoring onStepBegin for \"".concat(test.title, "\", step \"").concat(step.title, "\" (").concat(step.category, ") ") + "because no Allure test result has been started.");
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
512
527
|
var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
513
528
|
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
514
529
|
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
515
530
|
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
516
531
|
var isAfterHookDescendant = isAfterHookStep(step);
|
|
517
532
|
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
518
|
-
var testUuid = this.allureResultsUuids.get(test.id);
|
|
519
533
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
520
534
|
return;
|
|
521
535
|
}
|
|
@@ -581,6 +595,12 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
581
595
|
}, {
|
|
582
596
|
key: "onStepEnd",
|
|
583
597
|
value: function onStepEnd(test, _result, step) {
|
|
598
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
599
|
+
if (!testUuid) {
|
|
600
|
+
// eslint-disable-next-line no-console
|
|
601
|
+
console.warn("[allure-playwright] Ignoring onStepEnd for \"".concat(test.title, "\", step \"").concat(step.title, "\" (").concat(step.category, ") ") + "because no Allure test result has been started.");
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
584
604
|
var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
585
605
|
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
586
606
|
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
@@ -607,7 +627,6 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
607
627
|
this.processStepEndAttachments(test, step);
|
|
608
628
|
return;
|
|
609
629
|
}
|
|
610
|
-
var testUuid = this.allureResultsUuids.get(test.id);
|
|
611
630
|
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
612
631
|
var isAfterHookDescendant = isAfterHookStep(step);
|
|
613
632
|
var isAfterHook = isAfterHookDescendant;
|
|
@@ -652,7 +671,16 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
652
671
|
return _regenerator().w(function (_context2) {
|
|
653
672
|
while (1) switch (_context2.n) {
|
|
654
673
|
case 0:
|
|
655
|
-
testUuid = this.allureResultsUuids.get(test.id);
|
|
674
|
+
testUuid = this.allureResultsUuids.get(test.id);
|
|
675
|
+
if (testUuid) {
|
|
676
|
+
_context2.n = 1;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
// eslint-disable-next-line no-console
|
|
680
|
+
console.warn("[allure-playwright] Ignoring onTestEnd for \"".concat(test.title, "\" because no Allure test result has been started."));
|
|
681
|
+
return _context2.a(2);
|
|
682
|
+
case 1:
|
|
683
|
+
// We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
656
684
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
657
685
|
thread = "pid-".concat(process.pid, "-worker-").concat(threadId);
|
|
658
686
|
error = result.error; // only apply default suites if not set by user
|
|
@@ -731,24 +759,24 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
731
759
|
return target.shift();
|
|
732
760
|
};
|
|
733
761
|
_iterator5 = _createForOfIteratorHelper(result.attachments);
|
|
734
|
-
_context2.p =
|
|
762
|
+
_context2.p = 2;
|
|
735
763
|
_iterator5.s();
|
|
736
|
-
case
|
|
764
|
+
case 3:
|
|
737
765
|
if ((_step5 = _iterator5.n()).done) {
|
|
738
|
-
_context2.n =
|
|
766
|
+
_context2.n = 12;
|
|
739
767
|
break;
|
|
740
768
|
}
|
|
741
769
|
attachment = _step5.value;
|
|
742
770
|
isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
743
771
|
stepInfo = takeByName(attachment.name);
|
|
744
772
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
|
|
745
|
-
_context2.n =
|
|
773
|
+
_context2.n = 4;
|
|
746
774
|
break;
|
|
747
775
|
}
|
|
748
|
-
return _context2.a(3,
|
|
749
|
-
case
|
|
776
|
+
return _context2.a(3, 11);
|
|
777
|
+
case 4:
|
|
750
778
|
if (!isRuntimeMessage) {
|
|
751
|
-
_context2.n =
|
|
779
|
+
_context2.n = 7;
|
|
752
780
|
break;
|
|
753
781
|
}
|
|
754
782
|
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
@@ -757,7 +785,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
757
785
|
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
758
786
|
}
|
|
759
787
|
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
760
|
-
_context2.n =
|
|
788
|
+
_context2.n = 5;
|
|
761
789
|
break;
|
|
762
790
|
}
|
|
763
791
|
if (stepInfo.hookStep) {
|
|
@@ -766,16 +794,16 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
766
794
|
} else {
|
|
767
795
|
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
768
796
|
}
|
|
769
|
-
return _context2.a(3,
|
|
770
|
-
case
|
|
797
|
+
return _context2.a(3, 11);
|
|
798
|
+
case 5:
|
|
771
799
|
stepUuid = (_stepInfo$hookStep$uu2 = stepInfo === null || stepInfo === void 0 || (_stepInfo$hookStep2 = stepInfo.hookStep) === null || _stepInfo$hookStep2 === void 0 ? void 0 : _stepInfo$hookStep2.uuid) !== null && _stepInfo$hookStep$uu2 !== void 0 ? _stepInfo$hookStep$uu2 : stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid;
|
|
772
|
-
_context2.n =
|
|
800
|
+
_context2.n = 6;
|
|
773
801
|
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
774
|
-
case 5:
|
|
775
|
-
return _context2.a(3, 10);
|
|
776
802
|
case 6:
|
|
803
|
+
return _context2.a(3, 11);
|
|
804
|
+
case 7:
|
|
777
805
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
778
|
-
_context2.n =
|
|
806
|
+
_context2.n = 8;
|
|
779
807
|
break;
|
|
780
808
|
}
|
|
781
809
|
_targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
@@ -790,37 +818,37 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
790
818
|
});
|
|
791
819
|
}
|
|
792
820
|
}
|
|
793
|
-
return _context2.a(3,
|
|
794
|
-
case
|
|
821
|
+
return _context2.a(3, 11);
|
|
822
|
+
case 8:
|
|
795
823
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
796
|
-
_context2.n =
|
|
824
|
+
_context2.n = 10;
|
|
797
825
|
break;
|
|
798
826
|
}
|
|
799
|
-
_context2.n =
|
|
827
|
+
_context2.n = 9;
|
|
800
828
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
801
|
-
case 8:
|
|
802
|
-
return _context2.a(3, 10);
|
|
803
829
|
case 9:
|
|
804
|
-
_context2.
|
|
805
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
830
|
+
return _context2.a(3, 11);
|
|
806
831
|
case 10:
|
|
807
|
-
_context2.n =
|
|
808
|
-
|
|
832
|
+
_context2.n = 11;
|
|
833
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
809
834
|
case 11:
|
|
810
|
-
_context2.n =
|
|
835
|
+
_context2.n = 3;
|
|
811
836
|
break;
|
|
812
837
|
case 12:
|
|
813
|
-
_context2.
|
|
814
|
-
|
|
815
|
-
_iterator5.e(_t);
|
|
838
|
+
_context2.n = 14;
|
|
839
|
+
break;
|
|
816
840
|
case 13:
|
|
817
841
|
_context2.p = 13;
|
|
818
|
-
|
|
819
|
-
|
|
842
|
+
_t = _context2.v;
|
|
843
|
+
_iterator5.e(_t);
|
|
820
844
|
case 14:
|
|
821
|
-
_context2.
|
|
822
|
-
|
|
845
|
+
_context2.p = 14;
|
|
846
|
+
_iterator5.f();
|
|
847
|
+
return _context2.f(14);
|
|
823
848
|
case 15:
|
|
849
|
+
_context2.n = 16;
|
|
850
|
+
return this.flushAttachmentTasks(test.id);
|
|
851
|
+
case 16:
|
|
824
852
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
825
853
|
// in next iterations we need to implement the logic for every javascript integration
|
|
826
854
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
@@ -856,10 +884,10 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
856
884
|
this.allureRuntime.writeTest(testUuid);
|
|
857
885
|
this.attachmentTargets["delete"](test.id);
|
|
858
886
|
this.pendingAttachmentTasks["delete"](test.id);
|
|
859
|
-
case
|
|
887
|
+
case 17:
|
|
860
888
|
return _context2.a(2);
|
|
861
889
|
}
|
|
862
|
-
}, _callee2, this, [[
|
|
890
|
+
}, _callee2, this, [[2, 13, 14, 15]]);
|
|
863
891
|
}));
|
|
864
892
|
function onTestEnd(_x2, _x3) {
|
|
865
893
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -875,8 +903,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
875
903
|
return _regenerator().w(function (_context3) {
|
|
876
904
|
while (1) switch (_context3.n) {
|
|
877
905
|
case 0:
|
|
878
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
879
|
-
var title =
|
|
906
|
+
unprocessedCases = this.suite.allTests().filter(function (testCase) {
|
|
907
|
+
var title = testCase.title;
|
|
880
908
|
var titleMetadata = extractMetadataFromString(title);
|
|
881
909
|
return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
882
910
|
});
|
|
@@ -998,19 +1026,20 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
998
1026
|
}
|
|
999
1027
|
}, {
|
|
1000
1028
|
key: "getStaticTestMetadata",
|
|
1001
|
-
value: function getStaticTestMetadata(test) {
|
|
1002
|
-
var
|
|
1029
|
+
value: function getStaticTestMetadata(test, parentSuite) {
|
|
1030
|
+
var _ref2, _testParent$project, _testParent$titlePath, _titleMetadata$labels;
|
|
1003
1031
|
var titleMetadata = extractMetadataFromString(test.title);
|
|
1004
|
-
var
|
|
1032
|
+
var testParent = parentSuite !== null && parentSuite !== void 0 ? parentSuite : test.parent;
|
|
1033
|
+
var project = (_ref2 = (_testParent$project = testParent === null || testParent === void 0 ? void 0 : testParent.project()) !== null && _testParent$project !== void 0 ? _testParent$project : this.config.projects.find(function (candidate) {
|
|
1005
1034
|
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(path.sep));
|
|
1006
|
-
})) !== null &&
|
|
1035
|
+
})) !== null && _ref2 !== void 0 ? _ref2 : this.config.projects[0];
|
|
1007
1036
|
var testFilePath = path.relative(project.testDir, test.location.file);
|
|
1008
1037
|
var relativeFileParts = testFilePath.split(path.sep);
|
|
1009
1038
|
var relativeFile = relativeFileParts.join("/");
|
|
1010
1039
|
var normalizedAbsoluteFile = path.normalize(test.location.file);
|
|
1011
1040
|
var normalizedRelativeFile = path.normalize(testFilePath);
|
|
1012
1041
|
var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
|
|
1013
|
-
var suiteTitles =
|
|
1042
|
+
var suiteTitles = (_testParent$titlePath = testParent === null || testParent === void 0 ? void 0 : testParent.titlePath().filter(Boolean)) !== null && _testParent$titlePath !== void 0 ? _testParent$titlePath : [];
|
|
1014
1043
|
if (project.name && suiteTitles[0] === project.name) {
|
|
1015
1044
|
suiteTitles = suiteTitles.slice(1);
|
|
1016
1045
|
}
|
|
@@ -1018,6 +1047,9 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1018
1047
|
suiteTitles = suiteTitles.slice(1);
|
|
1019
1048
|
}
|
|
1020
1049
|
var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
1050
|
+
var projectRootSearchFrom = path.dirname(test.location.file);
|
|
1051
|
+
var projectName = getProjectName(projectRootSearchFrom);
|
|
1052
|
+
var testCaseIdBase = "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title);
|
|
1021
1053
|
var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
|
|
1022
1054
|
var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
|
|
1023
1055
|
return label.name === LabelName.ALLURE_ID;
|
|
@@ -1047,7 +1079,10 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1047
1079
|
testFilePath: testFilePath,
|
|
1048
1080
|
relativeFileParts: relativeFileParts,
|
|
1049
1081
|
suiteTitles: suiteTitles,
|
|
1050
|
-
|
|
1082
|
+
projectName: projectName,
|
|
1083
|
+
projectRootSearchFrom: projectRootSearchFrom,
|
|
1084
|
+
testCaseIdBase: projectName ? "".concat(projectName, ":").concat(testCaseIdBase) : testCaseIdBase,
|
|
1085
|
+
legacyTestCaseIdBase: testCaseIdBase,
|
|
1051
1086
|
titleMetadata: titleMetadata,
|
|
1052
1087
|
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
|
|
1053
1088
|
legacyFullName: legacyFullName,
|
|
@@ -1056,11 +1091,11 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1056
1091
|
}
|
|
1057
1092
|
}, {
|
|
1058
1093
|
key: "isInTestPlan",
|
|
1059
|
-
value: function isInTestPlan(test) {
|
|
1094
|
+
value: function isInTestPlan(test, parentSuite) {
|
|
1060
1095
|
if (!this.testPlan) {
|
|
1061
1096
|
return true;
|
|
1062
1097
|
}
|
|
1063
|
-
var _this$getStaticTestMe = this.getStaticTestMetadata(test),
|
|
1098
|
+
var _this$getStaticTestMe = this.getStaticTestMetadata(test, parentSuite),
|
|
1064
1099
|
fullName = _this$getStaticTestMe.fullName,
|
|
1065
1100
|
legacyFullName = _this$getStaticTestMe.legacyFullName,
|
|
1066
1101
|
staticAllureId = _this$getStaticTestMe.staticAllureId;
|
|
@@ -1072,6 +1107,47 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1072
1107
|
id: staticAllureId
|
|
1073
1108
|
});
|
|
1074
1109
|
}
|
|
1110
|
+
}, {
|
|
1111
|
+
key: "installTestPlanExecutionFilter",
|
|
1112
|
+
value: function installTestPlanExecutionFilter() {
|
|
1113
|
+
var _this7 = this;
|
|
1114
|
+
var suitePrototype = this.getPlaywrightSuitePrototype();
|
|
1115
|
+
if (!(suitePrototype !== null && suitePrototype !== void 0 && suitePrototype._addTest)) {
|
|
1116
|
+
// eslint-disable-next-line no-console
|
|
1117
|
+
console.warn("[allure-playwright] Could not install the test plan execution filter because Playwright " + "Suite.prototype._addTest was not found. Tests outside ALLURE_TESTPLAN_PATH may still run. " + "Please report this compatibility issue to https://github.com/allure-framework/allure-js/issues.");
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
var patchedSuitePrototype = suitePrototype;
|
|
1121
|
+
patchedSuitePrototype[testPlanFilterSymbol] = function (test, parentSuite) {
|
|
1122
|
+
return _this7.isInTestPlan(test, parentSuite);
|
|
1123
|
+
};
|
|
1124
|
+
if (patchedSuitePrototype[testPlanFilterPatchSymbol]) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
var addTest = suitePrototype._addTest;
|
|
1128
|
+
|
|
1129
|
+
// Dear Pavel: break us all day long you may; find the way back, my Codex and I always will.
|
|
1130
|
+
suitePrototype._addTest = function (test) {
|
|
1131
|
+
var testPlanFilter = patchedSuitePrototype[testPlanFilterSymbol];
|
|
1132
|
+
if (testPlanFilter && !testPlanFilter(test, this)) {
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
return addTest.call(this, test);
|
|
1136
|
+
};
|
|
1137
|
+
patchedSuitePrototype[testPlanFilterPatchSymbol] = true;
|
|
1138
|
+
}
|
|
1139
|
+
}, {
|
|
1140
|
+
key: "getPlaywrightSuitePrototype",
|
|
1141
|
+
value: function getPlaywrightSuitePrototype() {
|
|
1142
|
+
try {
|
|
1143
|
+
var _playwrightCommon$tes;
|
|
1144
|
+
var playwrightTestRequire = createRequire(localRequire.resolve("@playwright/test"));
|
|
1145
|
+
var playwrightCommon = playwrightTestRequire("playwright/lib/common");
|
|
1146
|
+
return (_playwrightCommon$tes = playwrightCommon.test) === null || _playwrightCommon$tes === void 0 || (_playwrightCommon$tes = _playwrightCommon$tes.Suite) === null || _playwrightCommon$tes === void 0 ? void 0 : _playwrightCommon$tes.prototype;
|
|
1147
|
+
} catch (_unused) {
|
|
1148
|
+
return undefined;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1075
1151
|
}, {
|
|
1076
1152
|
key: "processStepMetadataMessage",
|
|
1077
1153
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
@@ -1178,7 +1254,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1178
1254
|
return _context7.a(2);
|
|
1179
1255
|
case 8:
|
|
1180
1256
|
fileExists = /*#__PURE__*/function () {
|
|
1181
|
-
var
|
|
1257
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
|
|
1182
1258
|
return _regenerator().w(function (_context5) {
|
|
1183
1259
|
while (1) switch (_context5.n) {
|
|
1184
1260
|
case 0:
|
|
@@ -1194,11 +1270,11 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1194
1270
|
}, _callee5);
|
|
1195
1271
|
}));
|
|
1196
1272
|
return function fileExists(_x7) {
|
|
1197
|
-
return
|
|
1273
|
+
return _ref3.apply(this, arguments);
|
|
1198
1274
|
};
|
|
1199
1275
|
}();
|
|
1200
1276
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
1201
|
-
var
|
|
1277
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
|
|
1202
1278
|
var defaultPath, snapshotPath;
|
|
1203
1279
|
return _regenerator().w(function (_context6) {
|
|
1204
1280
|
while (1) switch (_context6.n) {
|
|
@@ -1234,7 +1310,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
1234
1310
|
}, _callee6);
|
|
1235
1311
|
}));
|
|
1236
1312
|
return function readImageFromDirs(_x8) {
|
|
1237
|
-
return
|
|
1313
|
+
return _ref4.apply(this, arguments);
|
|
1238
1314
|
};
|
|
1239
1315
|
}();
|
|
1240
1316
|
_context7.n = 9;
|