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/cjs/index.js
CHANGED
|
@@ -30,12 +30,12 @@ var _test = require("@playwright/test");
|
|
|
30
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
31
31
|
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 }; })(); }
|
|
32
32
|
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); }
|
|
33
|
-
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); }
|
|
34
|
-
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); }); }; }
|
|
35
|
-
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; } } }; }
|
|
36
33
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
37
34
|
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."); }
|
|
38
35
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
36
|
+
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); }
|
|
37
|
+
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); }); }; }
|
|
38
|
+
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; } } }; }
|
|
39
39
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
40
40
|
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."); }
|
|
41
41
|
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; } }
|
|
@@ -71,9 +71,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
71
71
|
_defineProperty(this, "attachmentTargets", new Map());
|
|
72
72
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
73
73
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
74
|
-
_defineProperty(this, "beforeHooksAttachmentsStack", new Map());
|
|
75
|
-
_defineProperty(this, "afterHooksAttachmentsStack", new Map());
|
|
76
74
|
_defineProperty(this, "pwStepUuid", new WeakMap());
|
|
75
|
+
_defineProperty(this, "testPlan", (0, _reporter.parseTestPlan)());
|
|
77
76
|
this.options = _objectSpread({
|
|
78
77
|
suiteTitle: true,
|
|
79
78
|
detail: true
|
|
@@ -82,10 +81,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
82
81
|
return _createClass(AllureReporter, [{
|
|
83
82
|
key: "onConfigure",
|
|
84
83
|
value: function onConfigure(config) {
|
|
84
|
+
var _this = this;
|
|
85
85
|
this.config = config;
|
|
86
86
|
this.outputDir = config.projects[0].outputDir;
|
|
87
87
|
this.snapshotDir = config.projects[0].snapshotDir;
|
|
88
|
-
var testPlan =
|
|
88
|
+
var testPlan = this.testPlan;
|
|
89
89
|
if (!testPlan) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -95,6 +95,14 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
95
95
|
if (!configElement) {
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
+
configElement.preOnlyTestFilters.push(function (test) {
|
|
99
|
+
return _this.isInTestPlan(test);
|
|
100
|
+
});
|
|
101
|
+
if (testPlan.tests.some(function (test) {
|
|
102
|
+
return test.id !== undefined;
|
|
103
|
+
})) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
98
106
|
var testsWithSelectors = testPlan.tests.filter(function (test) {
|
|
99
107
|
return test.selector;
|
|
100
108
|
});
|
|
@@ -162,34 +170,24 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
162
170
|
}, {
|
|
163
171
|
key: "onTestBegin",
|
|
164
172
|
value: function onTestBegin(test) {
|
|
165
|
-
var
|
|
166
|
-
var
|
|
167
|
-
var project = suite.project();
|
|
168
|
-
var testFilePath = _nodePath["default"].relative(project === null || project === void 0 ? void 0 : project.testDir, test.location.file);
|
|
169
|
-
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
170
|
-
var relativeFile = relativeFileParts.join("/");
|
|
171
|
-
// root > project > file path > test.describe...
|
|
172
|
-
var _suite$titlePath = suite.titlePath(),
|
|
173
|
-
_suite$titlePath2 = _toArray(_suite$titlePath),
|
|
174
|
-
suiteTitles = _suite$titlePath2.slice(3);
|
|
175
|
-
var nameSuites = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
176
|
-
var testCaseIdBase = "".concat(relativeFile, "#").concat(nameSuites).concat(test.title);
|
|
173
|
+
var _metadata$relativeFil, _metadata$project, _metadata$project2;
|
|
174
|
+
var metadata = this.getStaticTestMetadata(test);
|
|
177
175
|
var result = {
|
|
178
|
-
name: titleMetadata.cleanTitle,
|
|
179
|
-
labels: [].concat(_toConsumableArray(titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
180
|
-
links: _toConsumableArray(titleMetadata.links),
|
|
176
|
+
name: metadata.titleMetadata.cleanTitle,
|
|
177
|
+
labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
178
|
+
links: _toConsumableArray(metadata.titleMetadata.links),
|
|
181
179
|
parameters: [],
|
|
182
180
|
steps: [],
|
|
183
|
-
testCaseId: (0, _reporter.md5)(testCaseIdBase),
|
|
184
|
-
fullName:
|
|
185
|
-
titlePath: relativeFileParts.concat.apply(
|
|
181
|
+
testCaseId: (0, _reporter.md5)(metadata.testCaseIdBase),
|
|
182
|
+
fullName: metadata.fullName,
|
|
183
|
+
titlePath: (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles))
|
|
186
184
|
};
|
|
187
185
|
result.labels.push((0, _reporter.getLanguageLabel)());
|
|
188
186
|
result.labels.push((0, _reporter.getFrameworkLabel)("playwright"));
|
|
189
|
-
result.labels.push((0, _reporter.getPackageLabel)(testFilePath));
|
|
187
|
+
result.labels.push((0, _reporter.getPackageLabel)(metadata.testFilePath));
|
|
190
188
|
result.labels.push({
|
|
191
189
|
name: "titlePath",
|
|
192
|
-
value:
|
|
190
|
+
value: test.parent.titlePath().join(" > ")
|
|
193
191
|
});
|
|
194
192
|
|
|
195
193
|
// support for earlier playwright versions
|
|
@@ -253,13 +251,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
253
251
|
_iterator.f();
|
|
254
252
|
}
|
|
255
253
|
}
|
|
256
|
-
if (project !== null && project !== void 0 && project.name) {
|
|
254
|
+
if ((_metadata$project = metadata.project) !== null && _metadata$project !== void 0 && _metadata$project.name) {
|
|
257
255
|
result.parameters.push({
|
|
258
256
|
name: "Project",
|
|
259
|
-
value: project.name
|
|
257
|
+
value: metadata.project.name
|
|
260
258
|
});
|
|
261
259
|
}
|
|
262
|
-
if ((project === null ||
|
|
260
|
+
if (((_metadata$project2 = metadata.project) === null || _metadata$project2 === void 0 ? void 0 : _metadata$project2.repeatEach) > 1) {
|
|
263
261
|
result.parameters.push({
|
|
264
262
|
name: "Repetition",
|
|
265
263
|
value: "".concat(test.repeatEachIndex + 1)
|
|
@@ -267,7 +265,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
267
265
|
}
|
|
268
266
|
var testUuid = this.allureRuntime.startTest(result);
|
|
269
267
|
this.allureResultsUuids.set(test.id, testUuid);
|
|
270
|
-
this.startedTestCasesTitlesCache.push(titleMetadata.cleanTitle);
|
|
268
|
+
this.startedTestCasesTitlesCache.push(metadata.titleMetadata.cleanTitle);
|
|
271
269
|
}
|
|
272
270
|
}, {
|
|
273
271
|
key: "onStepBegin",
|
|
@@ -301,56 +299,41 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
301
299
|
return;
|
|
302
300
|
}
|
|
303
301
|
if (isHookStep) {
|
|
304
|
-
// Lazily initialize the hook stack if it doesn't exist (e.g., when detail: false and root hook was ignored)
|
|
305
|
-
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
306
|
-
if (!stack) {
|
|
307
|
-
stack = new _reporter.ShallowStepsStack();
|
|
308
|
-
var rootHookStep = _objectSpread(_objectSpread({}, (0, _reporter.createStepResult)()), {}, {
|
|
309
|
-
name: isBeforeHookDescendant ? _utils.BEFORE_HOOKS_ROOT_STEP_TITLE : _utils.AFTER_HOOKS_ROOT_STEP_TITLE,
|
|
310
|
-
start: step.startTime.getTime(),
|
|
311
|
-
stage: _allureJsCommons.Stage.RUNNING,
|
|
312
|
-
uuid: (0, _reporter.randomUuid)()
|
|
313
|
-
});
|
|
314
|
-
stack.startStep(rootHookStep);
|
|
315
|
-
if (isBeforeHookDescendant) {
|
|
316
|
-
this.beforeHooksStepsStack.set(test.id, stack);
|
|
317
|
-
} else {
|
|
318
|
-
this.afterHooksStepsStack.set(test.id, stack);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
302
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
322
|
-
var _this$attachmentTarge2;
|
|
303
|
+
var _stack$currentStep, _this$attachmentTarge2;
|
|
304
|
+
var attachmentName = (0, _utils.normalizeAttachStepTitle)(step.title);
|
|
305
|
+
var _stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
323
306
|
var hookStepWithUuid;
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
var _attachStack$get;
|
|
307
|
+
var parentHookStepUuid = (_stack$currentStep = _stack.currentStep()) === null || _stack$currentStep === void 0 ? void 0 : _stack$currentStep.uuid;
|
|
308
|
+
_stack.startStep(baseStep);
|
|
309
|
+
_stack.updateStep(function (stepResult) {
|
|
328
310
|
hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
|
|
329
311
|
uuid: stepResult.uuid
|
|
330
312
|
});
|
|
331
313
|
stepResult.name = (0, _utils.normalizeHookTitle)(stepResult.name);
|
|
332
314
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
333
|
-
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [hookStepWithUuid]));
|
|
334
315
|
});
|
|
335
|
-
|
|
316
|
+
_stack.stopStep();
|
|
336
317
|
var _targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
|
|
337
318
|
_targets.push({
|
|
338
|
-
name:
|
|
339
|
-
hookStep: hookStepWithUuid
|
|
319
|
+
name: attachmentName,
|
|
320
|
+
hookStep: hookStepWithUuid,
|
|
321
|
+
stepUuid: attachmentName === "Allure Step Metadata" ? parentHookStepUuid : undefined
|
|
340
322
|
});
|
|
341
323
|
this.attachmentTargets.set(test.id, _targets);
|
|
342
324
|
return;
|
|
343
325
|
}
|
|
326
|
+
var stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
344
327
|
stack.startStep(baseStep);
|
|
345
328
|
return;
|
|
346
329
|
}
|
|
347
330
|
if (isRootHook) {
|
|
348
|
-
var
|
|
349
|
-
|
|
331
|
+
var _stack2 = new _reporter.ShallowStepsStack();
|
|
332
|
+
_stack2.startStep(baseStep);
|
|
350
333
|
if (isRootBeforeHook) {
|
|
351
|
-
this.beforeHooksStepsStack.set(test.id,
|
|
334
|
+
this.beforeHooksStepsStack.set(test.id, _stack2);
|
|
352
335
|
} else {
|
|
353
|
-
this.afterHooksStepsStack.set(test.id,
|
|
336
|
+
this.afterHooksStepsStack.set(test.id, _stack2);
|
|
354
337
|
}
|
|
355
338
|
return;
|
|
356
339
|
}
|
|
@@ -374,15 +357,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
374
357
|
// If stack exists (was lazily created), finalize the root hook step
|
|
375
358
|
if (stack) {
|
|
376
359
|
stack.updateStep(function (stepResult) {
|
|
377
|
-
|
|
378
|
-
var _ref2 = (_getWorstTestStepResu = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu !== void 0 ? _getWorstTestStepResu : {},
|
|
379
|
-
_ref2$status = _ref2.status,
|
|
380
|
-
status = _ref2$status === void 0 ? _allureJsCommons.Status.PASSED : _ref2$status;
|
|
381
|
-
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : status;
|
|
382
|
-
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
383
|
-
if (step.error) {
|
|
384
|
-
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
385
|
-
}
|
|
360
|
+
return (0, _utils.finalizeStepResult)(stepResult, step);
|
|
386
361
|
});
|
|
387
362
|
stack.stopStep({
|
|
388
363
|
duration: step.duration
|
|
@@ -403,24 +378,16 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
403
378
|
var isAfterHook = isAfterHookDescendant;
|
|
404
379
|
var isHook = isBeforeHookDescendant || isAfterHookDescendant;
|
|
405
380
|
if (isHook) {
|
|
406
|
-
var
|
|
381
|
+
var _stack3 = isAfterHook ? this.afterHooksStepsStack.get(test.id) : this.beforeHooksStepsStack.get(test.id);
|
|
407
382
|
|
|
408
383
|
// Stack might not exist if root hook was ignored (e.g., detail: false) and no test.step was called inside it
|
|
409
|
-
if (!
|
|
384
|
+
if (!_stack3) {
|
|
410
385
|
return;
|
|
411
386
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
var _ref3 = (_getWorstTestStepResu2 = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
|
|
415
|
-
_ref3$status = _ref3.status,
|
|
416
|
-
status = _ref3$status === void 0 ? _allureJsCommons.Status.PASSED : _ref3$status;
|
|
417
|
-
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : status;
|
|
418
|
-
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
419
|
-
if (step.error) {
|
|
420
|
-
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
421
|
-
}
|
|
387
|
+
_stack3.updateStep(function (stepResult) {
|
|
388
|
+
return (0, _utils.finalizeStepResult)(stepResult, step);
|
|
422
389
|
});
|
|
423
|
-
|
|
390
|
+
_stack3.stopStep({
|
|
424
391
|
duration: step.duration
|
|
425
392
|
});
|
|
426
393
|
return;
|
|
@@ -434,15 +401,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
434
401
|
return;
|
|
435
402
|
}
|
|
436
403
|
this.allureRuntime.updateStep(stepUuid, function (stepResult) {
|
|
437
|
-
|
|
438
|
-
var _ref4 = (_getWorstTestStepResu3 = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu3 !== void 0 ? _getWorstTestStepResu3 : {},
|
|
439
|
-
_ref4$status = _ref4.status,
|
|
440
|
-
status = _ref4$status === void 0 ? _allureJsCommons.Status.PASSED : _ref4$status;
|
|
441
|
-
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : status;
|
|
442
|
-
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
443
|
-
if (step.error) {
|
|
444
|
-
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
445
|
-
}
|
|
404
|
+
return (0, _utils.finalizeStepResult)(stepResult, step);
|
|
446
405
|
});
|
|
447
406
|
this.allureRuntime.stopStep(stepUuid, {
|
|
448
407
|
duration: step.duration
|
|
@@ -452,10 +411,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
452
411
|
key: "onTestEnd",
|
|
453
412
|
value: function () {
|
|
454
413
|
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(test, result) {
|
|
455
|
-
var
|
|
456
|
-
_this$beforeHooksAtta,
|
|
414
|
+
var _this2 = this,
|
|
457
415
|
_this$attachmentTarge3;
|
|
458
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack,
|
|
416
|
+
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;
|
|
459
417
|
return _regenerator().w(function (_context) {
|
|
460
418
|
while (1) switch (_context.n) {
|
|
461
419
|
case 0:
|
|
@@ -475,7 +433,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
475
433
|
value: projectSuiteTitle
|
|
476
434
|
});
|
|
477
435
|
}
|
|
478
|
-
if (
|
|
436
|
+
if (_this2.options.suiteTitle && fileSuiteTitle && !(0, _sdk.hasLabel)(testResult, _allureJsCommons.LabelName.SUITE)) {
|
|
479
437
|
testResult.labels.push({
|
|
480
438
|
name: _allureJsCommons.LabelName.SUITE,
|
|
481
439
|
value: fileSuiteTitle
|
|
@@ -513,7 +471,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
513
471
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
514
472
|
});
|
|
515
473
|
}
|
|
516
|
-
|
|
474
|
+
|
|
475
|
+
// FIFO
|
|
517
476
|
targets = (_this$attachmentTarge3 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge3 !== void 0 ? _this$attachmentTarge3 : [];
|
|
518
477
|
targetsByName = new Map();
|
|
519
478
|
_iterator2 = _createForOfIteratorHelper(targets);
|
|
@@ -541,33 +500,49 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
541
500
|
_iterator3.s();
|
|
542
501
|
case 2:
|
|
543
502
|
if ((_step3 = _iterator3.n()).done) {
|
|
544
|
-
_context.n =
|
|
503
|
+
_context.n = 10;
|
|
545
504
|
break;
|
|
546
505
|
}
|
|
547
506
|
attachment = _step3.value;
|
|
548
507
|
isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
549
508
|
stepInfo = takeByName(attachment.name);
|
|
550
509
|
if (!isRuntimeMessage) {
|
|
551
|
-
_context.n =
|
|
510
|
+
_context.n = 5;
|
|
552
511
|
break;
|
|
553
512
|
}
|
|
513
|
+
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
514
|
+
if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
|
|
515
|
+
targetStack = (0, _utils.isBeforeHookStep)(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
|
|
516
|
+
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
517
|
+
}
|
|
518
|
+
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
519
|
+
_context.n = 3;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
if (stepInfo.hookStep) {
|
|
523
|
+
_targetStack = (0, _utils.isBeforeHookStep)(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
|
|
524
|
+
this.processHookStepMetadataMessage(_targetStack, stepInfo.stepUuid, message);
|
|
525
|
+
} else {
|
|
526
|
+
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
527
|
+
}
|
|
528
|
+
return _context.a(3, 9);
|
|
529
|
+
case 3:
|
|
554
530
|
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;
|
|
555
|
-
_context.n =
|
|
531
|
+
_context.n = 4;
|
|
556
532
|
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
557
|
-
case 3:
|
|
558
|
-
return _context.a(3, 8);
|
|
559
533
|
case 4:
|
|
534
|
+
return _context.a(3, 9);
|
|
535
|
+
case 5:
|
|
560
536
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
561
|
-
_context.n =
|
|
537
|
+
_context.n = 6;
|
|
562
538
|
break;
|
|
563
539
|
}
|
|
564
540
|
hookStep = stepInfo.hookStep;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
stepResult = targetStack.findStepByUuid(hookStep.uuid);
|
|
541
|
+
_targetStack2 = (0, _utils.isBeforeHookStep)(hookStep) ? beforeHooksStack : afterHooksStack;
|
|
542
|
+
if (_targetStack2) {
|
|
543
|
+
stepResult = _targetStack2.findStepByUuid(hookStep.uuid);
|
|
569
544
|
if (stepResult) {
|
|
570
|
-
fileName =
|
|
545
|
+
fileName = _targetStack2.addAttachment(attachment, this.allureRuntime.writer);
|
|
571
546
|
stepResult.attachments.push({
|
|
572
547
|
name: attachment.name,
|
|
573
548
|
type: attachment.contentType,
|
|
@@ -575,34 +550,34 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
575
550
|
});
|
|
576
551
|
}
|
|
577
552
|
}
|
|
578
|
-
return _context.a(3,
|
|
579
|
-
case
|
|
553
|
+
return _context.a(3, 9);
|
|
554
|
+
case 6:
|
|
580
555
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
581
|
-
_context.n =
|
|
556
|
+
_context.n = 8;
|
|
582
557
|
break;
|
|
583
558
|
}
|
|
584
|
-
_context.n =
|
|
559
|
+
_context.n = 7;
|
|
585
560
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
586
|
-
case 6:
|
|
587
|
-
return _context.a(3, 8);
|
|
588
561
|
case 7:
|
|
589
|
-
_context.
|
|
590
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
562
|
+
return _context.a(3, 9);
|
|
591
563
|
case 8:
|
|
592
|
-
_context.n =
|
|
593
|
-
|
|
564
|
+
_context.n = 9;
|
|
565
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
594
566
|
case 9:
|
|
595
|
-
_context.n =
|
|
567
|
+
_context.n = 2;
|
|
596
568
|
break;
|
|
597
569
|
case 10:
|
|
598
|
-
_context.
|
|
599
|
-
|
|
600
|
-
_iterator3.e(_t);
|
|
570
|
+
_context.n = 12;
|
|
571
|
+
break;
|
|
601
572
|
case 11:
|
|
602
573
|
_context.p = 11;
|
|
603
|
-
|
|
604
|
-
|
|
574
|
+
_t = _context.v;
|
|
575
|
+
_iterator3.e(_t);
|
|
605
576
|
case 12:
|
|
577
|
+
_context.p = 12;
|
|
578
|
+
_iterator3.f();
|
|
579
|
+
return _context.f(12);
|
|
580
|
+
case 13:
|
|
606
581
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
607
582
|
// in next iterations we need to implement the logic for every javascript integration
|
|
608
583
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
@@ -623,13 +598,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
623
598
|
if (beforeHooksStack) {
|
|
624
599
|
var _testResult$steps;
|
|
625
600
|
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
|
|
626
|
-
_this.beforeHooksStepsStack["delete"](test.id);
|
|
627
601
|
}
|
|
602
|
+
_this2.beforeHooksStepsStack["delete"](test.id);
|
|
628
603
|
if (afterHooksStack) {
|
|
629
604
|
var _testResult$steps2;
|
|
630
605
|
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
|
|
631
|
-
_this.afterHooksStepsStack["delete"](test.id);
|
|
632
606
|
}
|
|
607
|
+
_this2.afterHooksStepsStack["delete"](test.id);
|
|
633
608
|
testResult.labels = newLabels;
|
|
634
609
|
});
|
|
635
610
|
this.allureRuntime.stopTest(testUuid, {
|
|
@@ -637,10 +612,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
637
612
|
});
|
|
638
613
|
this.allureRuntime.writeTest(testUuid);
|
|
639
614
|
this.attachmentTargets["delete"](test.id);
|
|
640
|
-
case
|
|
615
|
+
case 14:
|
|
641
616
|
return _context.a(2);
|
|
642
617
|
}
|
|
643
|
-
}, _callee, this, [[1,
|
|
618
|
+
}, _callee, this, [[1, 11, 12, 13]]);
|
|
644
619
|
}));
|
|
645
620
|
function onTestEnd(_x, _x2) {
|
|
646
621
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -651,15 +626,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
651
626
|
key: "addSkippedResults",
|
|
652
627
|
value: function () {
|
|
653
628
|
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
654
|
-
var
|
|
629
|
+
var _this3 = this;
|
|
655
630
|
var unprocessedCases, _iterator4, _step4, testCase, _t2;
|
|
656
631
|
return _regenerator().w(function (_context2) {
|
|
657
632
|
while (1) switch (_context2.n) {
|
|
658
633
|
case 0:
|
|
659
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
660
|
-
var title =
|
|
634
|
+
unprocessedCases = this.suite.allTests().filter(function (_ref2) {
|
|
635
|
+
var title = _ref2.title;
|
|
661
636
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
662
|
-
return !
|
|
637
|
+
return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
663
638
|
});
|
|
664
639
|
_iterator4 = _createForOfIteratorHelper(unprocessedCases);
|
|
665
640
|
_context2.p = 1;
|
|
@@ -737,6 +712,101 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
737
712
|
value: function printsToStdio() {
|
|
738
713
|
return false;
|
|
739
714
|
}
|
|
715
|
+
}, {
|
|
716
|
+
key: "removeStepFromHookStack",
|
|
717
|
+
value: function removeStepFromHookStack(stack, stepUuid) {
|
|
718
|
+
if (!stack) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
var _removeRecursively = function removeRecursively(steps) {
|
|
722
|
+
return steps.filter(function (step) {
|
|
723
|
+
return step.uuid !== stepUuid;
|
|
724
|
+
}).map(function (step) {
|
|
725
|
+
return _objectSpread(_objectSpread({}, step), {}, {
|
|
726
|
+
steps: _removeRecursively(step.steps)
|
|
727
|
+
});
|
|
728
|
+
}).filter(function (step) {
|
|
729
|
+
return step.name !== _utils.BEFORE_HOOKS_ROOT_STEP_TITLE && step.name !== _utils.AFTER_HOOKS_ROOT_STEP_TITLE || step.steps.length > 0 || step.attachments.length > 0 || step.status !== _allureJsCommons.Status.PASSED;
|
|
730
|
+
});
|
|
731
|
+
};
|
|
732
|
+
stack.steps = _removeRecursively(stack.steps);
|
|
733
|
+
}
|
|
734
|
+
}, {
|
|
735
|
+
key: "getStaticTestMetadata",
|
|
736
|
+
value: function getStaticTestMetadata(test) {
|
|
737
|
+
var _ref3, _test$parent$project, _titleMetadata$labels;
|
|
738
|
+
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
739
|
+
var project = (_ref3 = (_test$parent$project = test.parent.project()) !== null && _test$parent$project !== void 0 ? _test$parent$project : this.config.projects.find(function (candidate) {
|
|
740
|
+
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(_nodePath["default"].sep));
|
|
741
|
+
})) !== null && _ref3 !== void 0 ? _ref3 : this.config.projects[0];
|
|
742
|
+
var testFilePath = _nodePath["default"].relative(project.testDir, test.location.file);
|
|
743
|
+
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
744
|
+
var relativeFile = relativeFileParts.join("/");
|
|
745
|
+
var normalizedAbsoluteFile = _nodePath["default"].normalize(test.location.file);
|
|
746
|
+
var normalizedRelativeFile = _nodePath["default"].normalize(testFilePath);
|
|
747
|
+
var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
|
|
748
|
+
var suiteTitles = test.parent.titlePath().filter(Boolean);
|
|
749
|
+
if (project.name && suiteTitles[0] === project.name) {
|
|
750
|
+
suiteTitles = suiteTitles.slice(1);
|
|
751
|
+
}
|
|
752
|
+
if (suiteTitles.length > 0 && fileTitleCandidates.has(_nodePath["default"].normalize(suiteTitles[0]))) {
|
|
753
|
+
suiteTitles = suiteTitles.slice(1);
|
|
754
|
+
}
|
|
755
|
+
var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
756
|
+
var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
|
|
757
|
+
var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
|
|
758
|
+
return label.name === _allureJsCommons.LabelName.ALLURE_ID;
|
|
759
|
+
})) === null || _titleMetadata$labels === void 0 ? void 0 : _titleMetadata$labels.value;
|
|
760
|
+
|
|
761
|
+
// Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
|
|
762
|
+
if (!staticAllureId && "annotations" in test) {
|
|
763
|
+
var _iterator5 = _createForOfIteratorHelper(test.annotations),
|
|
764
|
+
_step5;
|
|
765
|
+
try {
|
|
766
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
767
|
+
var annotation = _step5.value;
|
|
768
|
+
var label = (0, _sdk.getMetadataLabel)(annotation.type, annotation.description);
|
|
769
|
+
if ((label === null || label === void 0 ? void 0 : label.name) === _allureJsCommons.LabelName.ALLURE_ID) {
|
|
770
|
+
staticAllureId = label.value;
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
} catch (err) {
|
|
775
|
+
_iterator5.e(err);
|
|
776
|
+
} finally {
|
|
777
|
+
_iterator5.f();
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
project: project,
|
|
782
|
+
testFilePath: testFilePath,
|
|
783
|
+
relativeFileParts: relativeFileParts,
|
|
784
|
+
suiteTitles: suiteTitles,
|
|
785
|
+
testCaseIdBase: "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title),
|
|
786
|
+
titleMetadata: titleMetadata,
|
|
787
|
+
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
|
|
788
|
+
legacyFullName: legacyFullName,
|
|
789
|
+
staticAllureId: staticAllureId
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
}, {
|
|
793
|
+
key: "isInTestPlan",
|
|
794
|
+
value: function isInTestPlan(test) {
|
|
795
|
+
if (!this.testPlan) {
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
var _this$getStaticTestMe = this.getStaticTestMetadata(test),
|
|
799
|
+
fullName = _this$getStaticTestMe.fullName,
|
|
800
|
+
legacyFullName = _this$getStaticTestMe.legacyFullName,
|
|
801
|
+
staticAllureId = _this$getStaticTestMe.staticAllureId;
|
|
802
|
+
return (0, _reporter.includedInTestPlan)(this.testPlan, {
|
|
803
|
+
fullName: fullName,
|
|
804
|
+
id: staticAllureId
|
|
805
|
+
}) || (0, _reporter.includedInTestPlan)(this.testPlan, {
|
|
806
|
+
fullName: legacyFullName,
|
|
807
|
+
id: staticAllureId
|
|
808
|
+
});
|
|
809
|
+
}
|
|
740
810
|
}, {
|
|
741
811
|
key: "processStepMetadataMessage",
|
|
742
812
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
@@ -752,6 +822,23 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
752
822
|
(_step$parameters = step.parameters).push.apply(_step$parameters, _toConsumableArray(parameters));
|
|
753
823
|
});
|
|
754
824
|
}
|
|
825
|
+
}, {
|
|
826
|
+
key: "processHookStepMetadataMessage",
|
|
827
|
+
value: function processHookStepMetadataMessage(stack, attachmentStepUuid, message) {
|
|
828
|
+
var _step$parameters2;
|
|
829
|
+
var step = stack === null || stack === void 0 ? void 0 : stack.findStepByUuid(attachmentStepUuid);
|
|
830
|
+
if (!step) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
var _message$data2 = message.data,
|
|
834
|
+
name = _message$data2.name,
|
|
835
|
+
_message$data2$parame = _message$data2.parameters,
|
|
836
|
+
parameters = _message$data2$parame === void 0 ? [] : _message$data2$parame;
|
|
837
|
+
if (name) {
|
|
838
|
+
step.name = name;
|
|
839
|
+
}
|
|
840
|
+
(_step$parameters2 = step.parameters).push.apply(_step$parameters2, _toConsumableArray(parameters));
|
|
841
|
+
}
|
|
755
842
|
}, {
|
|
756
843
|
key: "processAttachment",
|
|
757
844
|
value: function () {
|
|
@@ -775,20 +862,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
775
862
|
return _context6.a(2);
|
|
776
863
|
case 2:
|
|
777
864
|
if (!allureRuntimeMessage) {
|
|
778
|
-
_context6.n = 4;
|
|
779
|
-
break;
|
|
780
|
-
}
|
|
781
|
-
message = JSON.parse(attachment.body.toString());
|
|
782
|
-
if (!(message.type === "step_metadata")) {
|
|
783
865
|
_context6.n = 3;
|
|
784
866
|
break;
|
|
785
867
|
}
|
|
786
|
-
|
|
787
|
-
return _context6.a(2);
|
|
788
|
-
case 3:
|
|
868
|
+
message = JSON.parse(attachment.body.toString());
|
|
789
869
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
790
870
|
return _context6.a(2);
|
|
791
|
-
case
|
|
871
|
+
case 3:
|
|
792
872
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
793
873
|
name: attachment.name
|
|
794
874
|
}); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
|
|
@@ -798,42 +878,42 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
798
878
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
799
879
|
}
|
|
800
880
|
if (!attachment.body) {
|
|
801
|
-
_context6.n =
|
|
881
|
+
_context6.n = 4;
|
|
802
882
|
break;
|
|
803
883
|
}
|
|
804
884
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
805
885
|
contentType: attachment.contentType
|
|
806
886
|
});
|
|
807
|
-
_context6.n =
|
|
887
|
+
_context6.n = 6;
|
|
808
888
|
break;
|
|
809
|
-
case
|
|
889
|
+
case 4:
|
|
810
890
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
811
|
-
_context6.n =
|
|
891
|
+
_context6.n = 5;
|
|
812
892
|
break;
|
|
813
893
|
}
|
|
814
894
|
return _context6.a(2);
|
|
815
|
-
case
|
|
816
|
-
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ?
|
|
895
|
+
case 5:
|
|
896
|
+
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? _allureJsCommons.ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
|
|
817
897
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
818
898
|
contentType: contentType
|
|
819
899
|
});
|
|
820
|
-
case
|
|
900
|
+
case 6:
|
|
821
901
|
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
822
|
-
_context6.n =
|
|
902
|
+
_context6.n = 7;
|
|
823
903
|
break;
|
|
824
904
|
}
|
|
825
905
|
return _context6.a(2);
|
|
826
|
-
case
|
|
906
|
+
case 7:
|
|
827
907
|
pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
828
908
|
pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
829
909
|
if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
|
|
830
|
-
_context6.n =
|
|
910
|
+
_context6.n = 8;
|
|
831
911
|
break;
|
|
832
912
|
}
|
|
833
913
|
return _context6.a(2);
|
|
834
|
-
case
|
|
914
|
+
case 8:
|
|
835
915
|
fileExists = /*#__PURE__*/function () {
|
|
836
|
-
var
|
|
916
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
|
|
837
917
|
return _regenerator().w(function (_context4) {
|
|
838
918
|
while (1) switch (_context4.n) {
|
|
839
919
|
case 0:
|
|
@@ -849,11 +929,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
849
929
|
}, _callee4);
|
|
850
930
|
}));
|
|
851
931
|
return function fileExists(_x6) {
|
|
852
|
-
return
|
|
932
|
+
return _ref4.apply(this, arguments);
|
|
853
933
|
};
|
|
854
934
|
}();
|
|
855
935
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
856
|
-
var
|
|
936
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
|
|
857
937
|
var defaultPath, snapshotPath;
|
|
858
938
|
return _regenerator().w(function (_context5) {
|
|
859
939
|
while (1) switch (_context5.n) {
|
|
@@ -889,20 +969,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
889
969
|
}, _callee5);
|
|
890
970
|
}));
|
|
891
971
|
return function readImageFromDirs(_x7) {
|
|
892
|
-
return
|
|
972
|
+
return _ref5.apply(this, arguments);
|
|
893
973
|
};
|
|
894
974
|
}();
|
|
895
|
-
_context6.n =
|
|
975
|
+
_context6.n = 9;
|
|
896
976
|
return readImageFromDirs("actual");
|
|
897
|
-
case
|
|
977
|
+
case 9:
|
|
898
978
|
actualBase64 = _context6.v;
|
|
899
|
-
_context6.n =
|
|
979
|
+
_context6.n = 10;
|
|
900
980
|
return readImageFromDirs("expected");
|
|
901
|
-
case
|
|
981
|
+
case 10:
|
|
902
982
|
expectedBase64 = _context6.v;
|
|
903
|
-
_context6.n =
|
|
983
|
+
_context6.n = 11;
|
|
904
984
|
return readImageFromDirs("diff");
|
|
905
|
-
case
|
|
985
|
+
case 11:
|
|
906
986
|
diffBase64 = _context6.v;
|
|
907
987
|
diffName = attachment.name.replace(_utils.diffEndRegexp, "");
|
|
908
988
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
@@ -915,7 +995,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
915
995
|
fileExtension: ".imagediff"
|
|
916
996
|
});
|
|
917
997
|
this.processedDiffs.push(pathWithoutEnd);
|
|
918
|
-
case
|
|
998
|
+
case 12:
|
|
919
999
|
return _context6.a(2);
|
|
920
1000
|
}
|
|
921
1001
|
}, _callee6, this);
|
|
@@ -951,6 +1031,22 @@ function _shouldIgnoreStep(step) {
|
|
|
951
1031
|
}
|
|
952
1032
|
return false;
|
|
953
1033
|
}
|
|
1034
|
+
function _getOrCreateHookStack(testId, isBeforeHook, startTime) {
|
|
1035
|
+
var map = isBeforeHook ? this.beforeHooksStepsStack : this.afterHooksStepsStack;
|
|
1036
|
+
var stack = map.get(testId);
|
|
1037
|
+
if (!stack) {
|
|
1038
|
+
stack = new _reporter.ShallowStepsStack();
|
|
1039
|
+
var rootHookStep = _objectSpread(_objectSpread({}, (0, _reporter.createStepResult)()), {}, {
|
|
1040
|
+
name: isBeforeHook ? _utils.BEFORE_HOOKS_ROOT_STEP_TITLE : _utils.AFTER_HOOKS_ROOT_STEP_TITLE,
|
|
1041
|
+
start: startTime.getTime(),
|
|
1042
|
+
stage: _allureJsCommons.Stage.RUNNING,
|
|
1043
|
+
uuid: (0, _reporter.randomUuid)()
|
|
1044
|
+
});
|
|
1045
|
+
stack.startStep(rootHookStep);
|
|
1046
|
+
map.set(testId, stack);
|
|
1047
|
+
}
|
|
1048
|
+
return stack;
|
|
1049
|
+
}
|
|
954
1050
|
var allure = exports.allure = _legacy.allurePlaywrightLegacyApi;
|
|
955
1051
|
|
|
956
1052
|
/**
|