allure-playwright 3.7.2 → 3.8.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,9 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- 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
2
  function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
5
3
  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
4
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
5
+ 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 }; })(); }
6
+ 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
7
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
8
8
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
9
9
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
@@ -54,6 +54,8 @@ export var AllureReporter = /*#__PURE__*/function () {
54
54
  _defineProperty(this, "attachmentTargets", new Map());
55
55
  _defineProperty(this, "beforeHooksStepsStack", new Map());
56
56
  _defineProperty(this, "afterHooksStepsStack", new Map());
57
+ _defineProperty(this, "pendingAttachmentTasks", new Map());
58
+ _defineProperty(this, "attachmentTargetByStep", new WeakMap());
57
59
  _defineProperty(this, "pwStepUuid", new WeakMap());
58
60
  _defineProperty(this, "testPlan", parseTestPlan());
59
61
  this.options = _objectSpread({
@@ -250,6 +252,259 @@ export var AllureReporter = /*#__PURE__*/function () {
250
252
  this.allureResultsUuids.set(test.id, testUuid);
251
253
  this.startedTestCasesTitlesCache.push(metadata.titleMetadata.cleanTitle);
252
254
  }
255
+ }, {
256
+ key: "queueAttachmentTask",
257
+ value: function queueAttachmentTask(testId, task) {
258
+ var _this$pendingAttachme;
259
+ var tasks = (_this$pendingAttachme = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme !== void 0 ? _this$pendingAttachme : [];
260
+ tasks.push(task);
261
+ this.pendingAttachmentTasks.set(testId, tasks);
262
+ }
263
+ }, {
264
+ key: "flushAttachmentTasks",
265
+ value: function () {
266
+ var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(testId) {
267
+ var _this$pendingAttachme2;
268
+ var tasks;
269
+ return _regenerator().w(function (_context) {
270
+ while (1) switch (_context.n) {
271
+ case 0:
272
+ tasks = (_this$pendingAttachme2 = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme2 !== void 0 ? _this$pendingAttachme2 : [];
273
+ this.pendingAttachmentTasks["delete"](testId);
274
+ if (!(tasks.length > 0)) {
275
+ _context.n = 1;
276
+ break;
277
+ }
278
+ _context.n = 1;
279
+ return Promise.all(tasks);
280
+ case 1:
281
+ return _context.a(2);
282
+ }
283
+ }, _callee, this);
284
+ }));
285
+ function flushAttachmentTasks(_x) {
286
+ return _flushAttachmentTasks.apply(this, arguments);
287
+ }
288
+ return flushAttachmentTasks;
289
+ }()
290
+ }, {
291
+ key: "recordAttachmentTarget",
292
+ value: function recordAttachmentTarget(testId, target) {
293
+ var _this$attachmentTarge;
294
+ var targets = (_this$attachmentTarge = this.attachmentTargets.get(testId)) !== null && _this$attachmentTarge !== void 0 ? _this$attachmentTarge : [];
295
+ targets.push(target);
296
+ this.attachmentTargets.set(testId, targets);
297
+ }
298
+ }, {
299
+ key: "getHookStepsStack",
300
+ value: function getHookStepsStack(testId, hookStep) {
301
+ return hookStep.hookScope === "before" ? this.beforeHooksStepsStack.get(testId) : this.afterHooksStepsStack.get(testId);
302
+ }
303
+ }, {
304
+ key: "removeHookAttachmentPlaceholder",
305
+ value: function removeHookAttachmentPlaceholder(steps, stepUuid) {
306
+ var index = steps.findIndex(function (step) {
307
+ return step.uuid === stepUuid;
308
+ });
309
+ if (index !== -1) {
310
+ steps.splice(index, 1);
311
+ return true;
312
+ }
313
+ var _iterator2 = _createForOfIteratorHelper(steps),
314
+ _step2;
315
+ try {
316
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
317
+ var step = _step2.value;
318
+ if (this.removeHookAttachmentPlaceholder(step.steps, stepUuid)) {
319
+ return true;
320
+ }
321
+ }
322
+ } catch (err) {
323
+ _iterator2.e(err);
324
+ } finally {
325
+ _iterator2.f();
326
+ }
327
+ return false;
328
+ }
329
+ }, {
330
+ key: "addAttachmentToHookStep",
331
+ value: function addAttachmentToHookStep(test, hookStep, attachment) {
332
+ var targetStack = this.getHookStepsStack(test.id, hookStep);
333
+ if (!targetStack) {
334
+ return;
335
+ }
336
+ var stepResult = targetStack.findStepByUuid(hookStep.uuid);
337
+ if (!stepResult) {
338
+ return;
339
+ }
340
+ var fileName = targetStack.addAttachment(attachment, this.allureRuntime.writer);
341
+ stepResult.attachments.push({
342
+ name: attachment.name,
343
+ type: attachment.contentType,
344
+ source: fileName
345
+ });
346
+ }
347
+ }, {
348
+ key: "addRuntimeAttachmentToHookStack",
349
+ value: function addRuntimeAttachmentToHookStack(targetStack, attachment, options) {
350
+ var _this2 = this;
351
+ var currentStep = targetStack.currentStep();
352
+ if (!currentStep) {
353
+ return;
354
+ }
355
+ var addAttachment = function addAttachment(stepResult) {
356
+ var fileName = targetStack.addAttachment(attachment, _this2.allureRuntime.writer);
357
+ stepResult.attachments.push({
358
+ name: attachment.name,
359
+ type: attachment.contentType,
360
+ source: fileName
361
+ });
362
+ };
363
+ if (options !== null && options !== void 0 && options.wrapInStep) {
364
+ targetStack.startStep({
365
+ name: attachment.name,
366
+ start: options.timestamp
367
+ });
368
+ addAttachment(targetStack.currentStep());
369
+ targetStack.stopStep({
370
+ stop: options.timestamp
371
+ });
372
+ return;
373
+ }
374
+ addAttachment(currentStep);
375
+ }
376
+ }, {
377
+ key: "processHookRuntimeMessage",
378
+ value: function processHookRuntimeMessage(test, testUuid, hookStep, attachment) {
379
+ if (!attachment.body) {
380
+ return false;
381
+ }
382
+ var targetStack = this.getHookStepsStack(test.id, hookStep);
383
+ if (!targetStack) {
384
+ return false;
385
+ }
386
+ this.removeHookAttachmentPlaceholder(targetStack.steps, hookStep.uuid);
387
+ var message = JSON.parse(attachment.body.toString());
388
+ switch (message.type) {
389
+ case "step_start":
390
+ targetStack.startStep(_objectSpread({}, message.data));
391
+ return true;
392
+ case "step_stop":
393
+ {
394
+ var currentStep = targetStack.currentStep();
395
+ if (!currentStep) {
396
+ return false;
397
+ }
398
+ targetStack.updateStep(function (stepResult) {
399
+ if (message.data.status && !stepResult.status) {
400
+ stepResult.status = message.data.status;
401
+ }
402
+ if (message.data.statusDetails) {
403
+ stepResult.statusDetails = _objectSpread(_objectSpread({}, stepResult.statusDetails), message.data.statusDetails);
404
+ }
405
+ });
406
+ targetStack.stopStep({
407
+ stop: message.data.stop
408
+ });
409
+ return true;
410
+ }
411
+ case "step_metadata":
412
+ {
413
+ var _currentStep$paramete, _message$data$paramet;
414
+ var _currentStep = targetStack.currentStep();
415
+ if (!_currentStep) {
416
+ return false;
417
+ }
418
+ if (message.data.name) {
419
+ _currentStep.name = message.data.name;
420
+ }
421
+ (_currentStep$paramete = _currentStep.parameters).push.apply(_currentStep$paramete, _toConsumableArray((_message$data$paramet = message.data.parameters) !== null && _message$data$paramet !== void 0 ? _message$data$paramet : []));
422
+ return true;
423
+ }
424
+ case "attachment_content":
425
+ this.addRuntimeAttachmentToHookStack(targetStack, {
426
+ name: message.data.name,
427
+ body: Buffer.from(message.data.content, message.data.encoding),
428
+ contentType: message.data.contentType
429
+ }, {
430
+ wrapInStep: message.data.wrapInStep,
431
+ timestamp: message.data.timestamp
432
+ });
433
+ return true;
434
+ case "attachment_path":
435
+ this.addRuntimeAttachmentToHookStack(targetStack, {
436
+ name: message.data.name,
437
+ path: message.data.path,
438
+ contentType: message.data.contentType
439
+ }, {
440
+ wrapInStep: message.data.wrapInStep,
441
+ timestamp: message.data.timestamp
442
+ });
443
+ return true;
444
+ default:
445
+ this.queueAttachmentTask(test.id, this.processAttachment(testUuid, undefined, attachment));
446
+ return true;
447
+ }
448
+ }
449
+ }, {
450
+ key: "shouldProcessAttachmentAtTestEnd",
451
+ value: function shouldProcessAttachmentAtTestEnd(attachment) {
452
+ if (attachment.name.match(diffEndRegexp)) {
453
+ return true;
454
+ }
455
+ if (attachment.contentType === "application/vnd.allure.playwright-trace") {
456
+ return true;
457
+ }
458
+ return attachment.name === "trace" && attachment.contentType === "application/zip";
459
+ }
460
+ }, {
461
+ key: "processStepEndAttachments",
462
+ value: function processStepEndAttachments(test, step) {
463
+ var _step$attachments;
464
+ var testUuid = this.allureResultsUuids.get(test.id);
465
+ var stepAttachments = (_step$attachments = step.attachments) !== null && _step$attachments !== void 0 ? _step$attachments : [];
466
+ var stepInfo = this.attachmentTargetByStep.get(step);
467
+ var hasExplicitParent = Boolean((stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.hookStep) || (stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid));
468
+ if (stepAttachments.length === 0) {
469
+ if (stepInfo) {
470
+ this.recordAttachmentTarget(test.id, stepInfo);
471
+ }
472
+ return;
473
+ }
474
+ var _iterator3 = _createForOfIteratorHelper(stepAttachments),
475
+ _step3;
476
+ try {
477
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
478
+ var _stepInfo$hookStep$uu, _stepInfo$hookStep;
479
+ var attachment = _step3.value;
480
+ var isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
481
+ var attachmentTarget = _objectSpread(_objectSpread({}, stepInfo), {}, {
482
+ name: attachment.name
483
+ });
484
+ this.recordAttachmentTarget(test.id, attachmentTarget);
485
+ if (this.shouldProcessAttachmentAtTestEnd(attachment) || !isRuntimeMessage && !hasExplicitParent) {
486
+ continue;
487
+ }
488
+ attachmentTarget.processedAtStepEnd = true;
489
+ if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep && isRuntimeMessage) {
490
+ if (!this.processHookRuntimeMessage(test, testUuid, stepInfo.hookStep, attachment)) {
491
+ attachmentTarget.processedAtStepEnd = false;
492
+ }
493
+ continue;
494
+ }
495
+ if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
496
+ this.addAttachmentToHookStep(test, stepInfo.hookStep, attachment);
497
+ continue;
498
+ }
499
+ 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;
500
+ this.queueAttachmentTask(test.id, this.processAttachment(testUuid, attachmentStepUuid, attachment));
501
+ }
502
+ } catch (err) {
503
+ _iterator3.e(err);
504
+ } finally {
505
+ _iterator3.f();
506
+ }
507
+ }
253
508
  }, {
254
509
  key: "onStepBegin",
255
510
  value: function onStepBegin(test, _result, step) {
@@ -271,19 +526,17 @@ export var AllureReporter = /*#__PURE__*/function () {
271
526
  uuid: randomUuid()
272
527
  });
273
528
  if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
274
- var _this$pwStepUuid$get, _this$attachmentTarge;
529
+ var _this$pwStepUuid$get;
275
530
  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({
531
+ this.attachmentTargetByStep.set(step, {
278
532
  name: normalizeAttachStepTitle(step.title),
279
533
  stepUuid: parent !== null && parent !== void 0 ? parent : undefined
280
534
  });
281
- this.attachmentTargets.set(test.id, targets);
282
535
  return;
283
536
  }
284
537
  if (isHookStep) {
285
538
  if (["test.attach", "attach"].includes(step.category)) {
286
- var _stack$currentStep, _this$attachmentTarge2;
539
+ var _stack$currentStep;
287
540
  var attachmentName = normalizeAttachStepTitle(step.title);
288
541
  var _stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
289
542
  var hookStepWithUuid;
@@ -291,19 +544,18 @@ export var AllureReporter = /*#__PURE__*/function () {
291
544
  _stack.startStep(baseStep);
292
545
  _stack.updateStep(function (stepResult) {
293
546
  hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
294
- uuid: stepResult.uuid
547
+ uuid: stepResult.uuid,
548
+ hookScope: isBeforeHookDescendant ? "before" : "after"
295
549
  });
296
550
  stepResult.name = normalizeHookTitle(stepResult.name);
297
551
  stepResult.stage = Stage.FINISHED;
298
552
  });
299
553
  _stack.stopStep();
300
- var _targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
301
- _targets.push({
554
+ this.attachmentTargetByStep.set(step, {
302
555
  name: attachmentName,
303
556
  hookStep: hookStepWithUuid,
304
557
  stepUuid: attachmentName === "Allure Step Metadata" ? parentHookStepUuid : undefined
305
558
  });
306
- this.attachmentTargets.set(test.id, _targets);
307
559
  return;
308
560
  }
309
561
  var stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
@@ -351,8 +603,8 @@ export var AllureReporter = /*#__PURE__*/function () {
351
603
  if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
352
604
  return;
353
605
  }
354
- // ignore test.attach steps since attachments are already in the report
355
606
  if (["test.attach", "attach"].includes(step.category)) {
607
+ this.processStepEndAttachments(test, step);
356
608
  return;
357
609
  }
358
610
  var testUuid = this.allureResultsUuids.get(test.id);
@@ -393,12 +645,12 @@ export var AllureReporter = /*#__PURE__*/function () {
393
645
  }, {
394
646
  key: "onTestEnd",
395
647
  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) {
648
+ var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(test, result) {
649
+ var _this3 = this,
650
+ _this$attachmentTarge2;
651
+ 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;
652
+ return _regenerator().w(function (_context2) {
653
+ while (1) switch (_context2.n) {
402
654
  case 0:
403
655
  testUuid = this.allureResultsUuids.get(test.id); // We need to check parallelIndex first because pw introduced this field only in v1.30.0
404
656
  threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
@@ -416,7 +668,7 @@ export var AllureReporter = /*#__PURE__*/function () {
416
668
  value: projectSuiteTitle
417
669
  });
418
670
  }
419
- if (_this2.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
671
+ if (_this3.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
420
672
  testResult.labels.push({
421
673
  name: LabelName.SUITE,
422
674
  value: fileSuiteTitle
@@ -456,20 +708,20 @@ export var AllureReporter = /*#__PURE__*/function () {
456
708
  }
457
709
 
458
710
  // FIFO
459
- targets = (_this$attachmentTarge3 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge3 !== void 0 ? _this$attachmentTarge3 : [];
711
+ targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
460
712
  targetsByName = new Map();
461
- _iterator2 = _createForOfIteratorHelper(targets);
713
+ _iterator4 = _createForOfIteratorHelper(targets);
462
714
  try {
463
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
464
- t = _step2.value;
715
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
716
+ t = _step4.value;
465
717
  q = (_targetsByName$get = targetsByName.get(t.name)) !== null && _targetsByName$get !== void 0 ? _targetsByName$get : [];
466
718
  q.push(t);
467
719
  targetsByName.set(t.name, q);
468
720
  }
469
721
  } catch (err) {
470
- _iterator2.e(err);
722
+ _iterator4.e(err);
471
723
  } finally {
472
- _iterator2.f();
724
+ _iterator4.f();
473
725
  }
474
726
  takeByName = function takeByName(name) {
475
727
  var target = targetsByName.get(name);
@@ -478,52 +730,57 @@ export var AllureReporter = /*#__PURE__*/function () {
478
730
  }
479
731
  return target.shift();
480
732
  };
481
- _iterator3 = _createForOfIteratorHelper(result.attachments);
482
- _context.p = 1;
483
- _iterator3.s();
733
+ _iterator5 = _createForOfIteratorHelper(result.attachments);
734
+ _context2.p = 1;
735
+ _iterator5.s();
484
736
  case 2:
485
- if ((_step3 = _iterator3.n()).done) {
486
- _context.n = 10;
737
+ if ((_step5 = _iterator5.n()).done) {
738
+ _context2.n = 11;
487
739
  break;
488
740
  }
489
- attachment = _step3.value;
741
+ attachment = _step5.value;
490
742
  isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
491
743
  stepInfo = takeByName(attachment.name);
744
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
745
+ _context2.n = 3;
746
+ break;
747
+ }
748
+ return _context2.a(3, 10);
749
+ case 3:
492
750
  if (!isRuntimeMessage) {
493
- _context.n = 5;
751
+ _context2.n = 6;
494
752
  break;
495
753
  }
496
754
  message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
497
755
  if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
498
- targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
756
+ targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
499
757
  this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
500
758
  }
501
759
  if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
502
- _context.n = 3;
760
+ _context2.n = 4;
503
761
  break;
504
762
  }
505
763
  if (stepInfo.hookStep) {
506
- _targetStack = isBeforeHookStep(stepInfo.hookStep) ? beforeHooksStack : afterHooksStack;
764
+ _targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
507
765
  this.processHookStepMetadataMessage(_targetStack, stepInfo.stepUuid, message);
508
766
  } else {
509
767
  this.processStepMetadataMessage(stepInfo.stepUuid, message);
510
768
  }
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);
769
+ return _context2.a(3, 10);
516
770
  case 4:
517
- return _context.a(3, 9);
771
+ stepUuid = (_stepInfo$hookStep$uu2 = stepInfo === null || stepInfo === void 0 || (_stepInfo$hookStep2 = stepInfo.hookStep) === null || _stepInfo$hookStep2 === void 0 ? void 0 : _stepInfo$hookStep2.uuid) !== null && _stepInfo$hookStep$uu2 !== void 0 ? _stepInfo$hookStep$uu2 : stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid;
772
+ _context2.n = 5;
773
+ return this.processAttachment(testUuid, stepUuid, attachment);
518
774
  case 5:
775
+ return _context2.a(3, 10);
776
+ case 6:
519
777
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
520
- _context.n = 6;
778
+ _context2.n = 7;
521
779
  break;
522
780
  }
523
- hookStep = stepInfo.hookStep;
524
- _targetStack2 = isBeforeHookStep(hookStep) ? beforeHooksStack : afterHooksStack;
781
+ _targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
525
782
  if (_targetStack2) {
526
- stepResult = _targetStack2.findStepByUuid(hookStep.uuid);
783
+ stepResult = _targetStack2.findStepByUuid(stepInfo.hookStep.uuid);
527
784
  if (stepResult) {
528
785
  fileName = _targetStack2.addAttachment(attachment, this.allureRuntime.writer);
529
786
  stepResult.attachments.push({
@@ -533,34 +790,37 @@ export var AllureReporter = /*#__PURE__*/function () {
533
790
  });
534
791
  }
535
792
  }
536
- return _context.a(3, 9);
537
- case 6:
793
+ return _context2.a(3, 10);
794
+ case 7:
538
795
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
539
- _context.n = 8;
796
+ _context2.n = 9;
540
797
  break;
541
798
  }
542
- _context.n = 7;
799
+ _context2.n = 8;
543
800
  return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
544
- case 7:
545
- return _context.a(3, 9);
546
801
  case 8:
547
- _context.n = 9;
548
- return this.processAttachment(testUuid, undefined, attachment);
802
+ return _context2.a(3, 10);
549
803
  case 9:
550
- _context.n = 2;
551
- break;
804
+ _context2.n = 10;
805
+ return this.processAttachment(testUuid, undefined, attachment);
552
806
  case 10:
553
- _context.n = 12;
807
+ _context2.n = 2;
554
808
  break;
555
809
  case 11:
556
- _context.p = 11;
557
- _t = _context.v;
558
- _iterator3.e(_t);
810
+ _context2.n = 13;
811
+ break;
559
812
  case 12:
560
- _context.p = 12;
561
- _iterator3.f();
562
- return _context.f(12);
813
+ _context2.p = 12;
814
+ _t = _context2.v;
815
+ _iterator5.e(_t);
563
816
  case 13:
817
+ _context2.p = 13;
818
+ _iterator5.f();
819
+ return _context2.f(13);
820
+ case 14:
821
+ _context2.n = 15;
822
+ return this.flushAttachmentTasks(test.id);
823
+ case 15:
564
824
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
565
825
  // in next iterations we need to implement the logic for every javascript integration
566
826
  this.allureRuntime.updateTest(testUuid, function (testResult) {
@@ -580,14 +840,14 @@ export var AllureReporter = /*#__PURE__*/function () {
580
840
  });
581
841
  if (beforeHooksStack) {
582
842
  var _testResult$steps;
583
- (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
843
+ (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this3.pruneEmptyHookRoots(beforeHooksStack.steps)));
584
844
  }
585
- _this2.beforeHooksStepsStack["delete"](test.id);
845
+ _this3.beforeHooksStepsStack["delete"](test.id);
586
846
  if (afterHooksStack) {
587
847
  var _testResult$steps2;
588
- (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
848
+ (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this3.pruneEmptyHookRoots(afterHooksStack.steps)));
589
849
  }
590
- _this2.afterHooksStepsStack["delete"](test.id);
850
+ _this3.afterHooksStepsStack["delete"](test.id);
591
851
  testResult.labels = newLabels;
592
852
  });
593
853
  this.allureRuntime.stopTest(testUuid, {
@@ -595,12 +855,13 @@ export var AllureReporter = /*#__PURE__*/function () {
595
855
  });
596
856
  this.allureRuntime.writeTest(testUuid);
597
857
  this.attachmentTargets["delete"](test.id);
598
- case 14:
599
- return _context.a(2);
858
+ this.pendingAttachmentTasks["delete"](test.id);
859
+ case 16:
860
+ return _context2.a(2);
600
861
  }
601
- }, _callee, this, [[1, 11, 12, 13]]);
862
+ }, _callee2, this, [[1, 12, 13, 14]]);
602
863
  }));
