allure-playwright 3.7.2 → 3.9.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/esm/index.js CHANGED
@@ -1,9 +1,8 @@
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
- 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
- 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
1
  function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
5
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
3
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
4
+ 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 }; })(); }
5
+ 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); }
7
6
  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
7
  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
8
  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; } } }; }
@@ -13,6 +12,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
13
12
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
13
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
14
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
18
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -26,6 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
26
26
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
27
27
  import { existsSync } from "node:fs";
28
28
  import { access } from "node:fs/promises";
29
+ import { createRequire } from "node:module";
29
30
  import path from "node:path";
30
31
  import process from "node:process";
31
32
 
@@ -33,9 +34,12 @@ import process from "node:process";
33
34
 
34
35
  import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
35
36
  import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
36
- import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
37
+ import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
37
38
  import { allurePlaywrightLegacyApi } from "./legacy.js";
38
39
  import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, finalizeStepResult, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
40
+ var localRequire = typeof require === "function" ? require : createRequire(import.meta.url);
41
+ var testPlanFilterSymbol = Symbol["for"]("allure-playwright.testPlanFilter");
42
+ var testPlanFilterPatchSymbol = Symbol["for"]("allure-playwright.testPlanFilterPatch");
39
43
  var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
40
44
  export var AllureReporter = /*#__PURE__*/function () {
41
45
  function AllureReporter(config) {
@@ -54,6 +58,8 @@ export var AllureReporter = /*#__PURE__*/function () {
54
58
  _defineProperty(this, "attachmentTargets", new Map());
55
59
  _defineProperty(this, "beforeHooksStepsStack", new Map());
56
60
  _defineProperty(this, "afterHooksStepsStack", new Map());
61
+ _defineProperty(this, "pendingAttachmentTasks", new Map());
62
+ _defineProperty(this, "attachmentTargetByStep", new WeakMap());
57
63
  _defineProperty(this, "pwStepUuid", new WeakMap());
58
64
  _defineProperty(this, "testPlan", parseTestPlan());
59
65
  this.options = _objectSpread({
@@ -64,7 +70,8 @@ export var AllureReporter = /*#__PURE__*/function () {
64
70
  return _createClass(AllureReporter, [{
65
71
  key: "onConfigure",
66
72
  value: function onConfigure(config) {
67
- var _this = this;
73
+ var _configElement$preOnl,
74
+ _this = this;
68
75
  this.config = config;
69
76
  this.outputDir = config.projects[0].outputDir;
70
77
  this.snapshotDir = config.projects[0].snapshotDir;
@@ -72,13 +79,13 @@ export var AllureReporter = /*#__PURE__*/function () {
72
79
  if (!testPlan) {
73
80
  return;
74
81
  }
75
-
76
- // @ts-ignore
77
- var configElement = config[Object.getOwnPropertySymbols(config)[0]];
78
- if (!configElement) {
79
- return;
80
- }
81
- configElement.preOnlyTestFilters.push(function (test) {
82
+ this.installTestPlanExecutionFilter();
83
+ var configElement = Object.getOwnPropertySymbols(config).map(function (symbol) {
84
+ return config[symbol];
85
+ }).find(function (value) {
86
+ return _typeof(value) === "object" && value !== null && ("preOnlyTestFilters" in value || "cliArgs" in value);
87
+ });
88
+ configElement === null || configElement === void 0 || (_configElement$preOnl = configElement.preOnlyTestFilters) === null || _configElement$preOnl === void 0 || _configElement$preOnl.push(function (test) {
82
89
  return _this.isInTestPlan(test);
83
90
  });
84
91
  if (testPlan.tests.some(function (test) {
@@ -126,7 +133,9 @@ export var AllureReporter = /*#__PURE__*/function () {
126
133
  if (!cliArgs.length) {
127
134
  return;
128
135
  }
129
- configElement.cliArgs = cliArgs;
136
+ if (configElement) {
137
+ configElement.cliArgs = cliArgs;
138
+ }
130
139
  }
131
140
  }, {
132
141
  key: "onError",
@@ -155,6 +164,7 @@ export var AllureReporter = /*#__PURE__*/function () {
155
164
  value: function onTestBegin(test) {
156
165
  var _metadata$relativeFil, _metadata$project, _metadata$project2;
157
166
  var metadata = this.getStaticTestMetadata(test);
167
+ var titlePath = metadata.projectName ? [metadata.projectName].concat(_toConsumableArray(metadata.relativeFileParts), _toConsumableArray(metadata.suiteTitles)) : (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles));
158
168
  var result = {
159
169
  name: metadata.titleMetadata.cleanTitle,
160
170
  labels: [].concat(_toConsumableArray(metadata.titleMetadata.labels), _toConsumableArray(getEnvironmentLabels())),
@@ -163,11 +173,12 @@ export var AllureReporter = /*#__PURE__*/function () {
163
173
  steps: [],
164
174
  testCaseId: md5(metadata.testCaseIdBase),
165
175
  fullName: metadata.fullName,
166
- titlePath: (_metadata$relativeFil = metadata.relativeFileParts).concat.apply(_metadata$relativeFil, _toConsumableArray(metadata.suiteTitles))
176
+ titlePath: titlePath
167
177
  };
168
178
  result.labels.push(getLanguageLabel());
169
179
  result.labels.push(getFrameworkLabel("playwright"));
170
- result.labels.push(getPackageLabel(metadata.testFilePath));
180
+ result.labels.push(getPackageLabel(metadata.testFilePath, metadata.projectRootSearchFrom));
181
+ result.labels.push(getFallbackTestCaseIdLabel(md5(metadata.legacyTestCaseIdBase)));
171
182
  result.labels.push({
172
183
  name: "titlePath",
173
184
  value: test.parent.titlePath().join(" > ")
@@ -250,17 +261,275 @@ export var AllureReporter = /*#__PURE__*/function () {
250
261
  this.allureResultsUuids.set(test.id, testUuid);
251
262
  this.startedTestCasesTitlesCache.push(metadata.titleMetadata.cleanTitle);
252
263
  }
264
+ }, {
265
+ key: "queueAttachmentTask",
266
+ value: function queueAttachmentTask(testId, task) {
267
+ var _this$pendingAttachme;
268
+ var tasks = (_this$pendingAttachme = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme !== void 0 ? _this$pendingAttachme : [];
269
+ tasks.push(task);
270
+ this.pendingAttachmentTasks.set(testId, tasks);
271
+ }
272
+ }, {
273
+ key: "flushAttachmentTasks",
274
+ value: function () {
275
+ var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(testId) {
276
+ var _this$pendingAttachme2;
277
+ var tasks;
278
+ return _regenerator().w(function (_context) {
279
+ while (1) switch (_context.n) {
280
+ case 0:
281
+ tasks = (_this$pendingAttachme2 = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme2 !== void 0 ? _this$pendingAttachme2 : [];
282
+ this.pendingAttachmentTasks["delete"](testId);
283
+ if (!(tasks.length > 0)) {
284
+ _context.n = 1;
285
+ break;
286
+ }
287
+ _context.n = 1;
288
+ return Promise.all(tasks);
289
+ case 1:
290
+ return _context.a(2);
291
+ }
292
+ }, _callee, this);
293
+ }));
294
+ function flushAttachmentTasks(_x) {
295
+ return _flushAttachmentTasks.apply(this, arguments);
296
+ }
297
+ return flushAttachmentTasks;
298
+ }()
299
+ }, {
300
+ key: "recordAttachmentTarget",
301
+ value: function recordAttachmentTarget(testId, target) {
302
+ var _this$attachmentTarge;
303
+ var targets = (_this$attachmentTarge = this.attachmentTargets.get(testId)) !== null && _this$attachmentTarge !== void 0 ? _this$attachmentTarge : [];
304
+ targets.push(target);
305
+ this.attachmentTargets.set(testId, targets);
306
+ }
307
+ }, {
308
+ key: "getHookStepsStack",
309
+ value: function getHookStepsStack(testId, hookStep) {
310
+ return hookStep.hookScope === "before" ? this.beforeHooksStepsStack.get(testId) : this.afterHooksStepsStack.get(testId);
311
+ }
312
+ }, {
313
+ key: "removeHookAttachmentPlaceholder",
314
+ value: function removeHookAttachmentPlaceholder(steps, stepUuid) {
315
+ var index = steps.findIndex(function (step) {
316
+ return step.uuid === stepUuid;
317
+ });
318
+ if (index !== -1) {
319
+ steps.splice(index, 1);
320
+ return true;
321
+ }
322
+ var _iterator2 = _createForOfIteratorHelper(steps),
323
+ _step2;
324
+ try {
325
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
326
+ var step = _step2.value;
327
+ if (this.removeHookAttachmentPlaceholder(step.steps, stepUuid)) {
328
+ return true;
329
+ }
330
+ }
331
+ } catch (err) {
332
+ _iterator2.e(err);
333
+ } finally {
334
+ _iterator2.f();
335
+ }
336
+ return false;
337
+ }
338
+ }, {
339
+ key: "addAttachmentToHookStep",
340
+ value: function addAttachmentToHookStep(test, hookStep, attachment) {
341
+ var targetStack = this.getHookStepsStack(test.id, hookStep);
342
+ if (!targetStack) {
343
+ return;
344
+ }
345
+ var stepResult = targetStack.findStepByUuid(hookStep.uuid);
346
+ if (!stepResult) {
347
+ return;
348
+ }
349
+ var fileName = targetStack.addAttachment(attachment, this.allureRuntime.writer);
350
+ stepResult.attachments.push({
351
+ name: attachment.name,
352
+ type: attachment.contentType,
353
+ source: fileName
354
+ });
355
+ }
356
+ }, {
357
+ key: "addRuntimeAttachmentToHookStack",
358
+ value: function addRuntimeAttachmentToHookStack(targetStack, attachment, options) {
359
+ var _this2 = this;
360
+ var currentStep = targetStack.currentStep();
361
+ if (!currentStep) {
362
+ return;
363
+ }
364
+ var addAttachment = function addAttachment(stepResult) {
365
+ var fileName = targetStack.addAttachment(attachment, _this2.allureRuntime.writer);
366
+ stepResult.attachments.push({
367
+ name: attachment.name,
368
+ type: attachment.contentType,
369
+ source: fileName
370
+ });
371
+ };
372
+ if (options !== null && options !== void 0 && options.wrapInStep) {
373
+ targetStack.startStep({
374
+ name: attachment.name,
375
+ start: options.timestamp
376
+ });
377
+ addAttachment(targetStack.currentStep());
378
+ targetStack.stopStep({
379
+ stop: options.timestamp
380
+ });
381
+ return;
382
+ }
383
+ addAttachment(currentStep);
384
+ }
385
+ }, {
386
+ key: "processHookRuntimeMessage",
387
+ value: function processHookRuntimeMessage(test, testUuid, hookStep, attachment) {
388
+ if (!attachment.body) {
389
+ return false;
390
+ }
391
+ var targetStack = this.getHookStepsStack(test.id, hookStep);
392
+ if (!targetStack) {
393
+ return false;
394
+ }
395
+ this.removeHookAttachmentPlaceholder(targetStack.steps, hookStep.uuid);
396
+ var message = JSON.parse(attachment.body.toString());
397
+ switch (message.type) {
398
+ case "step_start":
399
+ targetStack.startStep(_objectSpread({}, message.data));
400
+ return true;
401
+ case "step_stop":
402
+ {
403
+ var currentStep = targetStack.currentStep();
404
+ if (!currentStep) {
405
+ return false;
406
+ }
407
+ targetStack.updateStep(function (stepResult) {
408
+ if (message.data.status && !stepResult.status) {
409
+ stepResult.status = message.data.status;
410
+ }
411
+ if (message.data.statusDetails) {
412
+ stepResult.statusDetails = _objectSpread(_objectSpread({}, stepResult.statusDetails), message.data.statusDetails);
413
+ }
414
+ });
415
+ targetStack.stopStep({
416
+ stop: message.data.stop
417
+ });
418
+ return true;
419
+ }
420
+ case "step_metadata":
421
+ {
422
+ var _currentStep$paramete, _message$data$paramet;
423
+ var _currentStep = targetStack.currentStep();
424
+ if (!_currentStep) {
425
+ return false;
426
+ }
427
+ if (message.data.name) {
428
+ _currentStep.name = message.data.name;
429
+ }
430
+ (_currentStep$paramete = _currentStep.parameters).push.apply(_currentStep$paramete, _toConsumableArray((_message$data$paramet = message.data.parameters) !== null && _message$data$paramet !== void 0 ? _message$data$paramet : []));
431
+ return true;
432
+ }
433
+ case "attachment_content":
434
+ this.addRuntimeAttachmentToHookStack(targetStack, {
435
+ name: message.data.name,
436
+ body: Buffer.from(message.data.content, message.data.encoding),
437
+ contentType: message.data.contentType
438
+ }, {
439
+ wrapInStep: message.data.wrapInStep,
440
+ timestamp: message.data.timestamp
441
+ });
442
+ return true;
443
+ case "attachment_path":
444
+ this.addRuntimeAttachmentToHookStack(targetStack, {
445
+ name: message.data.name,
446
+ path: message.data.path,
447
+ contentType: message.data.contentType
448
+ }, {
449
+ wrapInStep: message.data.wrapInStep,
450
+ timestamp: message.data.timestamp
451
+ });
452
+ return true;
453
+ default:
454
+ this.queueAttachmentTask(test.id, this.processAttachment(testUuid, undefined, attachment));
455
+ return true;
456
+ }
457
+ }
458
+ }, {
459
+ key: "shouldProcessAttachmentAtTestEnd",
460
+ value: function shouldProcessAttachmentAtTestEnd(attachment) {
461
+ if (attachment.name.match(diffEndRegexp)) {
462
+ return true;
463
+ }
464
+ if (attachment.contentType === "application/vnd.allure.playwright-trace") {
465
+ return true;
466
+ }
467
+ return attachment.name === "trace" && attachment.contentType === "application/zip";
468
+ }
469
+ }, {
470
+ key: "processStepEndAttachments",
471
+ value: function processStepEndAttachments(test, step) {
472
+ var _step$attachments;
473
+ var testUuid = this.allureResultsUuids.get(test.id);
474
+ var stepAttachments = (_step$attachments = step.attachments) !== null && _step$attachments !== void 0 ? _step$attachments : [];
475
+ var stepInfo = this.attachmentTargetByStep.get(step);
476
+ var hasExplicitParent = Boolean((stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.hookStep) || (stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid));
477
+ if (stepAttachments.length === 0) {
478
+ if (stepInfo) {
479
+ this.recordAttachmentTarget(test.id, stepInfo);
480
+ }
481
+ return;
482
+ }
483
+ var _iterator3 = _createForOfIteratorHelper(stepAttachments),
484
+ _step3;
485
+ try {
486
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
487
+ var _stepInfo$hookStep$uu, _stepInfo$hookStep;
488
+ var attachment = _step3.value;
489
+ var isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
490
+ var attachmentTarget = _objectSpread(_objectSpread({}, stepInfo), {}, {
491
+ name: attachment.name
492
+ });
493
+ this.recordAttachmentTarget(test.id, attachmentTarget);
494
+ if (this.shouldProcessAttachmentAtTestEnd(attachment) || !isRuntimeMessage && !hasExplicitParent) {
495
+ continue;
496
+ }
497
+ attachmentTarget.processedAtStepEnd = true;
498
+ if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep && isRuntimeMessage) {
499
+ if (!this.processHookRuntimeMessage(test, testUuid, stepInfo.hookStep, attachment)) {
500
+ attachmentTarget.processedAtStepEnd = false;
501
+ }
502
+ continue;
503
+ }
504
+ if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
505
+ this.addAttachmentToHookStep(test, stepInfo.hookStep, attachment);
506
+ continue;
507
+ }
508
+ var attachmentStepUuid = (_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;
509
+ this.queueAttachmentTask(test.id, this.processAttachment(testUuid, attachmentStepUuid, attachment));
510
+ }
511
+ } catch (err) {
512
+ _iterator3.e(err);
513
+ } finally {
514
+ _iterator3.f();
515
+ }
516
+ }
253
517
  }, {
254
518
  key: "onStepBegin",
255
519
  value: function onStepBegin(test, _result, step) {
256
520
  var _this$pwStepUuid$get2;
521
+ var testUuid = this.allureResultsUuids.get(test.id);
522
+ if (!testUuid) {
523
+ // eslint-disable-next-line no-console
524
+ console.warn("[allure-playwright] Ignoring onStepBegin for \"".concat(test.title, "\", step \"").concat(step.title, "\" (").concat(step.category, ") ") + "because no Allure test result has been started.");
525
+ return;
526
+ }
257
527
  var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
258
528
  var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
259
529
  var isRootHook = isRootBeforeHook || isRootAfterHook;
260
530
  var isBeforeHookDescendant = isBeforeHookStep(step);
261
531
  var isAfterHookDescendant = isAfterHookStep(step);
262
532
  var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
263
- var testUuid = this.allureResultsUuids.get(test.id);
264
533
  if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
265
534
  return;
266
535
  }
@@ -271,19 +540,17 @@ export var AllureReporter = /*#__PURE__*/function () {
271
540
  uuid: randomUuid()
272
541
  });
273
542
  if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
274
- var _this$pwStepUuid$get, _this$attachmentTarge;
543
+ var _this$pwStepUuid$get;
275
544
  var parent = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
276
- var targets = (_this$attachmentTarge = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge !== void 0 ? _this$attachmentTarge : [];
277
- targets.push({
545
+ this.attachmentTargetByStep.set(step, {
278
546
  name: normalizeAttachStepTitle(step.title),
279
547
  stepUuid: parent !== null && parent !== void 0 ? parent : undefined
280
548
  });
281
- this.attachmentTargets.set(test.id, targets);
282
549
  return;
283
550
  }
284
551
  if (isHookStep) {
285
552
  if (["test.attach", "attach"].includes(step.category)) {
286
- var _stack$currentStep, _this$attachmentTarge2;
553
+ var _stack$currentStep;
287
554
  var attachmentName = normalizeAttachStepTitle(step.title);
288
555
  var _stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
289
556
  var hookStepWithUuid;
@@ -291,19 +558,18 @@ export var AllureReporter = /*#__PURE__*/function () {
291
558
  _stack.startStep(baseStep);
292
559
  _stack.updateStep(function (stepResult) {
293
560
  hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
294
- uuid: stepResult.uuid
561
+ uuid: stepResult.uuid,
562
+ hookScope: isBeforeHookDescendant ? "before" : "after"
295
563
  });
296
564
  stepResult.name = normalizeHookTitle(stepResult.name);
297
565
  stepResult.stage = Stage.FINISHED;
298
566
  });
299
567
  _stack.stopStep();
300
- var _targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
301
- _targets.push({
568
+ this.attachmentTargetByStep.set(step, {
302
569
  name: attachmentName,
303
570
  hookStep: hookStepWithUuid,
304
571
  stepUuid: attachmentName === "Allure Step Metadata" ? parentHookStepUuid : undefined
305
572
  });
306
- this.attachmentTargets.set(test.id, _targets);
307
573
  return;
308
574
  }
309
575
  var stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
@@ -329,6 +595,12 @@ export var AllureReporter = /*#__PURE__*/function () {
329
595
  }, {
330
596
  key: "onStepEnd",
331
597
  value: function onStepEnd(test, _result, step) {
598
+ var testUuid = this.allureResultsUuids.get(test.id);
599
+ if (!testUuid) {
600
+ // eslint-disable-next-line no-console
601
+ console.warn("[allure-playwright] Ignoring onStepEnd for \"".concat(test.title, "\", step \"").concat(step.title, "\" (").concat(step.category, ") ") + "because no Allure test result has been started.");
602
+ return;
603
+ }
332
604
  var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
333
605
  var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
334
606
  var isRootHook = isRootBeforeHook || isRootAfterHook;
@@ -351,11 +623,10 @@ export var AllureReporter = /*#__PURE__*/function () {
351
623
  if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
352
624
  return;
353
625
  }
354
- // ignore test.attach steps since attachments are already in the report
355
626
  if (["test.attach", "attach"].includes(step.category)) {
627
+ this.processStepEndAttachments(test, step);
356
628
  return;
357
629
  }
358
- var testUuid = this.allureResultsUuids.get(test.id);
359
630
  var isBeforeHookDescendant = isBeforeHookStep(step);
360
631
  var isAfterHookDescendant = isAfterHookStep(step);
361
632
  var isAfterHook = isAfterHookDescendant;
@@ -393,14 +664,23 @@ export var AllureReporter = /*#__PURE__*/function () {
393
664
  }, {
394
665
  key: "onTestEnd",
395
666
  value: function () {
396
- var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(test, result) {
397
- var _this2 = this,
398
- _this$attachmentTarge3;
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;
400
- return _regenerator().w(function (_context) {
401
- while (1) switch (_context.n) {
667
+ var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(test, result) {
668
+ var _this3 = this,
669
+ _this$attachmentTarge2;
670
+ var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator4, _step4, _targetsByName$get, t, q, takeByName, _iterator5, _step5, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu2, _stepInfo$hookStep2, message, targetStack, _targetStack, stepUuid, _targetStack2, stepResult, fileName, _t;
671
+ return _regenerator().w(function (_context2) {
672
+ while (1) switch (_context2.n) {
402
673
  case 0:
403
- testUuid = this.allureResultsUuids.get(test.id); // We need to check parallelIndex first because pw introduced this field only in v1.30.0
674
+ testUuid = this.allureResultsUuids.get(test.id);
675
+ if (testUuid) {
676
+ _context2.n = 1;
677
+ break;
678
+ }
679
+ // eslint-disable-next-line no-console
680
+ console.warn("[allure-playwright] Ignoring onTestEnd for \"".concat(test.title, "\" because no Allure test result has been started."));
681
+ return _context2.a(2);
682
+ case 1:
683
+ // We need to check parallelIndex first because pw introduced this field only in v1.30.0
404
684
  threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
405
685
  thread = "pid-".concat(process.pid, "-worker-").concat(threadId);
406
686
  error = result.error; // only apply default suites if not set by user
@@ -416,7 +696,7 @@ export var AllureReporter = /*#__PURE__*/function () {
416
696
  value: projectSuiteTitle
417
697
  });
418
698
  }
419
- if (_this2.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
699
+ if (_this3.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
420
700
  testResult.labels.push({
421
701
  name: LabelName.SUITE,
422
702
  value: fileSuiteTitle
@@ -456,20 +736,20 @@ export var AllureReporter = /*#__PURE__*/function () {
456
736
  }
457
737
 
458
738
  // FIFO
459
- targets = (_this$attachmentTarge3 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge3 !== void 0 ? _this$attachmentTarge3 : [];
739
+ targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
460
740
  targetsByName = new Map();
461
- _iterator2 = _createForOfIteratorHelper(targets);
741
+ _iterator4 = _createForOfIteratorHelper(targets);
462
742
  try {
463
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
464
- t = _step2.value;
743
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
744
+ t = _step4.value;
465
745
  q = (_targetsByName$get = targetsByName.get(t.name)) !== null && _targetsByName$get !== void 0 ? _targetsByName$get : [];
466
746
  q.push(t);
467
747
  targetsByName.set(t.name, q);
468
748
  }
469
749
  } catch (err) {
470
- _iterator2.e(err);
750
+ _iterator4.e(err);
471
751
  } finally {
472
- _iterator2.f();
752
+ _iterator4.f();
473
753
  }
474
754
  takeByName = function takeByName(name) {
475
755
  var target = targetsByName.get(name);
@@ -478,52 +758,57 @@ export var AllureReporter = /*#__PURE__*/function () {
478
758
  }
479
759
  return target.shift();
480
760
  };
481
- _iterator3 = _createForOfIteratorHelper(result.attachments);
482
- _context.p = 1;
483
- _iterator3.s();
484
- case 2:
485
- if ((_step3 = _iterator3.n()).done) {
486
- _context.n = 10;
761
+ _iterator5 = _createForOfIteratorHelper(result.attachments);
762
+ _context2.p = 2;
763
+ _iterator5.s();
764
+ case 3:
765
+ if ((_step5 = _iterator5.n()).done) {
766
+ _context2.n = 12;
487
767
  break;
488
768
  }
489
- attachment = _step3.value;
769
+ attachment = _step5.value;
490
770
  isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
491
771
  stepInfo = takeByName(attachment.name);
772
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
773
+ _context2.n = 4;
774
+ break;
775
+ }
776
+ return _context2.a(3, 11);
777
+ case 4:
492
778
  if (!isRuntimeMessage) {
493
- _context.n = 5;
779
+ _context2.n = 7;
494
780
  break;
495
781
  }
496
782
  message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
497
783
  if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
498
- targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
784
+ targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
499
785
  this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
500
786
  }
501
787
  if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
502
- _context.n = 3;
788
+ _context2.n = 5;
503
789
  break;
504
790
  }
505
791
  if (stepInfo.hookStep) {
506
- _targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
792
+ _targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
507
793
  this.processHookStepMetadataMessage(_targetStack, stepInfo.stepUuid, message);
508
794
  } else {
509
795
  this.processStepMetadataMessage(stepInfo.stepUuid, message);
510
796
  }
511
- return _context.a(3, 9);
512
- case 3:
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;
514
- _context.n = 4;
515
- return this.processAttachment(testUuid, stepUuid, attachment);
516
- case 4:
517
- return _context.a(3, 9);
797
+ return _context2.a(3, 11);
518
798
  case 5:
799
+ stepUuid = (_stepInfo$hookStep$uu2 = stepInfo === null || stepInfo === void 0 || (_stepInfo$hookStep2 = stepInfo.hookStep) === null || _stepInfo$hookStep2 === void 0 ? void 0 : _stepInfo$hookStep2.uuid) !== null && _stepInfo$hookStep$uu2 !== void 0 ? _stepInfo$hookStep$uu2 : stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid;
800
+ _context2.n = 6;
801
+ return this.processAttachment(testUuid, stepUuid, attachment);
802
+ case 6:
803
+ return _context2.a(3, 11);
804
+ case 7:
519
805
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
520
- _context.n = 6;
806
+ _context2.n = 8;
521
807
  break;
522
808
  }
523
- hookStep = stepInfo.hookStep;
524
- _targetStack2 = isBeforeHookStep(hookStep) ? beforeHooksStack : afterHooksStack;
809
+ _targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
525
810
  if (_targetStack2) {
526
- stepResult = _targetStack2.findStepByUuid(hookStep.uuid);
811
+ stepResult = _targetStack2.findStepByUuid(stepInfo.hookStep.uuid);
527
812
  if (stepResult) {
528
813
  fileName = _targetStack2.addAttachment(attachment, this.allureRuntime.writer);
529
814
  stepResult.attachments.push({
@@ -533,34 +818,37 @@ export var AllureReporter = /*#__PURE__*/function () {
533
818
  });
534
819
  }
535
820
  }
536
- return _context.a(3, 9);
537
- case 6:
821
+ return _context2.a(3, 11);
822
+ case 8:
538
823
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
539
- _context.n = 8;
824
+ _context2.n = 10;
540
825
  break;
541
826
  }
542
- _context.n = 7;
827
+ _context2.n = 9;
543
828
  return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
544
- case 7:
545
- return _context.a(3, 9);
546
- case 8:
547
- _context.n = 9;
548
- return this.processAttachment(testUuid, undefined, attachment);
549
829
  case 9:
550
- _context.n = 2;
551
- break;
830
+ return _context2.a(3, 11);
552
831
  case 10:
553
- _context.n = 12;
554
- break;
832
+ _context2.n = 11;
833
+ return this.processAttachment(testUuid, undefined, attachment);
555
834
  case 11:
556
- _context.p = 11;
557
- _t = _context.v;
558
- _iterator3.e(_t);
835
+ _context2.n = 3;
836
+ break;
559
837
  case 12:
560
- _context.p = 12;
561
- _iterator3.f();
562
- return _context.f(12);
838
+ _context2.n = 14;
839
+ break;
563
840
  case 13:
841
+ _context2.p = 13;
842
+ _t = _context2.v;
843
+ _iterator5.e(_t);
844
+ case 14:
845
+ _context2.p = 14;
846
+ _iterator5.f();
847
+ return _context2.f(14);
848
+ case 15:
849
+ _context2.n = 16;
850
+ return this.flushAttachmentTasks(test.id);
851
+ case 16:
564
852
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
565
853
  // in next iterations we need to implement the logic for every javascript integration
566
854
  this.allureRuntime.updateTest(testUuid, function (testResult) {
@@ -580,14 +868,14 @@ export var AllureReporter = /*#__PURE__*/function () {
580
868
  });
581
869
  if (beforeHooksStack) {
582
870
  var _testResult$steps;
583
- (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
871
+ (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this3.pruneEmptyHookRoots(beforeHooksStack.steps)));
584
872
  }
585
- _this2.beforeHooksStepsStack["delete"](test.id);
873
+ _this3.beforeHooksStepsStack["delete"](test.id);
586
874
  if (afterHooksStack) {
587
875
  var _testResult$steps2;
588
- (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
876
+ (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this3.pruneEmptyHookRoots(afterHooksStack.steps)));
589
877
  }
590
- _this2.afterHooksStepsStack["delete"](test.id);
878
+ _this3.afterHooksStepsStack["delete"](test.id);
591
879
  testResult.labels = newLabels;
592
880
  });
593
881
  this.allureRuntime.stopTest(testUuid, {
@@ -595,12 +883,13 @@ export var AllureReporter = /*#__PURE__*/function () {
595
883
  });
596
884
  this.allureRuntime.writeTest(testUuid);
597
885
  this.attachmentTargets["delete"](test.id);
598
- case 14:
599
- return _context.a(2);
886
+ this.pendingAttachmentTasks["delete"](test.id);
887
+ case 17:
888
+ return _context2.a(2);
600
889
  }
601
- }, _callee, this, [[1, 11, 12, 13]]);
890
+ }, _callee2, this, [[2, 13, 14, 15]]);
602
891
  }));
603
- function onTestEnd(_x, _x2) {
892
+ function onTestEnd(_x2, _x3) {
604
893
  return _onTestEnd.apply(this, arguments);
605
894
  }
606
895
  return onTestEnd;
@@ -608,28 +897,28 @@ export var AllureReporter = /*#__PURE__*/function () {
608
897
  }, {
609
898
  key: "addSkippedResults",
610
899
  value: function () {
611
- var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
612
- var _this3 = this;
613
- var unprocessedCases, _iterator4, _step4, testCase, _t2;
614
- return _regenerator().w(function (_context2) {
615
- while (1) switch (_context2.n) {
900
+ var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
901
+ var _this4 = this;
902
+ var unprocessedCases, _iterator6, _step6, testCase, _t2;
903
+ return _regenerator().w(function (_context3) {
904
+ while (1) switch (_context3.n) {
616
905
  case 0:
617
- unprocessedCases = this.suite.allTests().filter(function (_ref2) {
618
- var title = _ref2.title;
906
+ unprocessedCases = this.suite.allTests().filter(function (testCase) {
907
+ var title = testCase.title;
619
908
  var titleMetadata = extractMetadataFromString(title);
620
- return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
909
+ return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
621
910
  });
622
- _iterator4 = _createForOfIteratorHelper(unprocessedCases);
623
- _context2.p = 1;
624
- _iterator4.s();
911
+ _iterator6 = _createForOfIteratorHelper(unprocessedCases);
912
+ _context3.p = 1;
913
+ _iterator6.s();
625
914
  case 2:
626
- if ((_step4 = _iterator4.n()).done) {
627
- _context2.n = 4;
915
+ if ((_step6 = _iterator6.n()).done) {
916
+ _context3.n = 4;
628
917
  break;
629
918
  }
630
- testCase = _step4.value;
919
+ testCase = _step6.value;
631
920
  this.onTestBegin(testCase);
632
- _context2.n = 3;
921
+ _context3.n = 3;
633
922
  return this.onTestEnd(testCase, {
634
923
  status: Status.SKIPPED,
635
924
  attachments: [],
@@ -645,23 +934,23 @@ export var AllureReporter = /*#__PURE__*/function () {
645
934
  annotations: []
646
935
  });
647
936
  case 3:
648
- _context2.n = 2;
937
+ _context3.n = 2;
649
938
  break;
650
939
  case 4:
651
- _context2.n = 6;
940
+ _context3.n = 6;
652
941
  break;
653
942
  case 5:
654
- _context2.p = 5;
655
- _t2 = _context2.v;
656
- _iterator4.e(_t2);
943
+ _context3.p = 5;
944
+ _t2 = _context3.v;
945
+ _iterator6.e(_t2);
657
946
  case 6:
658
- _context2.p = 6;
659
- _iterator4.f();
660
- return _context2.f(6);
947
+ _context3.p = 6;
948
+ _iterator6.f();
949
+ return _context3.f(6);
661
950
  case 7:
662
- return _context2.a(2);
951
+ return _context3.a(2);
663
952
  }
664
- }, _callee2, this, [[1, 5, 6, 7]]);
953
+ }, _callee3, this, [[1, 5, 6, 7]]);
665
954
  }));
666
955
  function addSkippedResults() {
667
956
  return _addSkippedResults.apply(this, arguments);
@@ -671,19 +960,19 @@ export var AllureReporter = /*#__PURE__*/function () {
671
960
  }, {
672
961
  key: "onEnd",
673
962
  value: function () {
674
- var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
675
- return _regenerator().w(function (_context3) {
676
- while (1) switch (_context3.n) {
963
+ var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
964
+ return _regenerator().w(function (_context4) {
965
+ while (1) switch (_context4.n) {
677
966
  case 0:
678
- _context3.n = 1;
967
+ _context4.n = 1;
679
968
  return this.addSkippedResults();
680
969
  case 1:
681
970
  this.allureRuntime.writeEnvironmentInfo();
682
971
  this.allureRuntime.writeCategoriesDefinitions();
683
972
  case 2:
684
- return _context3.a(2);
973
+ return _context4.a(2);
685
974
  }
686
- }, _callee3, this);
975
+ }, _callee4, this);
687
976
  }));
688
977
  function onEnd() {
689
978
  return _onEnd.apply(this, arguments);
@@ -695,9 +984,30 @@ export var AllureReporter = /*#__PURE__*/function () {
695
984
  value: function printsToStdio() {
696
985
  return false;
697
986
  }
987
+ }, {
988
+ key: "isEmptyPassedHookRoot",
989
+ value: function isEmptyPassedHookRoot(step) {
990
+ if (this.options.detail) {
991
+ return false;
992
+ }
993
+ 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;
994
+ }
995
+ }, {
996
+ key: "pruneEmptyHookRoots",
997
+ value: function pruneEmptyHookRoots(steps) {
998
+ var _this5 = this;
999
+ return steps.map(function (step) {
1000
+ return _objectSpread(_objectSpread({}, step), {}, {
1001
+ steps: _this5.pruneEmptyHookRoots(step.steps)
1002
+ });
1003
+ }).filter(function (step) {
1004
+ return !_this5.isEmptyPassedHookRoot(step);
1005
+ });
1006
+ }
698
1007
  }, {
699
1008
  key: "removeStepFromHookStack",
700
1009
  value: function removeStepFromHookStack(stack, stepUuid) {
1010
+ var _this6 = this;
701
1011
  if (!stack) {
702
1012
  return;
703
1013
  }
@@ -709,26 +1019,27 @@ export var AllureReporter = /*#__PURE__*/function () {
709
1019
  steps: _removeRecursively(step.steps)
710
1020
  });
711
1021
  }).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;
1022
+ return !_this6.isEmptyPassedHookRoot(step);
713
1023
  });
714
1024
  };
715
1025
  stack.steps = _removeRecursively(stack.steps);
716
1026
  }
717
1027
  }, {
718
1028
  key: "getStaticTestMetadata",
719
- value: function getStaticTestMetadata(test) {
720
- var _ref3, _test$parent$project, _titleMetadata$labels;
1029
+ value: function getStaticTestMetadata(test, parentSuite) {
1030
+ var _ref2, _testParent$project, _testParent$titlePath, _titleMetadata$labels;
721
1031
  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) {
1032
+ var testParent = parentSuite !== null && parentSuite !== void 0 ? parentSuite : test.parent;
1033
+ var project = (_ref2 = (_testParent$project = testParent === null || testParent === void 0 ? void 0 : testParent.project()) !== null && _testParent$project !== void 0 ? _testParent$project : this.config.projects.find(function (candidate) {
723
1034
  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];
1035
+ })) !== null && _ref2 !== void 0 ? _ref2 : this.config.projects[0];
725
1036
  var testFilePath = path.relative(project.testDir, test.location.file);
726
1037
  var relativeFileParts = testFilePath.split(path.sep);
727
1038
  var relativeFile = relativeFileParts.join("/");
728
1039
  var normalizedAbsoluteFile = path.normalize(test.location.file);
729
1040
  var normalizedRelativeFile = path.normalize(testFilePath);
730
1041
  var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
731
- var suiteTitles = test.parent.titlePath().filter(Boolean);
1042
+ var suiteTitles = (_testParent$titlePath = testParent === null || testParent === void 0 ? void 0 : testParent.titlePath().filter(Boolean)) !== null && _testParent$titlePath !== void 0 ? _testParent$titlePath : [];
732
1043
  if (project.name && suiteTitles[0] === project.name) {
733
1044
  suiteTitles = suiteTitles.slice(1);
734
1045
  }
@@ -736,6 +1047,9 @@ export var AllureReporter = /*#__PURE__*/function () {
736
1047
  suiteTitles = suiteTitles.slice(1);
737
1048
  }
738
1049
  var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
1050
+ var projectRootSearchFrom = path.dirname(test.location.file);
1051
+ var projectName = getProjectName(projectRootSearchFrom);
1052
+ var testCaseIdBase = "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title);
739
1053
  var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
740
1054
  var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
741
1055
  return label.name === LabelName.ALLURE_ID;
@@ -743,11 +1057,11 @@ export var AllureReporter = /*#__PURE__*/function () {
743
1057
 
744
1058
  // Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
745
1059
  if (!staticAllureId && "annotations" in test) {
746
- var _iterator5 = _createForOfIteratorHelper(test.annotations),
747
- _step5;
1060
+ var _iterator7 = _createForOfIteratorHelper(test.annotations),
1061
+ _step7;
748
1062
  try {
749
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
750
- var annotation = _step5.value;
1063
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1064
+ var annotation = _step7.value;
751
1065
  var label = getMetadataLabel(annotation.type, annotation.description);
752
1066
  if ((label === null || label === void 0 ? void 0 : label.name) === LabelName.ALLURE_ID) {
753
1067
  staticAllureId = label.value;
@@ -755,9 +1069,9 @@ export var AllureReporter = /*#__PURE__*/function () {
755
1069
  }
756
1070
  }
757
1071
  } catch (err) {
758
- _iterator5.e(err);
1072
+ _iterator7.e(err);
759
1073
  } finally {
760
- _iterator5.f();
1074
+ _iterator7.f();
761
1075
  }
762
1076
  }
763
1077
  return {
@@ -765,7 +1079,10 @@ export var AllureReporter = /*#__PURE__*/function () {
765
1079
  testFilePath: testFilePath,
766
1080
  relativeFileParts: relativeFileParts,
767
1081
  suiteTitles: suiteTitles,
768
- testCaseIdBase: "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title),
1082
+ projectName: projectName,
1083
+ projectRootSearchFrom: projectRootSearchFrom,
1084
+ testCaseIdBase: projectName ? "".concat(projectName, ":").concat(testCaseIdBase) : testCaseIdBase,
1085
+ legacyTestCaseIdBase: testCaseIdBase,
769
1086
  titleMetadata: titleMetadata,
770
1087
  fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
771
1088
  legacyFullName: legacyFullName,
@@ -774,11 +1091,11 @@ export var AllureReporter = /*#__PURE__*/function () {
774
1091
  }
775
1092
  }, {
776
1093
  key: "isInTestPlan",
777
- value: function isInTestPlan(test) {
1094
+ value: function isInTestPlan(test, parentSuite) {
778
1095
  if (!this.testPlan) {
779
1096
  return true;
780
1097
  }
781
- var _this$getStaticTestMe = this.getStaticTestMetadata(test),
1098
+ var _this$getStaticTestMe = this.getStaticTestMetadata(test, parentSuite),
782
1099
  fullName = _this$getStaticTestMe.fullName,
783
1100
  legacyFullName = _this$getStaticTestMe.legacyFullName,
784
1101
  staticAllureId = _this$getStaticTestMe.staticAllureId;
@@ -790,13 +1107,54 @@ export var AllureReporter = /*#__PURE__*/function () {
790
1107
  id: staticAllureId
791
1108
  });
792
1109
  }
1110
+ }, {
1111
+ key: "installTestPlanExecutionFilter",
1112
+ value: function installTestPlanExecutionFilter() {
1113
+ var _this7 = this;
1114
+ var suitePrototype = this.getPlaywrightSuitePrototype();
1115
+ if (!(suitePrototype !== null && suitePrototype !== void 0 && suitePrototype._addTest)) {
1116
+ // eslint-disable-next-line no-console
1117
+ console.warn("[allure-playwright] Could not install the test plan execution filter because Playwright " + "Suite.prototype._addTest was not found. Tests outside ALLURE_TESTPLAN_PATH may still run. " + "Please report this compatibility issue to https://github.com/allure-framework/allure-js/issues.");
1118
+ return;
1119
+ }
1120
+ var patchedSuitePrototype = suitePrototype;
1121
+ patchedSuitePrototype[testPlanFilterSymbol] = function (test, parentSuite) {
1122
+ return _this7.isInTestPlan(test, parentSuite);
1123
+ };
1124
+ if (patchedSuitePrototype[testPlanFilterPatchSymbol]) {
1125
+ return;
1126
+ }
1127
+ var addTest = suitePrototype._addTest;
1128
+
1129
+ // Dear Pavel: break us all day long you may; find the way back, my Codex and I always will.
1130
+ suitePrototype._addTest = function (test) {
1131
+ var testPlanFilter = patchedSuitePrototype[testPlanFilterSymbol];
1132
+ if (testPlanFilter && !testPlanFilter(test, this)) {
1133
+ return;
1134
+ }
1135
+ return addTest.call(this, test);
1136
+ };
1137
+ patchedSuitePrototype[testPlanFilterPatchSymbol] = true;
1138
+ }
1139
+ }, {
1140
+ key: "getPlaywrightSuitePrototype",
1141
+ value: function getPlaywrightSuitePrototype() {
1142
+ try {
1143
+ var _playwrightCommon$tes;
1144
+ var playwrightTestRequire = createRequire(localRequire.resolve("@playwright/test"));
1145
+ var playwrightCommon = playwrightTestRequire("playwright/lib/common");
1146
+ return (_playwrightCommon$tes = playwrightCommon.test) === null || _playwrightCommon$tes === void 0 || (_playwrightCommon$tes = _playwrightCommon$tes.Suite) === null || _playwrightCommon$tes === void 0 ? void 0 : _playwrightCommon$tes.prototype;
1147
+ } catch (_unused) {
1148
+ return undefined;
1149
+ }
1150
+ }
793
1151
  }, {
794
1152
  key: "processStepMetadataMessage",
795
1153
  value: function processStepMetadataMessage(attachmentStepUuid, message) {
796
1154
  var _message$data = message.data,
797
1155
  name = _message$data.name,
798
- _message$data$paramet = _message$data.parameters,
799
- parameters = _message$data$paramet === void 0 ? [] : _message$data$paramet;
1156
+ _message$data$paramet2 = _message$data.parameters,
1157
+ parameters = _message$data$paramet2 === void 0 ? [] : _message$data$paramet2;
800
1158
  this.allureRuntime.updateStep(attachmentStepUuid, function (step) {
801
1159
  var _step$parameters;
802
1160
  if (name) {
@@ -825,32 +1183,32 @@ export var AllureReporter = /*#__PURE__*/function () {
825
1183
  }, {
826
1184
  key: "processAttachment",
827
1185
  value: function () {
828
- var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(testUuid, attachmentStepUuid, attachment) {
1186
+ var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(testUuid, attachmentStepUuid, attachment) {
829
1187
  var _replace;
830
1188
  var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
831
- return _regenerator().w(function (_context6) {
832
- while (1) switch (_context6.n) {
1189
+ return _regenerator().w(function (_context7) {
1190
+ while (1) switch (_context7.n) {
833
1191
  case 0:
834
1192
  if (!(!attachment.body && !attachment.path)) {
835
- _context6.n = 1;
1193
+ _context7.n = 1;
836
1194
  break;
837
1195
  }
838
- return _context6.a(2);
1196
+ return _context7.a(2);
839
1197
  case 1:
840
1198
  allureRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
841
1199
  if (!(allureRuntimeMessage && !attachment.body)) {
842
- _context6.n = 2;
1200
+ _context7.n = 2;
843
1201
  break;
844
1202
  }
845
- return _context6.a(2);
1203
+ return _context7.a(2);
846
1204
  case 2:
847
1205
  if (!allureRuntimeMessage) {
848
- _context6.n = 3;
1206
+ _context7.n = 3;
849
1207
  break;
850
1208
  }
851
1209
  message = JSON.parse(attachment.body.toString());
852
1210
  this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
853
- return _context6.a(2);
1211
+ return _context7.a(2);
854
1212
  case 3:
855
1213
  parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
856
1214
  name: attachment.name
@@ -861,20 +1219,20 @@ export var AllureReporter = /*#__PURE__*/function () {
861
1219
  this.allureRuntime.stopStep(parentUuid, undefined);
862
1220
  }
863
1221
  if (!attachment.body) {
864
- _context6.n = 4;
1222
+ _context7.n = 4;
865
1223
  break;
866
1224
  }
867
1225
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
868
1226
  contentType: attachment.contentType
869
1227
  });
870
- _context6.n = 6;
1228
+ _context7.n = 6;
871
1229
  break;
872
1230
  case 4:
873
1231
  if (existsSync(attachment.path)) {
874
- _context6.n = 5;
1232
+ _context7.n = 5;
875
1233
  break;
876
1234
  }
877
- return _context6.a(2);
1235
+ return _context7.a(2);
878
1236
  case 5:
879
1237
  contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
880
1238
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
@@ -882,91 +1240,91 @@ export var AllureReporter = /*#__PURE__*/function () {
882
1240
  });
883
1241
  case 6:
884
1242
  if (attachment.name.match(diffEndRegexp)) {
885
- _context6.n = 7;
1243
+ _context7.n = 7;
886
1244
  break;
887
1245
  }
888
- return _context6.a(2);
1246
+ return _context7.a(2);
889
1247
  case 7:
890
1248
  pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
891
1249
  pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
892
1250
  if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
893
- _context6.n = 8;
1251
+ _context7.n = 8;
894
1252
  break;
895
1253
  }
896
- return _context6.a(2);
1254
+ return _context7.a(2);
897
1255
  case 8:
898
1256
  fileExists = /*#__PURE__*/function () {
899
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
900
- return _regenerator().w(function (_context4) {
901
- while (1) switch (_context4.n) {
1257
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
1258
+ return _regenerator().w(function (_context5) {
1259
+ while (1) switch (_context5.n) {
902
1260
  case 0:
903
- _context4.n = 1;
1261
+ _context5.n = 1;
904
1262
  return access(filePath).then(function () {
905
1263
  return true;
906
1264
  })["catch"](function () {
907
1265
  return false;
908
1266
  });
909
1267
  case 1:
910
- return _context4.a(2, _context4.v);
1268
+ return _context5.a(2, _context5.v);
911
1269
  }
912
- }, _callee4);
1270
+ }, _callee5);
913
1271
  }));
914
- return function fileExists(_x6) {
915
- return _ref4.apply(this, arguments);
1272
+ return function fileExists(_x7) {
1273
+ return _ref3.apply(this, arguments);
916
1274
  };
917
1275
  }();
918
1276
  readImageFromDirs = /*#__PURE__*/function () {
919
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
1277
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
920
1278
  var defaultPath, snapshotPath;
921
- return _regenerator().w(function (_context5) {
922
- while (1) switch (_context5.n) {
1279
+ return _regenerator().w(function (_context6) {
1280
+ while (1) switch (_context6.n) {
923
1281
  case 0:
924
1282
  defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
925
1283
  snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
926
- _context5.n = 1;
1284
+ _context6.n = 1;
927
1285
  return fileExists(defaultPath);
928
1286
  case 1:
929
- if (!_context5.v) {
930
- _context5.n = 3;
1287
+ if (!_context6.v) {
1288
+ _context6.n = 3;
931
1289
  break;
932
1290
  }
933
- _context5.n = 2;
1291
+ _context6.n = 2;
934
1292
  return readImageAsBase64(defaultPath);
935
1293
  case 2:
936
- return _context5.a(2, _context5.v);
1294
+ return _context6.a(2, _context6.v);
937
1295
  case 3:
938
- _context5.n = 4;
1296
+ _context6.n = 4;
939
1297
  return fileExists(snapshotPath);
940
1298
  case 4:
941
- if (!_context5.v) {
942
- _context5.n = 6;
1299
+ if (!_context6.v) {
1300
+ _context6.n = 6;
943
1301
  break;
944
1302
  }
945
- _context5.n = 5;
1303
+ _context6.n = 5;
946
1304
  return readImageAsBase64(snapshotPath);
947
1305
  case 5:
948
- return _context5.a(2, _context5.v);
1306
+ return _context6.a(2, _context6.v);
949
1307
  case 6:
950
- return _context5.a(2, undefined);
1308
+ return _context6.a(2, undefined);
951
1309
  }
952
- }, _callee5);
1310
+ }, _callee6);
953
1311
  }));
954
- return function readImageFromDirs(_x7) {
955
- return _ref5.apply(this, arguments);
1312
+ return function readImageFromDirs(_x8) {
1313
+ return _ref4.apply(this, arguments);
956
1314
  };
957
1315
  }();
958
- _context6.n = 9;
1316
+ _context7.n = 9;
959
1317
  return readImageFromDirs("actual");
960
1318
  case 9:
961
- actualBase64 = _context6.v;
962
- _context6.n = 10;
1319
+ actualBase64 = _context7.v;
1320
+ _context7.n = 10;
963
1321
  return readImageFromDirs("expected");
964
1322
  case 10:
965
- expectedBase64 = _context6.v;
966
- _context6.n = 11;
1323
+ expectedBase64 = _context7.v;
1324
+ _context7.n = 11;
967
1325
  return readImageFromDirs("diff");
968
1326
  case 11:
969
- diffBase64 = _context6.v;
1327
+ diffBase64 = _context7.v;
970
1328
  diffName = attachment.name.replace(diffEndRegexp, "");
971
1329
  this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
972
1330
  expected: expectedBase64,
@@ -979,11 +1337,11 @@ export var AllureReporter = /*#__PURE__*/function () {
979
1337
  });
980
1338
  this.processedDiffs.push(pathWithoutEnd);
981
1339
  case 12:
982
- return _context6.a(2);
1340
+ return _context7.a(2);
983
1341
  }
984
- }, _callee6, this);
1342
+ }, _callee7, this);
985
1343
  }));
986
- function processAttachment(_x3, _x4, _x5) {
1344
+ function processAttachment(_x4, _x5, _x6) {
987
1345
  return _processAttachment.apply(this, arguments);
988
1346
  }
989
1347
  return processAttachment;