allure-playwright 3.7.0 → 3.7.2
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 +258 -162
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.js +49 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +260 -164
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils.js +49 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/utils.d.ts +11 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
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
2
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
3
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
6
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
7
4
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
8
5
|
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."); }
|
|
9
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
10
10
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
11
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
12
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -33,9 +33,9 @@ import process from "node:process";
|
|
|
33
33
|
|
|
34
34
|
import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
|
|
35
35
|
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, getLanguageLabel, getPackageLabel, getThreadLabel,
|
|
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
37
|
import { allurePlaywrightLegacyApi } from "./legacy.js";
|
|
38
|
-
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
|
|
38
|
+
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, finalizeStepResult, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
|
|
39
39
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
40
40
|
export var AllureReporter = /*#__PURE__*/function () {
|
|
41
41
|
function AllureReporter(config) {
|
|
@@ -54,9 +54,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
54
54
|
_defineProperty(this, "attachmentTargets", new Map());
|
|
55
55
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
56
56
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
57
|
-
_defineProperty(this, "beforeHooksAttachmentsStack", new Map());
|
|
58
|
-
_defineProperty(this, "afterHooksAttachmentsStack", new Map());
|
|
59
57
|
_defineProperty(this, "pwStepUuid", new WeakMap());
|
|
58
|
+
_defineProperty(this, "testPlan", parseTestPlan());
|
|
60
59
|
this.options = _objectSpread({
|
|
61
60
|
suiteTitle: true,
|
|
62
61
|
detail: true
|
|
@@ -65,10 +64,11 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
65
64
|
return _createClass(AllureReporter, [{
|
|
66
65
|
key: "onConfigure",
|
|
67
66
|
value: function onConfigure(config) {
|
|
67
|
+
var _this = this;
|
|
68
68
|
this.config = config;
|
|
69
69
|
this.outputDir = config.projects[0].outputDir;
|
|
70
70
|
this.snapshotDir = config.projects[0].snapshotDir;
|
|
71
|
-
var testPlan =
|
|
71
|
+
var testPlan = this.testPlan;
|
|
72
72
|
if (!testPlan) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -78,6 +78,14 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
78
78
|
if (!configElement) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
+
configElement.preOnlyTestFilters.push(function (test) {
|
|
82
|
+
return _this.isInTestPlan(test);
|
|
83
|
+
});
|
|
84
|
+
if (testPlan.tests.some(function (test) {
|
|
85
|
+
return test.id !== undefined;
|
|
86
|
+
})) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
81
89
|
var testsWithSelectors = testPlan.tests.filter(function (test) {
|
|
82
90
|
return test.selector;
|
|
83
91
|
});
|
|
@@ -145,34 +153,24 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
145
153
|
}, {
|
|
146
154
|
key: "onTestBegin",
|
|
147
155
|
value: function onTestBegin(test) {
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
var project = suite.project();
|
|
151
|
-
var testFilePath = path.relative(project === null || project === void 0 ? void 0 : project.testDir, test.location.file);
|
|
152
|
-
var relativeFileParts = testFilePath.split(path.sep);
|
|
153
|
-
var relativeFile = relativeFileParts.join("/");
|
|
154
|
-
// root > project > file path > test.describe...
|
|
155
|
-
var _suite$titlePath = suite.titlePath(),
|
|
156
|
-
_suite$titlePath2 = _toArray(_suite$titlePath),
|
|
157
|
-
suiteTitles = _suite$titlePath2.slice(3);
|
|
158
|
-
var nameSuites = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
159
|
-
var testCaseIdBase = "".concat(relativeFile, "#").concat(nameSuites).concat(test.title);
|
|
156
|
+
var _metadata$relativeFil, _metadata$project, _metadata$project2;
|
|
157
|
+
var metadata = this.getStaticTestMetadata(test);
|
|
160
158
|
var result = {
|
|
161
|
-
name: titleMetadata.cleanTitle,
|
|
162
|
-
labels: [].concat(_toConsumableArray(titleMetadata.labels), _toConsumableArray(getEnvironmentLabels())),
|
|
163
|
-
links: _toConsumableArray(titleMetadata.links),
|
|
159
|
+
name: metadata.titleMetadata.cleanTitle,
|
|
160
|
+
labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray(getEnvironmentLabels())),
|
|
161
|
+
links: _toConsumableArray(metadata.titleMetadata.links),
|
|
164
162
|
parameters: [],
|
|
165
163
|
steps: [],
|
|
166
|
-
testCaseId: md5(testCaseIdBase),
|
|
167
|
-
fullName:
|
|
168
|
-
titlePath: relativeFileParts.concat.apply(
|
|
164
|
+
testCaseId: md5(metadata.testCaseIdBase),
|
|
165
|
+
fullName: metadata.fullName,
|
|
166
|
+
titlePath: (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles))
|
|
169
167
|
};
|
|
170
168
|
result.labels.push(getLanguageLabel());
|
|
171
169
|
result.labels.push(getFrameworkLabel("playwright"));
|
|
172
|
-
result.labels.push(getPackageLabel(testFilePath));
|
|
170
|
+
result.labels.push(getPackageLabel(metadata.testFilePath));
|
|
173
171
|
result.labels.push({
|
|
174
172
|
name: "titlePath",
|
|
175
|
-
value:
|
|
173
|
+
value: test.parent.titlePath().join(" > ")
|
|
176
174
|
});
|
|
177
175
|
|
|
178
176
|
// support for earlier playwright versions
|
|
@@ -236,13 +234,13 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
236
234
|
_iterator.f();
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
|
-
if (project !== null && project !== void 0 && project.name) {
|
|
237
|
+
if ((_metadata$project = metadata.project) !== null && _metadata$project !== void 0 && _metadata$project.name) {
|
|
240
238
|
result.parameters.push({
|
|
241
239
|
name: "Project",
|
|
242
|
-
value: project.name
|
|
240
|
+
value: metadata.project.name
|
|
243
241
|
});
|
|
244
242
|
}
|
|
245
|
-
if ((project === null ||
|
|
243
|
+
if (((_metadata$project2 = metadata.project) === null || _metadata$project2 === void 0 ? void 0 : _metadata$project2.repeatEach) > 1) {
|
|
246
244
|
result.parameters.push({
|
|
247
245
|
name: "Repetition",
|
|
248
246
|
value: "".concat(test.repeatEachIndex + 1)
|
|
@@ -250,7 +248,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
250
248
|
}
|
|
251
249
|
var testUuid = this.allureRuntime.startTest(result);
|
|
252
250
|
this.allureResultsUuids.set(test.id, testUuid);
|
|
253
|
-
this.startedTestCasesTitlesCache.push(titleMetadata.cleanTitle);
|
|
251
|
+
this.startedTestCasesTitlesCache.push(metadata.titleMetadata.cleanTitle);
|
|
254
252
|
}
|
|
255
253
|
}, {
|
|
256
254
|
key: "onStepBegin",
|
|
@@ -284,56 +282,41 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
284
282
|
return;
|
|
285
283
|
}
|
|
286
284
|
if (isHookStep) {
|
|
287
|
-
// Lazily initialize the hook stack if it doesn't exist (e.g., when detail: false and root hook was ignored)
|
|
288
|
-
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
289
|
-
if (!stack) {
|
|
290
|
-
stack = new ShallowStepsStack();
|
|
291
|
-
var rootHookStep = _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
292
|
-
name: isBeforeHookDescendant ? BEFORE_HOOKS_ROOT_STEP_TITLE : AFTER_HOOKS_ROOT_STEP_TITLE,
|
|
293
|
-
start: step.startTime.getTime(),
|
|
294
|
-
stage: Stage.RUNNING,
|
|
295
|
-
uuid: randomUuid()
|
|
296
|
-
});
|
|
297
|
-
stack.startStep(rootHookStep);
|
|
298
|
-
if (isBeforeHookDescendant) {
|
|
299
|
-
this.beforeHooksStepsStack.set(test.id, stack);
|
|
300
|
-
} else {
|
|
301
|
-
this.afterHooksStepsStack.set(test.id, stack);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
285
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
305
|
-
var _this$attachmentTarge2;
|
|
286
|
+
var _stack$currentStep, _this$attachmentTarge2;
|
|
287
|
+
var attachmentName = normalizeAttachStepTitle(step.title);
|
|
288
|
+
var _stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
306
289
|
var hookStepWithUuid;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
var _attachStack$get;
|
|
290
|
+
var parentHookStepUuid = (_stack$currentStep = _stack.currentStep()) === null || _stack$currentStep === void 0 ? void 0 : _stack$currentStep.uuid;
|
|
291
|
+
_stack.startStep(baseStep);
|
|
292
|
+
_stack.updateStep(function (stepResult) {
|
|
311
293
|
hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
|
|
312
294
|
uuid: stepResult.uuid
|
|
313
295
|
});
|
|
314
296
|
stepResult.name = normalizeHookTitle(stepResult.name);
|
|
315
297
|
stepResult.stage = Stage.FINISHED;
|
|
316
|
-
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [hookStepWithUuid]));
|
|
317
298
|
});
|
|
318
|
-
|
|
299
|
+
_stack.stopStep();
|
|
319
300
|
var _targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
|
|
320
301
|
_targets.push({
|
|
321
|
-
name:
|
|
322
|
-
hookStep: hookStepWithUuid
|
|
302
|
+
name: attachmentName,
|
|
303
|
+
hookStep: hookStepWithUuid,
|
|
304
|
+
stepUuid: attachmentName === "Allure Step Metadata" ? parentHookStepUuid : undefined
|
|
323
305
|
});
|
|
324
306
|
this.attachmentTargets.set(test.id, _targets);
|
|
325
307
|
return;
|
|
326
308
|
}
|
|
309
|
+
var stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
327
310
|
stack.startStep(baseStep);
|
|
328
311
|
return;
|
|
329
312
|
}
|
|
330
313
|
if (isRootHook) {
|
|
331
|
-
var
|
|
332
|
-
|
|
314
|
+
var _stack2 = new ShallowStepsStack();
|
|
315
|
+
_stack2.startStep(baseStep);
|
|
333
316
|
if (isRootBeforeHook) {
|
|
334
|
-
this.beforeHooksStepsStack.set(test.id,
|
|
317
|
+
this.beforeHooksStepsStack.set(test.id, _stack2);
|
|
335
318
|
} else {
|
|
336
|
-
this.afterHooksStepsStack.set(test.id,
|
|
319
|
+
this.afterHooksStepsStack.set(test.id, _stack2);
|
|
337
320
|
}
|
|
338
321
|
return;
|
|
339
322
|
}
|
|
@@ -357,15 +340,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
357
340
|
// If stack exists (was lazily created), finalize the root hook step
|
|
358
341
|
if (stack) {
|
|
359
342
|
stack.updateStep(function (stepResult) {
|
|
360
|
-
|
|
361
|
-
var _ref2 = (_getWorstTestStepResu = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu !== void 0 ? _getWorstTestStepResu : {},
|
|
362
|
-
_ref2$status = _ref2.status,
|
|
363
|
-
status = _ref2$status === void 0 ? Status.PASSED : _ref2$status;
|
|
364
|
-
stepResult.status = step.error ? Status.FAILED : status;
|
|
365
|
-
stepResult.stage = Stage.FINISHED;
|
|
366
|
-
if (step.error) {
|
|
367
|
-
stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
|
|
368
|
-
}
|
|
343
|
+
return finalizeStepResult(stepResult, step);
|
|
369
344
|
});
|
|
370
345
|
stack.stopStep({
|
|
371
346
|
duration: step.duration
|
|
@@ -386,24 +361,16 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
386
361
|
var isAfterHook = isAfterHookDescendant;
|
|
387
362
|
var isHook = isBeforeHookDescendant || isAfterHookDescendant;
|
|
388
363
|
if (isHook) {
|
|
389
|
-
var
|
|
364
|
+
var _stack3 = isAfterHook ? this.afterHooksStepsStack.get(test.id) : this.beforeHooksStepsStack.get(test.id);
|
|
390
365
|
|
|
391
366
|
// Stack might not exist if root hook was ignored (e.g., detail: false) and no test.step was called inside it
|
|
392
|
-
if (!
|
|
367
|
+
if (!_stack3) {
|
|
393
368
|
return;
|
|
394
369
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
var _ref3 = (_getWorstTestStepResu2 = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
|
|
398
|
-
_ref3$status = _ref3.status,
|
|
399
|
-
status = _ref3$status === void 0 ? Status.PASSED : _ref3$status;
|
|
400
|
-
stepResult.status = step.error ? Status.FAILED : status;
|
|
401
|
-
stepResult.stage = Stage.FINISHED;
|
|
402
|
-
if (step.error) {
|
|
403
|
-
stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
|
|
404
|
-
}
|
|
370
|
+
_stack3.updateStep(function (stepResult) {
|
|
371
|
+
return finalizeStepResult(stepResult, step);
|
|
405
372
|
});
|
|
406
|
-
|
|
373
|
+
_stack3.stopStep({
|
|
407
374
|
duration: step.duration
|
|
408
375
|
});
|
|
409
376
|
return;
|
|
@@ -417,15 +384,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
417
384
|
return;
|
|
418
385
|
}
|
|
419
386
|
this.allureRuntime.updateStep(stepUuid, function (stepResult) {
|
|
420
|
-
|
|
421
|
-
var _ref4 = (_getWorstTestStepResu3 = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu3 !== void 0 ? _getWorstTestStepResu3 : {},
|
|
422
|
-
_ref4$status = _ref4.status,
|
|
423
|
-
status = _ref4$status === void 0 ? Status.PASSED : _ref4$status;
|
|
424
|
-
stepResult.status = step.error ? Status.FAILED : status;
|
|
425
|
-
stepResult.stage = Stage.FINISHED;
|
|
426
|
-
if (step.error) {
|
|
427
|
-
stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
|
|
428
|
-
}
|
|
387
|
+
return finalizeStepResult(stepResult, step);
|
|
429
388
|
});
|
|
430
389
|
this.allureRuntime.stopStep(stepUuid, {
|
|
431
390
|
duration: step.duration
|
|
@@ -435,10 +394,9 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
435
394
|
key: "onTestEnd",
|
|
436
395
|
value: function () {
|
|
437
396
|
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(test, result) {
|
|
438
|
-
var
|
|
439
|
-
_this$beforeHooksAtta,
|
|
397
|
+
var _this2 = this,
|
|
440
398
|
_this$attachmentTarge3;
|
|
441
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack,
|
|
399
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator2, _step2, _targetsByName$get, t, q, takeByName, _iterator3, _step3, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu, _stepInfo$hookStep, message, targetStack, _targetStack, stepUuid, hookStep, _targetStack2, stepResult, fileName, _t;
|
|
442
400
|
return _regenerator().w(function (_context) {
|
|
443
401
|
while (1) switch (_context.n) {
|
|
444
402
|
case 0:
|
|
@@ -458,7 +416,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
458
416
|
value: projectSuiteTitle
|
|
459
417
|
});
|
|
460
418
|
}
|
|
461
|
-
if (
|
|
419
|
+
if (_this2.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
|
|
462
420
|
testResult.labels.push({
|
|
463
421
|
name: LabelName.SUITE,
|
|
464
422
|
value: fileSuiteTitle
|
|
@@ -496,7 +454,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
496
454
|
contentType: ContentType.TEXT
|
|
497
455
|
});
|
|
498
456
|
}
|
|
499
|
-
|
|
457
|
+
|
|
458
|
+
// FIFO
|
|
500
459
|
targets = (_this$attachmentTarge3 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge3 !== void 0 ? _this$attachmentTarge3 : [];
|
|
501
460
|
targetsByName = new Map();
|
|
502
461
|
_iterator2 = _createForOfIteratorHelper(targets);
|
|
@@ -524,33 +483,49 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
524
483
|
_iterator3.s();
|
|
525
484
|
case 2:
|
|
526
485
|
if ((_step3 = _iterator3.n()).done) {
|
|
527
|
-
_context.n =
|
|
486
|
+
_context.n = 10;
|
|
528
487
|
break;
|
|
529
488
|
}
|
|
530
489
|
attachment = _step3.value;
|
|
531
490
|
isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
532
491
|
stepInfo = takeByName(attachment.name);
|
|
533
492
|
if (!isRuntimeMessage) {
|
|
534
|
-
_context.n =
|
|
493
|
+
_context.n = 5;
|
|
535
494
|
break;
|
|
536
495
|
}
|
|
496
|
+
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
497
|
+
if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
|
|
498
|
+
targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
|
|
499
|
+
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
500
|
+
}
|
|
501
|
+
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
502
|
+
_context.n = 3;
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
if (stepInfo.hookStep) {
|
|
506
|
+
_targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
|
|
507
|
+
this.processHookStepMetadataMessage(_targetStack, stepInfo.stepUuid, message);
|
|
508
|
+
} else {
|
|
509
|
+
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
510
|
+
}
|
|
511
|
+
return _context.a(3, 9);
|
|
512
|
+
case 3:
|
|
537
513
|
stepUuid = (_stepInfo$hookStep$uu = stepInfo === null || stepInfo === void 0 || (_stepInfo$hookStep = stepInfo.hookStep) === null || _stepInfo$hookStep === void 0 ? void 0 : _stepInfo$hookStep.uuid) !== null && _stepInfo$hookStep$uu !== void 0 ? _stepInfo$hookStep$uu : stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid;
|
|
538
|
-
_context.n =
|
|
514
|
+
_context.n = 4;
|
|
539
515
|
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
540
|
-
case 3:
|
|
541
|
-
return _context.a(3, 8);
|
|
542
516
|
case 4:
|
|
517
|
+
return _context.a(3, 9);
|
|
518
|
+
case 5:
|
|
543
519
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
544
|
-
_context.n =
|
|
520
|
+
_context.n = 6;
|
|
545
521
|
break;
|
|
546
522
|
}
|
|
547
523
|
hookStep = stepInfo.hookStep;
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
stepResult = targetStack.findStepByUuid(hookStep.uuid);
|
|
524
|
+
_targetStack2 = isBeforeHookStep(hookStep) ? beforeHooksStack : afterHooksStack;
|
|
525
|
+
if (_targetStack2) {
|
|
526
|
+
stepResult = _targetStack2.findStepByUuid(hookStep.uuid);
|
|
552
527
|
if (stepResult) {
|
|
553
|
-
fileName =
|
|
528
|
+
fileName = _targetStack2.addAttachment(attachment, this.allureRuntime.writer);
|
|
554
529
|
stepResult.attachments.push({
|
|
555
530
|
name: attachment.name,
|
|
556
531
|
type: attachment.contentType,
|
|
@@ -558,34 +533,34 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
558
533
|
});
|
|
559
534
|
}
|
|
560
535
|
}
|
|
561
|
-
return _context.a(3,
|
|
562
|
-
case
|
|
536
|
+
return _context.a(3, 9);
|
|
537
|
+
case 6:
|
|
563
538
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
564
|
-
_context.n =
|
|
539
|
+
_context.n = 8;
|
|
565
540
|
break;
|
|
566
541
|
}
|
|
567
|
-
_context.n =
|
|
542
|
+
_context.n = 7;
|
|
568
543
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
569
|
-
case 6:
|
|
570
|
-
return _context.a(3, 8);
|
|
571
544
|
case 7:
|
|
572
|
-
_context.
|
|
573
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
545
|
+
return _context.a(3, 9);
|
|
574
546
|
case 8:
|
|
575
|
-
_context.n =
|
|
576
|
-
|
|
547
|
+
_context.n = 9;
|
|
548
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
577
549
|
case 9:
|
|
578
|
-
_context.n =
|
|
550
|
+
_context.n = 2;
|
|
579
551
|
break;
|
|
580
552
|
case 10:
|
|
581
|
-
_context.
|
|
582
|
-
|
|
583
|
-
_iterator3.e(_t);
|
|
553
|
+
_context.n = 12;
|
|
554
|
+
break;
|
|
584
555
|
case 11:
|
|
585
556
|
_context.p = 11;
|
|
586
|
-
|
|
587
|
-
|
|
557
|
+
_t = _context.v;
|
|
558
|
+
_iterator3.e(_t);
|
|
588
559
|
case 12:
|
|
560
|
+
_context.p = 12;
|
|
561
|
+
_iterator3.f();
|
|
562
|
+
return _context.f(12);
|
|
563
|
+
case 13:
|
|
589
564
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
590
565
|
// in next iterations we need to implement the logic for every javascript integration
|
|
591
566
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
@@ -606,13 +581,13 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
606
581
|
if (beforeHooksStack) {
|
|
607
582
|
var _testResult$steps;
|
|
608
583
|
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
|
|
609
|
-
_this.beforeHooksStepsStack["delete"](test.id);
|
|
610
584
|
}
|
|
585
|
+
_this2.beforeHooksStepsStack["delete"](test.id);
|
|
611
586
|
if (afterHooksStack) {
|
|
612
587
|
var _testResult$steps2;
|
|
613
588
|
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
|
|
614
|
-
_this.afterHooksStepsStack["delete"](test.id);
|
|
615
589
|
}
|
|
590
|
+
_this2.afterHooksStepsStack["delete"](test.id);
|
|
616
591
|
testResult.labels = newLabels;
|
|
617
592
|
});
|
|
618
593
|
this.allureRuntime.stopTest(testUuid, {
|
|
@@ -620,10 +595,10 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
620
595
|
});
|
|
621
596
|
this.allureRuntime.writeTest(testUuid);
|
|
622
597
|
this.attachmentTargets["delete"](test.id);
|
|
623
|
-
case
|
|
598
|
+
case 14:
|
|
624
599
|
return _context.a(2);
|
|
625
600
|
}
|
|
626
|
-
}, _callee, this, [[1,
|
|
601
|
+
}, _callee, this, [[1, 11, 12, 13]]);
|
|
627
602
|
}));
|
|
628
603
|
function onTestEnd(_x, _x2) {
|
|
629
604
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -634,15 +609,15 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
634
609
|
key: "addSkippedResults",
|
|
635
610
|
value: function () {
|
|
636
611
|
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
637
|
-
var
|
|
612
|
+
var _this3 = this;
|
|
638
613
|
var unprocessedCases, _iterator4, _step4, testCase, _t2;
|
|
639
614
|
return _regenerator().w(function (_context2) {
|
|
640
615
|
while (1) switch (_context2.n) {
|
|
641
616
|
case 0:
|
|
642
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
643
|
-
var title =
|
|
617
|
+
unprocessedCases = this.suite.allTests().filter(function (_ref2) {
|
|
618
|
+
var title = _ref2.title;
|
|
644
619
|
var titleMetadata = extractMetadataFromString(title);
|
|
645
|
-
return !
|
|
620
|
+
return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
646
621
|
});
|
|
647
622
|
_iterator4 = _createForOfIteratorHelper(unprocessedCases);
|
|
648
623
|
_context2.p = 1;
|
|
@@ -720,6 +695,101 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
720
695
|
value: function printsToStdio() {
|
|
721
696
|
return false;
|
|
722
697
|
}
|
|
698
|
+
}, {
|
|
699
|
+
key: "removeStepFromHookStack",
|
|
700
|
+
value: function removeStepFromHookStack(stack, stepUuid) {
|
|
701
|
+
if (!stack) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
var _removeRecursively = function removeRecursively(steps) {
|
|
705
|
+
return steps.filter(function (step) {
|
|
706
|
+
return step.uuid !== stepUuid;
|
|
707
|
+
}).map(function (step) {
|
|
708
|
+
return _objectSpread(_objectSpread({}, step), {}, {
|
|
709
|
+
steps: _removeRecursively(step.steps)
|
|
710
|
+
});
|
|
711
|
+
}).filter(function (step) {
|
|
712
|
+
return step.name !== BEFORE_HOOKS_ROOT_STEP_TITLE && step.name !== AFTER_HOOKS_ROOT_STEP_TITLE || step.steps.length > 0 || step.attachments.length > 0 || step.status !== Status.PASSED;
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
stack.steps = _removeRecursively(stack.steps);
|
|
716
|
+
}
|
|
717
|
+
}, {
|
|
718
|
+
key: "getStaticTestMetadata",
|
|
719
|
+
value: function getStaticTestMetadata(test) {
|
|
720
|
+
var _ref3, _test$parent$project, _titleMetadata$labels;
|
|
721
|
+
var titleMetadata = extractMetadataFromString(test.title);
|
|
722
|
+
var project = (_ref3 = (_test$parent$project = test.parent.project()) !== null && _test$parent$project !== void 0 ? _test$parent$project : this.config.projects.find(function (candidate) {
|
|
723
|
+
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(path.sep));
|
|
724
|
+
})) !== null && _ref3 !== void 0 ? _ref3 : this.config.projects[0];
|
|
725
|
+
var testFilePath = path.relative(project.testDir, test.location.file);
|
|
726
|
+
var relativeFileParts = testFilePath.split(path.sep);
|
|
727
|
+
var relativeFile = relativeFileParts.join("/");
|
|
728
|
+
var normalizedAbsoluteFile = path.normalize(test.location.file);
|
|
729
|
+
var normalizedRelativeFile = path.normalize(testFilePath);
|
|
730
|
+
var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
|
|
731
|
+
var suiteTitles = test.parent.titlePath().filter(Boolean);
|
|
732
|
+
if (project.name && suiteTitles[0] === project.name) {
|
|
733
|
+
suiteTitles = suiteTitles.slice(1);
|
|
734
|
+
}
|
|
735
|
+
if (suiteTitles.length > 0 && fileTitleCandidates.has(path.normalize(suiteTitles[0]))) {
|
|
736
|
+
suiteTitles = suiteTitles.slice(1);
|
|
737
|
+
}
|
|
738
|
+
var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
739
|
+
var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
|
|
740
|
+
var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
|
|
741
|
+
return label.name === LabelName.ALLURE_ID;
|
|
742
|
+
})) === null || _titleMetadata$labels === void 0 ? void 0 : _titleMetadata$labels.value;
|
|
743
|
+
|
|
744
|
+
// Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
|
|
745
|
+
if (!staticAllureId && "annotations" in test) {
|
|
746
|
+
var _iterator5 = _createForOfIteratorHelper(test.annotations),
|
|
747
|
+
_step5;
|
|
748
|
+
try {
|
|
749
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
750
|
+
var annotation = _step5.value;
|
|
751
|
+
var label = getMetadataLabel(annotation.type, annotation.description);
|
|
752
|
+
if ((label === null || label === void 0 ? void 0 : label.name) === LabelName.ALLURE_ID) {
|
|
753
|
+
staticAllureId = label.value;
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
} catch (err) {
|
|
758
|
+
_iterator5.e(err);
|
|
759
|
+
} finally {
|
|
760
|
+
_iterator5.f();
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return {
|
|
764
|
+
project: project,
|
|
765
|
+
testFilePath: testFilePath,
|
|
766
|
+
relativeFileParts: relativeFileParts,
|
|
767
|
+
suiteTitles: suiteTitles,
|
|
768
|
+
testCaseIdBase: "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title),
|
|
769
|
+
titleMetadata: titleMetadata,
|
|
770
|
+
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
|
|
771
|
+
legacyFullName: legacyFullName,
|
|
772
|
+
staticAllureId: staticAllureId
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
}, {
|
|
776
|
+
key: "isInTestPlan",
|
|
777
|
+
value: function isInTestPlan(test) {
|
|
778
|
+
if (!this.testPlan) {
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
var _this$getStaticTestMe = this.getStaticTestMetadata(test),
|
|
782
|
+
fullName = _this$getStaticTestMe.fullName,
|
|
783
|
+
legacyFullName = _this$getStaticTestMe.legacyFullName,
|
|
784
|
+
staticAllureId = _this$getStaticTestMe.staticAllureId;
|
|
785
|
+
return includedInTestPlan(this.testPlan, {
|
|
786
|
+
fullName: fullName,
|
|
787
|
+
id: staticAllureId
|
|
788
|
+
}) || includedInTestPlan(this.testPlan, {
|
|
789
|
+
fullName: legacyFullName,
|
|
790
|
+
id: staticAllureId
|
|
791
|
+
});
|
|
792
|
+
}
|
|
723
793
|
}, {
|
|
724
794
|
key: "processStepMetadataMessage",
|
|
725
795
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
@@ -735,6 +805,23 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
735
805
|
(_step$parameters = step.parameters).push.apply(_step$parameters, _toConsumableArray(parameters));
|
|
736
806
|
});
|
|
737
807
|
}
|
|
808
|
+
}, {
|
|
809
|
+
key: "processHookStepMetadataMessage",
|
|
810
|
+
value: function processHookStepMetadataMessage(stack, attachmentStepUuid, message) {
|
|
811
|
+
var _step$parameters2;
|
|
812
|
+
var step = stack === null || stack === void 0 ? void 0 : stack.findStepByUuid(attachmentStepUuid);
|
|
813
|
+
if (!step) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
var _message$data2 = message.data,
|
|
817
|
+
name = _message$data2.name,
|
|
818
|
+
_message$data2$parame = _message$data2.parameters,
|
|
819
|
+
parameters = _message$data2$parame === void 0 ? [] : _message$data2$parame;
|
|
820
|
+
if (name) {
|
|
821
|
+
step.name = name;
|
|
822
|
+
}
|
|
823
|
+
(_step$parameters2 = step.parameters).push.apply(_step$parameters2, _toConsumableArray(parameters));
|
|
824
|
+
}
|
|
738
825
|
}, {
|
|
739
826
|
key: "processAttachment",
|
|
740
827
|
value: function () {
|
|
@@ -758,20 +845,13 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
758
845
|
return _context6.a(2);
|
|
759
846
|
case 2:
|
|
760
847
|
if (!allureRuntimeMessage) {
|
|
761
|
-
_context6.n = 4;
|
|
762
|
-
break;
|
|
763
|
-
}
|
|
764
|
-
message = JSON.parse(attachment.body.toString());
|
|
765
|
-
if (!(message.type === "step_metadata")) {
|
|
766
848
|
_context6.n = 3;
|
|
767
849
|
break;
|
|
768
850
|
}
|
|
769
|
-
|
|
770
|
-
return _context6.a(2);
|
|
771
|
-
case 3:
|
|
851
|
+
message = JSON.parse(attachment.body.toString());
|
|
772
852
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
773
853
|
return _context6.a(2);
|
|
774
|
-
case
|
|
854
|
+
case 3:
|
|
775
855
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
776
856
|
name: attachment.name
|
|
777
857
|
}); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
|
|
@@ -781,42 +861,42 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
781
861
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
782
862
|
}
|
|
783
863
|
if (!attachment.body) {
|
|
784
|
-
_context6.n =
|
|
864
|
+
_context6.n = 4;
|
|
785
865
|
break;
|
|
786
866
|
}
|
|
787
867
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
788
868
|
contentType: attachment.contentType
|
|
789
869
|
});
|
|
790
|
-
_context6.n =
|
|
870
|
+
_context6.n = 6;
|
|
791
871
|
break;
|
|
792
|
-
case
|
|
872
|
+
case 4:
|
|
793
873
|
if (existsSync(attachment.path)) {
|
|
794
|
-
_context6.n =
|
|
874
|
+
_context6.n = 5;
|
|
795
875
|
break;
|
|
796
876
|
}
|
|
797
877
|
return _context6.a(2);
|
|
798
|
-
case
|
|
799
|
-
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ?
|
|
878
|
+
case 5:
|
|
879
|
+
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
|
|
800
880
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
801
881
|
contentType: contentType
|
|
802
882
|
});
|
|
803
|
-
case
|
|
883
|
+
case 6:
|
|
804
884
|
if (attachment.name.match(diffEndRegexp)) {
|
|
805
|
-
_context6.n =
|
|
885
|
+
_context6.n = 7;
|
|
806
886
|
break;
|
|
807
887
|
}
|
|
808
888
|
return _context6.a(2);
|
|
809
|
-
case
|
|
889
|
+
case 7:
|
|
810
890
|
pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
|
|
811
891
|
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
|
|
812
892
|
if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
|
|
813
|
-
_context6.n =
|
|
893
|
+
_context6.n = 8;
|
|
814
894
|
break;
|
|
815
895
|
}
|
|
816
896
|
return _context6.a(2);
|
|
817
|
-
case
|
|
897
|
+
case 8:
|
|
818
898
|
fileExists = /*#__PURE__*/function () {
|
|
819
|
-
var
|
|
899
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
|
|
820
900
|
return _regenerator().w(function (_context4) {
|
|
821
901
|
while (1) switch (_context4.n) {
|
|
822
902
|
case 0:
|
|
@@ -832,11 +912,11 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
832
912
|
}, _callee4);
|
|
833
913
|
}));
|
|
834
914
|
return function fileExists(_x6) {
|
|
835
|
-
return
|
|
915
|
+
return _ref4.apply(this, arguments);
|
|
836
916
|
};
|
|
837
917
|
}();
|
|
838
918
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
839
|
-
var
|
|
919
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
|
|
840
920
|
var defaultPath, snapshotPath;
|
|
841
921
|
return _regenerator().w(function (_context5) {
|
|
842
922
|
while (1) switch (_context5.n) {
|
|
@@ -872,20 +952,20 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
872
952
|
}, _callee5);
|
|
873
953
|
}));
|
|
874
954
|
return function readImageFromDirs(_x7) {
|
|
875
|
-
return
|
|
955
|
+
return _ref5.apply(this, arguments);
|
|
876
956
|
};
|
|
877
957
|
}();
|
|
878
|
-
_context6.n =
|
|
958
|
+
_context6.n = 9;
|
|
879
959
|
return readImageFromDirs("actual");
|
|
880
|
-
case
|
|
960
|
+
case 9:
|
|
881
961
|
actualBase64 = _context6.v;
|
|
882
|
-
_context6.n =
|
|
962
|
+
_context6.n = 10;
|
|
883
963
|
return readImageFromDirs("expected");
|
|
884
|
-
case
|
|
964
|
+
case 10:
|
|
885
965
|
expectedBase64 = _context6.v;
|
|
886
|
-
_context6.n =
|
|
966
|
+
_context6.n = 11;
|
|
887
967
|
return readImageFromDirs("diff");
|
|
888
|
-
case
|
|
968
|
+
case 11:
|
|
889
969
|
diffBase64 = _context6.v;
|
|
890
970
|
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
891
971
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
@@ -898,7 +978,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
898
978
|
fileExtension: ".imagediff"
|
|
899
979
|
});
|
|
900
980
|
this.processedDiffs.push(pathWithoutEnd);
|
|
901
|
-
case
|
|
981
|
+
case 12:
|
|
902
982
|
return _context6.a(2);
|
|
903
983
|
}
|
|
904
984
|
}, _callee6, this);
|
|
@@ -935,6 +1015,22 @@ function _shouldIgnoreStep(step) {
|
|
|
935
1015
|
}
|
|
936
1016
|
return false;
|
|
937
1017
|
}
|
|
1018
|
+
function _getOrCreateHookStack(testId, isBeforeHook, startTime) {
|
|
1019
|
+
var map = isBeforeHook ? this.beforeHooksStepsStack : this.afterHooksStepsStack;
|
|
1020
|
+
var stack = map.get(testId);
|
|
1021
|
+
if (!stack) {
|
|
1022
|
+
stack = new ShallowStepsStack();
|
|
1023
|
+
var rootHookStep = _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
1024
|
+
name: isBeforeHook ? BEFORE_HOOKS_ROOT_STEP_TITLE : AFTER_HOOKS_ROOT_STEP_TITLE,
|
|
1025
|
+
start: startTime.getTime(),
|
|
1026
|
+
stage: Stage.RUNNING,
|
|
1027
|
+
uuid: randomUuid()
|
|
1028
|
+
});
|
|
1029
|
+
stack.startStep(rootHookStep);
|
|
1030
|
+
map.set(testId, stack);
|
|
1031
|
+
}
|
|
1032
|
+
return stack;
|
|
1033
|
+
}
|
|
938
1034
|
export var allure = allurePlaywrightLegacyApi;
|
|
939
1035
|
|
|
940
1036
|
/**
|