603
- function onTestEnd(_x, _x2) {
864
+ function onTestEnd(_x2, _x3) {
604
865
  return _onTestEnd.apply(this, arguments);
605
866
  }
606
867
  return onTestEnd;
@@ -608,28 +869,28 @@ export var AllureReporter = /*#__PURE__*/function () {
608
869
  }, {
609
870
  key: "addSkippedResults",
610
871
  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) {
872
+ var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
873
+ var _this4 = this;
874
+ var unprocessedCases, _iterator6, _step6, testCase, _t2;
875
+ return _regenerator().w(function (_context3) {
876
+ while (1) switch (_context3.n) {
616
877
  case 0:
617
878
  unprocessedCases = this.suite.allTests().filter(function (_ref2) {
618
879
  var title = _ref2.title;
619
880
  var titleMetadata = extractMetadataFromString(title);
620
- return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
881
+ return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
621
882
  });
622
- _iterator4 = _createForOfIteratorHelper(unprocessedCases);
623
- _context2.p = 1;
624
- _iterator4.s();
883
+ _iterator6 = _createForOfIteratorHelper(unprocessedCases);
884
+ _context3.p = 1;
885
+ _iterator6.s();
625
886
  case 2:
626
- if ((_step4 = _iterator4.n()).done) {
627
- _context2.n = 4;
887
+ if ((_step6 = _iterator6.n()).done) {
888
+ _context3.n = 4;
628
889
  break;
629
890
  }
630
- testCase = _step4.value;
891
+ testCase = _step6.value;
631
892
  this.onTestBegin(testCase);
632
- _context2.n = 3;
893
+ _context3.n = 3;
633
894
  return this.onTestEnd(testCase, {
634
895
  status: Status.SKIPPED,
635
896
  attachments: [],
@@ -645,23 +906,23 @@ export var AllureReporter = /*#__PURE__*/function () {
645
906
  annotations: []
646
907
  });
647
908
  case 3:
648
- _context2.n = 2;
909
+ _context3.n = 2;
649
910
  break;
650
911
  case 4:
651
- _context2.n = 6;
912
+ _context3.n = 6;
652
913
  break;
653
914
  case 5:
654
- _context2.p = 5;
655
- _t2 = _context2.v;
656
- _iterator4.e(_t2);
915
+ _context3.p = 5;
916
+ _t2 = _context3.v;
917
+ _iterator6.e(_t2);
657
918
  case 6:
658
- _context2.p = 6;
659
- _iterator4.f();
660
- return _context2.f(6);
919
+ _context3.p = 6;
920
+ _iterator6.f();
921
+ return _context3.f(6);
661
922
  case 7:
662
- return _context2.a(2);
923
+ return _context3.a(2);
663
924
  }
664
- }, _callee2, this, [[1, 5, 6, 7]]);
925
+ }, _callee3, this, [[1, 5, 6, 7]]);
665
926
  }));
