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/cjs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -19,6 +18,7 @@ Object.defineProperty(exports, "test", {
|
|
|
19
18
|
});
|
|
20
19
|
var _nodeFs = require("node:fs");
|
|
21
20
|
var _promises = require("node:fs/promises");
|
|
21
|
+
var _nodeModule = require("node:module");
|
|
22
22
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
23
23
|
var _nodeProcess = _interopRequireDefault(require("node:process"));
|
|
24
24
|
var _allureJsCommons = require("allure-js-commons");
|
|
@@ -42,6 +42,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
42
42
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
43
43
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
44
44
|
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; }
|
|
45
|
+
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); }
|
|
45
46
|
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; }
|
|
46
47
|
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; }
|
|
47
48
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -53,6 +54,9 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
53
54
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
54
55
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
55
56
|
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"); } /* eslint max-lines: off */
|
|
57
|
+
var localRequire = typeof require === "function" ? require : (0, _nodeModule.createRequire)(require('url').pathToFileURL(__filename).toString());
|
|
58
|
+
var testPlanFilterSymbol = Symbol["for"]("allure-playwright.testPlanFilter");
|
|
59
|
+
var testPlanFilterPatchSymbol = Symbol["for"]("allure-playwright.testPlanFilterPatch");
|
|
56
60
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
57
61
|
var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
58
62
|
function AllureReporter(config) {
|
|
@@ -83,7 +87,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
83
87
|
return _createClass(AllureReporter, [{
|
|
84
88
|
key: "onConfigure",
|
|
85
89
|
value: function onConfigure(config) {
|
|
86
|
-
var
|
|
90
|
+
var _configElement$preOnl,
|
|
91
|
+
_this = this;
|
|
87
92
|
this.config = config;
|
|
88
93
|
this.outputDir = config.projects[0].outputDir;
|
|
89
94
|
this.snapshotDir = config.projects[0].snapshotDir;
|
|
@@ -91,13 +96,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
91
96
|
if (!testPlan) {
|
|
92
97
|
return;
|
|
93
98
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
configElement.preOnlyTestFilters.push(function (test) {
|
|
99
|
+
this.installTestPlanExecutionFilter();
|
|
100
|
+
var configElement = Object.getOwnPropertySymbols(config).map(function (symbol) {
|
|
101
|
+
return config[symbol];
|
|
102
|
+
}).find(function (value) {
|
|
103
|
+
return _typeof(value) === "object" && value !== null && ("preOnlyTestFilters" in value || "cliArgs" in value);
|
|
104
|
+
});
|
|
105
|
+
configElement === null || configElement === void 0 || (_configElement$preOnl = configElement.preOnlyTestFilters) === null || _configElement$preOnl === void 0 || _configElement$preOnl.push(function (test) {
|
|
101
106
|
return _this.isInTestPlan(test);
|
|
102
107
|
});
|
|
103
108
|
if (testPlan.tests.some(function (test) {
|
|
@@ -145,7 +150,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
145
150
|
if (!cliArgs.length) {
|
|
146
151
|
return;
|
|
147
152
|
}
|
|
148
|
-
configElement
|
|
153
|
+
if (configElement) {
|
|
154
|
+
configElement.cliArgs = cliArgs;
|
|
155
|
+
}
|
|
149
156
|
}
|
|
150
157
|
}, {
|
|
151
158
|
key: "onError",
|
|
@@ -174,6 +181,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
174
181
|
value: function onTestBegin(test) {
|
|
175
182
|
var _metadata$relativeFil, _metadata$project, _metadata$project2;
|
|
176
183
|
var metadata = this.getStaticTestMetadata(test);
|
|
184
|
+
var titlePath = metadata.projectName ? [metadata.projectName].concat(_toConsumableArray(metadata.relativeFileParts), _toConsumableArray(metadata.suiteTitles)) : (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles));
|
|
177
185
|
var result = {
|
|
178
186
|
name: metadata.titleMetadata.cleanTitle,
|
|
179
187
|
labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
@@ -182,11 +190,12 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
182
190
|
steps: [],
|
|
183
191
|
testCaseId: (0, _reporter.md5)(metadata.testCaseIdBase),
|
|
184
192
|
fullName: metadata.fullName,
|
|
185
|
-
titlePath:
|
|
193
|
+
titlePath: titlePath
|
|
186
194
|
};
|
|
187
195
|
result.labels.push((0, _reporter.getLanguageLabel)());
|
|
188
196
|
result.labels.push((0, _reporter.getFrameworkLabel)("playwright"));
|
|
189
|
-
result.labels.push((0, _reporter.getPackageLabel)(metadata.testFilePath));
|
|
197
|
+
result.labels.push((0, _reporter.getPackageLabel)(metadata.testFilePath, metadata.projectRootSearchFrom));
|
|
198
|
+
result.labels.push((0, _reporter.getFallbackTestCaseIdLabel)((0, _reporter.md5)(metadata.legacyTestCaseIdBase)));
|
|
190
199
|
result.labels.push({
|
|
191
200
|
name: "titlePath",
|
|
192
201
|
value: test.parent.titlePath().join(" > ")
|
|
@@ -526,13 +535,18 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
526
535
|
key: "onStepBegin",
|
|
527
536
|
value: function onStepBegin(test, _result, step) {
|
|
528
537
|
var _this$pwStepUuid$get2;
|
|
538
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
539
|
+
if (!testUuid) {
|
|
540
|
+
// eslint-disable-next-line no-console
|
|
541
|
+
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.");
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
529
544
|
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
530
545
|
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
531
546
|
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
532
547
|
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
533
548
|
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
534
549
|
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
535
|
-
var testUuid = this.allureResultsUuids.get(test.id);
|
|
536
550
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
537
551
|
return;
|
|
538
552
|
}
|
|
@@ -598,6 +612,12 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
598
612
|
}, {
|
|
599
613
|
key: "onStepEnd",
|
|
600
614
|
value: function onStepEnd(test, _result, step) {
|
|
615
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
616
|
+
if (!testUuid) {
|
|
617
|
+
// eslint-disable-next-line no-console
|
|
618
|
+
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.");
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
601
621
|
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
602
622
|
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
603
623
|
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
@@ -624,7 +644,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
624
644
|
this.processStepEndAttachments(test, step);
|
|
625
645
|
return;
|
|
626
646
|
}
|
|
627
|
-
var testUuid = this.allureResultsUuids.get(test.id);
|
|
628
647
|
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
629
648
|
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
630
649
|
var isAfterHook = isAfterHookDescendant;
|
|
@@ -669,7 +688,16 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
669
688
|
return _regenerator().w(function (_context2) {
|
|
670
689
|
while (1) switch (_context2.n) {
|
|
671
690
|
case 0:
|
|
672
|
-
testUuid = this.allureResultsUuids.get(test.id);
|
|
691
|
+
testUuid = this.allureResultsUuids.get(test.id);
|
|
692
|
+
if (testUuid) {
|
|
693
|
+
_context2.n = 1;
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
// eslint-disable-next-line no-console
|
|
697
|
+
console.warn("[allure-playwright] Ignoring onTestEnd for \"".concat(test.title, "\" because no Allure test result has been started."));
|
|
698
|
+
return _context2.a(2);
|
|
699
|
+
case 1:
|
|
700
|
+
// We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
673
701
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
674
702
|
thread = "pid-".concat(_nodeProcess["default"].pid, "-worker-").concat(threadId);
|
|
675
703
|
error = result.error; // only apply default suites if not set by user
|
|
@@ -748,24 +776,24 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
748
776
|
return target.shift();
|
|
749
777
|
};
|
|
750
778
|
_iterator5 = _createForOfIteratorHelper(result.attachments);
|
|
751
|
-
_context2.p =
|
|
779
|
+
_context2.p = 2;
|
|
752
780
|
_iterator5.s();
|
|
753
|
-
case
|
|
781
|
+
case 3:
|
|
754
782
|
if ((_step5 = _iterator5.n()).done) {
|
|
755
|
-
_context2.n =
|
|
783
|
+
_context2.n = 12;
|
|
756
784
|
break;
|
|
757
785
|
}
|
|
758
786
|
attachment = _step5.value;
|
|
759
787
|
isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
760
788
|
stepInfo = takeByName(attachment.name);
|
|
761
789
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
|
|
762
|
-
_context2.n =
|
|
790
|
+
_context2.n = 4;
|
|
763
791
|
break;
|
|
764
792
|
}
|
|
765
|
-
return _context2.a(3,
|
|
766
|
-
case
|
|
793
|
+
return _context2.a(3, 11);
|
|
794
|
+
case 4:
|
|
767
795
|
if (!isRuntimeMessage) {
|
|
768
|
-
_context2.n =
|
|
796
|
+
_context2.n = 7;
|
|
769
797
|
break;
|
|
770
798
|
}
|
|
771
799
|
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
@@ -774,7 +802,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
774
802
|
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
775
803
|
}
|
|
776
804
|
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
777
|
-
_context2.n =
|
|
805
|
+
_context2.n = 5;
|
|
778
806
|
break;
|
|
779
807
|
}
|
|
780
808
|
if (stepInfo.hookStep) {
|
|
@@ -783,16 +811,16 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
783
811
|
} else {
|
|
784
812
|
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
785
813
|
}
|
|
786
|
-
return _context2.a(3,
|
|
787
|
-
case
|
|
814
|
+
return _context2.a(3, 11);
|
|
815
|
+
case 5:
|
|
788
816
|
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;
|
|
789
|
-
_context2.n =
|
|
817
|
+
_context2.n = 6;
|
|
790
818
|
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
791
|
-
case 5:
|
|
792
|
-
return _context2.a(3, 10);
|
|
793
819
|
case 6:
|
|
820
|
+
return _context2.a(3, 11);
|
|
821
|
+
case 7:
|
|
794
822
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
795
|
-
_context2.n =
|
|
823
|
+
_context2.n = 8;
|
|
796
824
|
break;
|
|
797
825
|
}
|
|
798
826
|
_targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
@@ -807,37 +835,37 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
807
835
|
});
|
|
808
836
|
}
|
|
809
837
|
}
|
|
810
|
-
return _context2.a(3,
|
|
811
|
-
case
|
|
838
|
+
return _context2.a(3, 11);
|
|
839
|
+
case 8:
|
|
812
840
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
813
|
-
_context2.n =
|
|
841
|
+
_context2.n = 10;
|
|
814
842
|
break;
|
|
815
843
|
}
|
|
816
|
-
_context2.n =
|
|
844
|
+
_context2.n = 9;
|
|
817
845
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
818
|
-
case 8:
|
|
819
|
-
return _context2.a(3, 10);
|
|
820
846
|
case 9:
|
|
821
|
-
_context2.
|
|
822
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
847
|
+
return _context2.a(3, 11);
|
|
823
848
|
case 10:
|
|
824
|
-
_context2.n =
|
|
825
|
-
|
|
849
|
+
_context2.n = 11;
|
|
850
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
826
851
|
case 11:
|
|
827
|
-
_context2.n =
|
|
852
|
+
_context2.n = 3;
|
|
828
853
|
break;
|
|
829
854
|
case 12:
|
|
830
|
-
_context2.
|
|
831
|
-
|
|
832
|
-
_iterator5.e(_t);
|
|
855
|
+
_context2.n = 14;
|
|
856
|
+
break;
|
|
833
857
|
case 13:
|
|
834
858
|
_context2.p = 13;
|
|
835
|
-
|
|
836
|
-
|
|
859
|
+
_t = _context2.v;
|
|
860
|
+
_iterator5.e(_t);
|
|
837
861
|
case 14:
|
|
838
|
-
_context2.
|
|
839
|
-
|
|
862
|
+
_context2.p = 14;
|
|
863
|
+
_iterator5.f();
|
|
864
|
+
return _context2.f(14);
|
|
840
865
|
case 15:
|
|
866
|
+
_context2.n = 16;
|
|
867
|
+
return this.flushAttachmentTasks(test.id);
|
|
868
|
+
case 16:
|
|
841
869
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
842
870
|
// in next iterations we need to implement the logic for every javascript integration
|
|
843
871
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
@@ -873,10 +901,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
873
901
|
this.allureRuntime.writeTest(testUuid);
|
|
874
902
|
this.attachmentTargets["delete"](test.id);
|
|
875
903
|
this.pendingAttachmentTasks["delete"](test.id);
|
|
876
|
-
case
|
|
904
|
+
case 17:
|
|
877
905
|
return _context2.a(2);
|
|
878
906
|
}
|
|
879
|
-
}, _callee2, this, [[
|
|
907
|
+
}, _callee2, this, [[2, 13, 14, 15]]);
|
|
880
908
|
}));
|
|
881
909
|
function onTestEnd(_x2, _x3) {
|
|
882
910
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -892,8 +920,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
892
920
|
return _regenerator().w(function (_context3) {
|
|
893
921
|
while (1) switch (_context3.n) {
|
|
894
922
|
case 0:
|
|
895
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
896
|
-
var title =
|
|
923
|
+
unprocessedCases = this.suite.allTests().filter(function (testCase) {
|
|
924
|
+
var title = testCase.title;
|
|
897
925
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
898
926
|
return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
899
927
|
});
|
|
@@ -1015,19 +1043,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1015
1043
|
}
|
|
1016
1044
|
}, {
|
|
1017
1045
|
key: "getStaticTestMetadata",
|
|
1018
|
-
value: function getStaticTestMetadata(test) {
|
|
1019
|
-
var
|
|
1046
|
+
value: function getStaticTestMetadata(test, parentSuite) {
|
|
1047
|
+
var _ref2, _testParent$project, _testParent$titlePath, _titleMetadata$labels;
|
|
1020
1048
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
1021
|
-
var
|
|
1049
|
+
var testParent = parentSuite !== null && parentSuite !== void 0 ? parentSuite : test.parent;
|
|
1050
|
+
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) {
|
|
1022
1051
|
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(_nodePath["default"].sep));
|
|
1023
|
-
})) !== null &&
|
|
1052
|
+
})) !== null && _ref2 !== void 0 ? _ref2 : this.config.projects[0];
|
|
1024
1053
|
var testFilePath = _nodePath["default"].relative(project.testDir, test.location.file);
|
|
1025
1054
|
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
1026
1055
|
var relativeFile = relativeFileParts.join("/");
|
|
1027
1056
|
var normalizedAbsoluteFile = _nodePath["default"].normalize(test.location.file);
|
|
1028
1057
|
var normalizedRelativeFile = _nodePath["default"].normalize(testFilePath);
|
|
1029
1058
|
var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
|
|
1030
|
-
var suiteTitles =
|
|
1059
|
+
var suiteTitles = (_testParent$titlePath = testParent === null || testParent === void 0 ? void 0 : testParent.titlePath().filter(Boolean)) !== null && _testParent$titlePath !== void 0 ? _testParent$titlePath : [];
|
|
1031
1060
|
if (project.name && suiteTitles[0] === project.name) {
|
|
1032
1061
|
suiteTitles = suiteTitles.slice(1);
|
|
1033
1062
|
}
|
|
@@ -1035,6 +1064,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1035
1064
|
suiteTitles = suiteTitles.slice(1);
|
|
1036
1065
|
}
|
|
1037
1066
|
var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
1067
|
+
var projectRootSearchFrom = _nodePath["default"].dirname(test.location.file);
|
|
1068
|
+
var projectName = (0, _reporter.getProjectName)(projectRootSearchFrom);
|
|
1069
|
+
var testCaseIdBase = "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title);
|
|
1038
1070
|
var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
|
|
1039
1071
|
var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
|
|
1040
1072
|
return label.name === _allureJsCommons.LabelName.ALLURE_ID;
|
|
@@ -1064,7 +1096,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1064
1096
|
testFilePath: testFilePath,
|
|
1065
1097
|
relativeFileParts: relativeFileParts,
|
|
1066
1098
|
suiteTitles: suiteTitles,
|
|
1067
|
-
|
|
1099
|
+
projectName: projectName,
|
|
1100
|
+
projectRootSearchFrom: projectRootSearchFrom,
|
|
1101
|
+
testCaseIdBase: projectName ? "".concat(projectName, ":").concat(testCaseIdBase) : testCaseIdBase,
|
|
1102
|
+
legacyTestCaseIdBase: testCaseIdBase,
|
|
1068
1103
|
titleMetadata: titleMetadata,
|
|
1069
1104
|
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
|
|
1070
1105
|
legacyFullName: legacyFullName,
|
|
@@ -1073,11 +1108,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1073
1108
|
}
|
|
1074
1109
|
}, {
|
|
1075
1110
|
key: "isInTestPlan",
|
|
1076
|
-
value: function isInTestPlan(test) {
|
|
1111
|
+
value: function isInTestPlan(test, parentSuite) {
|
|
1077
1112
|
if (!this.testPlan) {
|
|
1078
1113
|
return true;
|
|
1079
1114
|
}
|
|
1080
|
-
var _this$getStaticTestMe = this.getStaticTestMetadata(test),
|
|
1115
|
+
var _this$getStaticTestMe = this.getStaticTestMetadata(test, parentSuite),
|
|
1081
1116
|
fullName = _this$getStaticTestMe.fullName,
|
|
1082
1117
|
legacyFullName = _this$getStaticTestMe.legacyFullName,
|
|
1083
1118
|
staticAllureId = _this$getStaticTestMe.staticAllureId;
|
|
@@ -1089,6 +1124,47 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1089
1124
|
id: staticAllureId
|
|
1090
1125
|
});
|
|
1091
1126
|
}
|
|
1127
|
+
}, {
|
|
1128
|
+
key: "installTestPlanExecutionFilter",
|
|
1129
|
+
value: function installTestPlanExecutionFilter() {
|
|
1130
|
+
var _this7 = this;
|
|
1131
|
+
var suitePrototype = this.getPlaywrightSuitePrototype();
|
|
1132
|
+
if (!(suitePrototype !== null && suitePrototype !== void 0 && suitePrototype._addTest)) {
|
|
1133
|
+
// eslint-disable-next-line no-console
|
|
1134
|
+
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.");
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
var patchedSuitePrototype = suitePrototype;
|
|
1138
|
+
patchedSuitePrototype[testPlanFilterSymbol] = function (test, parentSuite) {
|
|
1139
|
+
return _this7.isInTestPlan(test, parentSuite);
|
|
1140
|
+
};
|
|
1141
|
+
if (patchedSuitePrototype[testPlanFilterPatchSymbol]) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
var addTest = suitePrototype._addTest;
|
|
1145
|
+
|
|
1146
|
+
// Dear Pavel: break us all day long you may; find the way back, my Codex and I always will.
|
|
1147
|
+
suitePrototype._addTest = function (test) {
|
|
1148
|
+
var testPlanFilter = patchedSuitePrototype[testPlanFilterSymbol];
|
|
1149
|
+
if (testPlanFilter && !testPlanFilter(test, this)) {
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
return addTest.call(this, test);
|
|
1153
|
+
};
|
|
1154
|
+
patchedSuitePrototype[testPlanFilterPatchSymbol] = true;
|
|
1155
|
+
}
|
|
1156
|
+
}, {
|
|
1157
|
+
key: "getPlaywrightSuitePrototype",
|
|
1158
|
+
value: function getPlaywrightSuitePrototype() {
|
|
1159
|
+
try {
|
|
1160
|
+
var _playwrightCommon$tes;
|
|
1161
|
+
var playwrightTestRequire = (0, _nodeModule.createRequire)(localRequire.resolve("@playwright/test"));
|
|
1162
|
+
var playwrightCommon = playwrightTestRequire("playwright/lib/common");
|
|
1163
|
+
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;
|
|
1164
|
+
} catch (_unused) {
|
|
1165
|
+
return undefined;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1092
1168
|
}, {
|
|
1093
1169
|
key: "processStepMetadataMessage",
|
|
1094
1170
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
@@ -1195,7 +1271,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1195
1271
|
return _context7.a(2);
|
|
1196
1272
|
case 8:
|
|
1197
1273
|
fileExists = /*#__PURE__*/function () {
|
|
1198
|
-
var
|
|
1274
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
|
|
1199
1275
|
return _regenerator().w(function (_context5) {
|
|
1200
1276
|
while (1) switch (_context5.n) {
|
|
1201
1277
|
case 0:
|
|
@@ -1211,11 +1287,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1211
1287
|
}, _callee5);
|
|
1212
1288
|
}));
|
|
1213
1289
|
return function fileExists(_x7) {
|
|
1214
|
-
return
|
|
1290
|
+
return _ref3.apply(this, arguments);
|
|
1215
1291
|
};
|
|
1216
1292
|
}();
|
|
1217
1293
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
1218
|
-
var
|
|
1294
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
|
|
1219
1295
|
var defaultPath, snapshotPath;
|
|
1220
1296
|
return _regenerator().w(function (_context6) {
|
|
1221
1297
|
while (1) switch (_context6.n) {
|
|
@@ -1251,7 +1327,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1251
1327
|
}, _callee6);
|
|
1252
1328
|
}));
|
|
1253
1329
|
return function readImageFromDirs(_x8) {
|
|
1254
|
-
return
|
|
1330
|
+
return _ref4.apply(this, arguments);
|
|
1255
1331
|
};
|
|
1256
1332
|
}();
|
|
1257
1333
|
_context7.n = 9;
|