666
927
  function addSkippedResults() {
667
928
  return _addSkippedResults.apply(this, arguments);
@@ -671,19 +932,19 @@ export var AllureReporter = /*#__PURE__*/function () {
671
932
  }, {
672
933
  key: "onEnd",
673
934
  value: function () {
674
- var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
675
- return _regenerator().w(function (_context3) {
676
- while (1) switch (_context3.n) {
935
+ var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
936
+ return _regenerator().w(function (_context4) {
937
+ while (1) switch (_context4.n) {
677
938
  case 0:
678
- _context3.n = 1;
939
+ _context4.n = 1;
679
940
  return this.addSkippedResults();
680
941
  case 1:
681
942
  this.allureRuntime.writeEnvironmentInfo();
682
943
  this.allureRuntime.writeCategoriesDefinitions();
683
944
  case 2:
684
- return _context3.a(2);
945
+ return _context4.a(2);
685
946
  }
686
- }, _callee3, this);
947
+ }, _callee4, this);
687
948
  }));
688
949
  function onEnd() {
689
950
  return _onEnd.apply(this, arguments);
@@ -695,9 +956,30 @@ export var AllureReporter = /*#__PURE__*/function () {
695
956
  value: function printsToStdio() {
696
957
  return false;
697
958
  }
959
+ }, {
960
+ key: "isEmptyPassedHookRoot",
961
+ value: function isEmptyPassedHookRoot(step) {
962
+ if (this.options.detail) {
963
+ return false;
964
+ }
965
+ 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;
966
+ }
967
+ }, {
968
+ key: "pruneEmptyHookRoots",
969
+ value: function pruneEmptyHookRoots(steps) {
970
+ var _this5 = this;
971
+ return steps.map(function (step) {
972
+ return _objectSpread(_objectSpread({}, step), {}, {
973
+ steps: _this5.pruneEmptyHookRoots(step.steps)
974
+ });
975
+ }).filter(function (step) {
976
+ return !_this5.isEmptyPassedHookRoot(step);
977
+ });
978
+ }
698
979
  }, {
699
980
  key: "removeStepFromHookStack",
700
981
  value: function removeStepFromHookStack(stack, stepUuid) {
982
+ var _this6 = this;
701
983
  if (!stack) {
702
984
  return;
703
985
  }
@@ -709,7 +991,7 @@ export var AllureReporter = /*#__PURE__*/function () {
709
991
  steps: _removeRecursively(step.steps)
710
992
  });
711
993
  }).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;
994
+ return !_this6.isEmptyPassedHookRoot(step);
713
995
  });
714
996
  };
715
997
  stack.steps = _removeRecursively(stack.steps);
@@ -743,11 +1025,11 @@ export var AllureReporter = /*#__PURE__*/function () {
743
1025
 
744
1026
  // Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
745
1027
  if (!staticAllureId && "annotations" in test) {
746
- var _iterator5 = _createForOfIteratorHelper(test.annotations),
747
- _step5;
1028
+ var _iterator7 = _createForOfIteratorHelper(test.annotations),
1029
+ _step7;
748
1030
  try {
749
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
750
- var annotation = _step5.value;
1031
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1032
+ var annotation = _step7.value;
751
1033
  var label = getMetadataLabel(annotation.type, annotation.description);
752
1034
  if ((label === null || label === void 0 ? void 0 : label.name) === LabelName.ALLURE_ID) {
753
1035
  staticAllureId = label.value;
@@ -755,9 +1037,9 @@ export var AllureReporter = /*#__PURE__*/function () {
755
1037
  }
756
1038
  }
757
1039
  } catch (err) {
758
- _iterator5.e(err);
1040
+ _iterator7.e(err);
759
1041
  } finally {
760
- _iterator5.f();
1042
+ _iterator7.f();
761
1043
  }
762
1044
  }
763
1045
  return {
@@ -795,8 +1077,8 @@ export var AllureReporter = /*#__PURE__*/function () {
795
1077
  value: function processStepMetadataMessage(attachmentStepUuid, message) {
796
1078
  var _message$data = message.data,
797
1079
  name = _message$data.name,
798
- _message$data$paramet = _message$data.parameters,
799
- parameters = _message$data$paramet === void 0 ? [] : _message$data$paramet;
1080
+ _message$data$paramet2 = _message$data.parameters,
1081
+ parameters = _message$data$paramet2 === void 0 ? [] : _message$data$paramet2;
800
1082
  this.allureRuntime.updateStep(attachmentStepUuid, function (step) {
801
1083
  var _step$parameters;
802
1084
  if (name) {
@@ -825,32 +1107,32 @@ export var AllureReporter = /*#__PURE__*/function () {
825
1107
  }, {
826
1108
  key: "processAttachment",
827
1109
  value: function () {
828
- var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(testUuid, attachmentStepUuid, attachment) {
1110
+ var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(testUuid, attachmentStepUuid, attachment) {
829
1111
  var _replace;
830
1112
  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) {
1113
+ return _regenerator().w(function (_context7) {
1114
+ while (1) switch (_context7.n) {
833
1115
  case 0:
834
1116
  if (!(!attachment.body && !attachment.path)) {
835
- _context6.n = 1;
1117
+ _context7.n = 1;
836
1118
  break;
837
1119
  }
838
- return _context6.a(2);
1120
+ return _context7.a(2);
839
1121
  case 1:
840
1122
  allureRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
841
1123
  if (!(allureRuntimeMessage && !attachment.body)) {
842
- _context6.n = 2;
1124
+ _context7.n = 2;
843
1125
  break;
844
1126
  }
845
- return _context6.a(2);
1127
+ return _context7.a(2);
846
1128
  case 2:
847
1129
  if (!allureRuntimeMessage) {
848
- _context6.n = 3;
1130
+ _context7.n = 3;
849
1131
  break;
850
1132
  }
851
1133
  message = JSON.parse(attachment.body.toString());
852
1134
  this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
853
- return _context6.a(2);
1135
+ return _context7.a(2);
854
1136
  case 3:
855
1137
  parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
856
1138
  name: attachment.name
@@ -861,20 +1143,20 @@ export var AllureReporter = /*#__PURE__*/function () {
861
1143
  this.allureRuntime.stopStep(parentUuid, undefined);
862
1144
  }
863
1145
  if (!attachment.body) {
864
- _context6.n = 4;
1146
+ _context7.n = 4;
865
1147
  break;
866
1148
  }
867
1149
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
868
1150
  contentType: attachment.contentType
869
1151
  });
870
- _context6.n = 6;
1152
+ _context7.n = 6;
871
1153
  break;
872
1154
  case 4:
873
1155
  if (existsSync(attachment.path)) {
874
- _context6.n = 5;
1156
+ _context7.n = 5;
875
1157
  break;
876
1158
  }
877
- return _context6.a(2);
1159
+ return _context7.a(2);
878
1160
  case 5:
879
1161
  contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
880
1162
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
@@ -882,91 +1164,91 @@ export var AllureReporter = /*#__PURE__*/function () {
882
1164
  });
883
1165
  case 6:
884
1166
  if (attachment.name.match(diffEndRegexp)) {
885
- _context6.n = 7;
1167
+ _context7.n = 7;
886
1168
  break;
887
1169
  }
888
- return _context6.a(2);
1170
+ return _context7.a(2);
889
1171
  case 7:
890
1172
  pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
891
1173
  pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
892
1174
  if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
893
- _context6.n = 8;
1175
+ _context7.n = 8;
894
1176
  break;
895
1177
  }
896
- return _context6.a(2);
1178
+ return _context7.a(2);
897
1179
  case 8:
898
1180
  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) {
1181
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
1182
+ return _regenerator().w(function (_context5) {
1183
+ while (1) switch (_context5.n) {
902
1184
  case 0:
903
- _context4.n = 1;
1185
+ _context5.n = 1;
904
1186
  return access(filePath).then(function () {
905
1187
  return true;
906
1188
  })["catch"](function () {
907
1189
  return false;
908
1190
  });
909
1191
  case 1:
910
- return _context4.a(2, _context4.v);
1192
+ return _context5.a(2, _context5.v);
911
1193
  }
912
- }, _callee4);
1194
+ }, _callee5);
913
1195
  }));
914
- return function fileExists(_x6) {
1196
+ return function fileExists(_x7) {
915
1197
  return _ref4.apply(this, arguments);
916
1198
  };
917
1199
  }();
918
1200
  readImageFromDirs = /*#__PURE__*/function () {
919
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
1201
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
920
1202
  var defaultPath, snapshotPath;
921
- return _regenerator().w(function (_context5) {
922
- while (1) switch (_context5.n) {
1203
+ return _regenerator().w(function (_context6) {
1204
+ while (1) switch (_context6.n) {
923
1205
  case 0:
924
1206
  defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
925
1207
  snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
926
- _context5.n = 1;
1208
+ _context6.n = 1;
927
1209
  return fileExists(defaultPath);
928
1210
  case 1:
929
- if (!_context5.v) {
930
- _context5.n = 3;
1211
+ if (!_context6.v) {
1212
+ _context6.n = 3;
931
1213
  break;
932
1214
  }
933
- _context5.n = 2;
1215
+ _context6.n = 2;
934
1216
  return readImageAsBase64(defaultPath);
935
1217
  case 2:
936
- return _context5.a(2, _context5.v);
1218
+ return _context6.a(2, _context6.v);
937
1219
  case 3:
938
- _context5.n = 4;
1220
+ _context6.n = 4;
939
1221
  return fileExists(snapshotPath);
940
1222
  case 4:
941
- if (!_context5.v) {
942
- _context5.n = 6;
1223
+ if (!_context6.v) {
1224
+ _context6.n = 6;
943
1225
  break;
944
1226
  }
945
- _context5.n = 5;
1227
+ _context6.n = 5;
946
1228
  return readImageAsBase64(snapshotPath);
947
1229
  case 5:
948
- return _context5.a(2, _context5.v);
1230
+ return _context6.a(2, _context6.v);
949
1231
  case 6:
950
- return _context5.a(2, undefined);
1232
+ return _context6.a(2, undefined);
951
1233
  }
952
- }, _callee5);
1234
+ }, _callee6);
953
1235
  }));
954
- return function readImageFromDirs(_x7) {
1236
+ return function readImageFromDirs(_x8) {
955
1237
  return _ref5.apply(this, arguments);
956
1238
  };
957
1239
  }();
958
- _context6.n = 9;
1240
+ _context7.n = 9;
959
1241
  return readImageFromDirs("actual");
960
1242
  case 9:
961
- actualBase64 = _context6.v;
962
- _context6.n = 10;
1243
+ actualBase64 = _context7.v;
1244
+ _context7.n = 10;
963
1245
  return readImageFromDirs("expected");
964
1246
  case 10:
965
- expectedBase64 = _context6.v;
966
- _context6.n = 11;
1247
+ expectedBase64 = _context7.v;
1248
+ _context7.n = 11;
967
1249
  return readImageFromDirs("diff");
968
1250
  case 11:
969
- diffBase64 = _context6.v;
1251
+ diffBase64 = _context7.v;
970
1252
  diffName = attachment.name.replace(diffEndRegexp, "");
971
1253
  this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
972
1254
  expected: expectedBase64,
@@ -979,11 +1261,11 @@ export var AllureReporter = /*#__PURE__*/function () {
979
1261
  });
980
1262
  this.processedDiffs.push(pathWithoutEnd);
981
1263
  case 12:
982
- return _context6.a(2);
1264
+ return _context7.a(2);
983
1265
  }
984
- }, _callee6, this);
1266
+ }, _callee7, this);
985
1267
  }));
986
- function processAttachment(_x3, _x4, _x5) {
1268
+ function processAttachment(_x4, _x5, _x6) {
987
1269
  return _processAttachment.apply(this, arguments);
988
1270
  }
989
1271
  return processAttachment;