allure-playwright 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "test", {
18
18
  }
19
19
  });
20
20
  var _nodeFs = require("node:fs");
21
+ var _promises = require("node:fs/promises");
21
22
  var _nodePath = _interopRequireDefault(require("node:path"));
22
23
  var _nodeProcess = _interopRequireDefault(require("node:process"));
23
24
  var _allureJsCommons = require("allure-js-commons");
@@ -60,6 +61,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
60
61
  _defineProperty(this, "config", void 0);
61
62
  _defineProperty(this, "suite", void 0);
62
63
  _defineProperty(this, "options", void 0);
64
+ _defineProperty(this, "outputDir", void 0);
65
+ _defineProperty(this, "snapshotDir", void 0);
63
66
  _defineProperty(this, "allureRuntime", void 0);
64
67
  _defineProperty(this, "globalStartTime", new Date());
65
68
  _defineProperty(this, "processedDiffs", []);
@@ -70,6 +73,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
70
73
  _defineProperty(this, "afterHooksStepsStack", new Map());
71
74
  _defineProperty(this, "beforeHooksAttachmentsStack", new Map());
72
75
  _defineProperty(this, "afterHooksAttachmentsStack", new Map());
76
+ _defineProperty(this, "pwStepUuid", new WeakMap());
73
77
  this.options = _objectSpread({
74
78
  suiteTitle: true,
75
79
  detail: true
@@ -79,6 +83,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
79
83
  key: "onConfigure",
80
84
  value: function onConfigure(config) {
81
85
  this.config = config;
86
+ this.outputDir = config.projects[0].outputDir;
87
+ this.snapshotDir = config.projects[0].snapshotDir;
82
88
  var testPlan = (0, _reporter.parseTestPlan)();
83
89
  if (!testPlan) {
84
90
  return;
@@ -266,6 +272,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
266
272
  }, {
267
273
  key: "onStepBegin",
268
274
  value: function onStepBegin(test, _result, step) {
275
+ var _this$pwStepUuid$get;
269
276
  var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
270
277
  var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
271
278
  var isRootHook = isRootBeforeHook || isRootAfterHook;
@@ -317,7 +324,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
317
324
  }
318
325
  return;
319
326
  }
320
- this.allureRuntime.startStep(testUuid, undefined, baseStep);
327
+ var parentUuid = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
328
+ var createdUuid = this.allureRuntime.startStep(testUuid, parentUuid, baseStep);
329
+ if (createdUuid) {
330
+ this.pwStepUuid.set(step, createdUuid);
331
+ }
321
332
  }
322
333
  }, {
323
334
  key: "onStepEnd",
@@ -358,7 +369,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
358
369
  if (!currentStep) {
359
370
  return;
360
371
  }
361
- this.allureRuntime.updateStep(currentStep, function (stepResult) {
372
+ var stepUuid = this.pwStepUuid.get(step);
373
+ if (!stepUuid) {
374
+ return;
375
+ }
376
+ this.allureRuntime.updateStep(stepUuid, function (stepResult) {
362
377
  var _getWorstTestStepResu2;
363
378
  var _ref3 = (_getWorstTestStepResu2 = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
364
379
  _ref3$status = _ref3.status,
@@ -369,7 +384,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
369
384
  stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
370
385
  }
371
386
  });
372
- this.allureRuntime.stopStep(currentStep, {
387
+ this.allureRuntime.stopStep(stepUuid, {
373
388
  duration: step.duration
374
389
  });
375
390
  }
@@ -381,7 +396,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
381
396
  _this$beforeHooksAtta,
382
397
  _this$afterHooksAttac,
383
398
  _this$attachmentSteps2;
384
- var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentsInBeforeHooks, attachmentsInAfterHooks, hookAttachmentCounts, _i, _arr, hookStep, name, attachmentSteps, onlyHooksAttachments, attachmentsInSteps, attachmentCounts, _iterator2, _step2, _attachment2, hookCount, currentCount, i, attachment, attachmentStep, beforeHookIndex, afterHookIndex, _i2, _onlyHooksAttachments, _attachment, matchingBeforeHookStep, matchingAfterHookStep, targetStack, _hookStep, _hookStep2, _targetStack, _hookStep3, stepResult, fileName;
399
+ var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentsInBeforeHooks, attachmentsInAfterHooks, attachmentSteps, attachmentToStepMap, attachmentIndex, _iterator2, _step2, _hookStep, _iterator3, _step3, stepUuid, _iterator4, _step4, _hookStep2, i, attachment, stepInfo, _i, _attachment, _stepInfo, hookStep, isBeforeHook, targetStack, stepResult, fileName;
385
400
  return _regenerator().w(function (_context) {
386
401
  while (1) switch (_context.n) {
387
402
  case 0:
@@ -431,51 +446,87 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
431
446
  });
432
447
  attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
433
448
  attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
434
- hookAttachmentCounts = new Map();
435
- for (_i = 0, _arr = [].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)); _i < _arr.length; _i++) {
436
- hookStep = _arr[_i];
437
- name = (0, _utils.normalizeHookTitle)(hookStep.title);
438
- if (name) {
439
- hookAttachmentCounts.set(name, (hookAttachmentCounts.get(name) || 0) + 1);
440
- }
441
- }
442
449
  attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
443
- onlyHooksAttachments = [];
444
- attachmentsInSteps = [];
445
- attachmentCounts = new Map();
446
- _iterator2 = _createForOfIteratorHelper(result.attachments);
450
+ attachmentToStepMap = new Map();
451
+ attachmentIndex = 0;
452
+ _iterator2 = _createForOfIteratorHelper(attachmentsInBeforeHooks);
447
453
  try {
448
454
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
449
- _attachment2 = _step2.value;
450
- hookCount = hookAttachmentCounts.get(_attachment2.name) || 0;
451
- currentCount = attachmentCounts.get(_attachment2.name) || 0;
452
- if (currentCount < hookCount) {
453
- onlyHooksAttachments.push(_attachment2);
454
- } else {
455
- attachmentsInSteps.push(_attachment2);
456
- }
457
- attachmentCounts.set(_attachment2.name, currentCount + 1);
455
+ _hookStep = _step2.value;
456
+ attachmentToStepMap.set(attachmentIndex, {
457
+ stepUuid: _hookStep.uuid,
458
+ isHook: true,
459
+ hookStep: _hookStep
460
+ });
461
+ attachmentIndex++;
458
462
  }
459
463
  } catch (err) {
460
464
  _iterator2.e(err);
461
465
  } finally {
462
466
  _iterator2.f();
463
467
  }
468
+ _iterator3 = _createForOfIteratorHelper(attachmentSteps);
469
+ try {
470
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
471
+ stepUuid = _step3.value;
472
+ attachmentToStepMap.set(attachmentIndex, {
473
+ stepUuid: stepUuid,
474
+ isHook: false
475
+ });
476
+ attachmentIndex++;
477
+ }
478
+ } catch (err) {
479
+ _iterator3.e(err);
480
+ } finally {
481
+ _iterator3.f();
482
+ }
483
+ _iterator4 = _createForOfIteratorHelper(attachmentsInAfterHooks);
484
+ try {
485
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
486
+ _hookStep2 = _step4.value;
487
+ attachmentToStepMap.set(attachmentIndex, {
488
+ stepUuid: _hookStep2.uuid,
489
+ isHook: true,
490
+ hookStep: _hookStep2
491
+ });
492
+ attachmentIndex++;
493
+ }
494
+ } catch (err) {
495
+ _iterator4.e(err);
496
+ } finally {
497
+ _iterator4.f();
498
+ }
464
499
  i = 0;
465
500
  case 1:
466
- if (!(i < attachmentsInSteps.length)) {
467
- _context.n = 3;
501
+ if (!(i < result.attachments.length)) {
502
+ _context.n = 6;
503
+ break;
504
+ }
505
+ attachment = result.attachments[i];
506
+ stepInfo = attachmentToStepMap.get(i);
507
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.isHook)) {
508
+ _context.n = 2;
468
509
  break;
469
510
  }
470
- attachment = attachmentsInSteps[i];
471
- attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
472
- _context.n = 2;
473
- return this.processAttachment(testUuid, attachmentStep, attachment);
511
+ return _context.a(3, 5);
474
512
  case 2:
513
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
514
+ _context.n = 4;
515
+ break;
516
+ }
517
+ _context.n = 3;
518
+ return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
519
+ case 3:
520
+ _context.n = 5;
521
+ break;
522
+ case 4:
523
+ _context.n = 5;
524
+ return this.processAttachment(testUuid, undefined, attachment);
525
+ case 5:
475
526
  i++;
476
527
  _context.n = 1;
477
528
  break;
478
- case 3:
529
+ case 6:
479
530
  if (result.stdout.length > 0) {
480
531
  this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
481
532
  contentType: _allureJsCommons.ContentType.TEXT
@@ -489,41 +540,32 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
489
540
 
490
541
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
491
542
  // in next iterations we need to implement the logic for every javascript integration
492
- beforeHookIndex = 0;
493
- afterHookIndex = 0;
494
- _i2 = 0, _onlyHooksAttachments = onlyHooksAttachments;
495
- case 4:
496
- if (!(_i2 < _onlyHooksAttachments.length)) {
497
- _context.n = 8;
543
+ _i = 0;
544
+ case 7:
545
+ if (!(_i < result.attachments.length)) {
546
+ _context.n = 11;
498
547
  break;
499
548
  }
500
- _attachment = _onlyHooksAttachments[_i2];
501
- matchingBeforeHookStep = null;
502
- matchingAfterHookStep = null;
503
- targetStack = null;
504
- _hookStep = null;
505
- if (beforeHookIndex < attachmentsInBeforeHooks.length) {
506
- matchingBeforeHookStep = attachmentsInBeforeHooks[beforeHookIndex];
507
- targetStack = beforeHooksStack;
508
- _hookStep = matchingBeforeHookStep;
509
- beforeHookIndex++;
510
- } else if (afterHookIndex < attachmentsInAfterHooks.length) {
511
- matchingAfterHookStep = attachmentsInAfterHooks[afterHookIndex];
512
- targetStack = afterHooksStack;
513
- _hookStep = matchingAfterHookStep;
514
- afterHookIndex++;
549
+ _attachment = result.attachments[_i];
550
+ _stepInfo = attachmentToStepMap.get(_i);
551
+ if (!(_stepInfo !== null && _stepInfo !== void 0 && _stepInfo.isHook && _stepInfo.hookStep)) {
552
+ _context.n = 10;
553
+ break;
515
554
  }
555
+ hookStep = _stepInfo.hookStep;
556
+ isBeforeHook = attachmentsInBeforeHooks.includes(hookStep);
557
+ targetStack = isBeforeHook ? beforeHooksStack : afterHooksStack;
516
558
  if (!(_attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE)) {
517
- _context.n = 6;
559
+ _context.n = 9;
518
560
  break;
519
561
  }
520
- _context.n = 5;
521
- return this.processAttachment(testUuid, (_hookStep2 = _hookStep) === null || _hookStep2 === void 0 ? void 0 : _hookStep2.uuid, _attachment);
522
- case 5:
523
- return _context.a(3, 7);
524
- case 6:
525
- if (targetStack && _hookStep) {
526
- stepResult = (_targetStack = targetStack) === null || _targetStack === void 0 ? void 0 : _targetStack.findStepByUuid((_hookStep3 = _hookStep) === null || _hookStep3 === void 0 ? void 0 : _hookStep3.uuid);
562
+ _context.n = 8;
563
+ return this.processAttachment(testUuid, hookStep.uuid, _attachment);
564
+ case 8:
565
+ return _context.a(3, 10);
566
+ case 9:
567
+ if (targetStack) {
568
+ stepResult = targetStack.findStepByUuid(hookStep.uuid);
527
569
  if (stepResult) {
528
570
  fileName = targetStack.addAttachment(_attachment, this.allureRuntime.writer);
529
571
  stepResult.attachments.push({
@@ -533,11 +575,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
533
575
  });
534
576
  }
535
577
  }
536
- case 7:
537
- _i2++;
538
- _context.n = 4;
578
+ case 10:
579
+ _i++;
580
+ _context.n = 7;
539
581
  break;
540
- case 8:
582
+ case 11:
541
583
  this.allureRuntime.updateTest(testUuid, function (testResult) {
542
584
  var mappedLabels = testResult.labels.reduce(function (acc, label) {
543
585
  if (!acc[label.name]) {
@@ -569,7 +611,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
569
611
  duration: result.duration
570
612
  });
571
613
  this.allureRuntime.writeTest(testUuid);
572
- case 9:
614
+ case 12:
573
615
  return _context.a(2);
574
616
  }
575
617
  }, _callee, this);
@@ -584,7 +626,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
584
626
  value: function () {
585
627
  var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
586
628
  var _this2 = this;
587
- var unprocessedCases, _iterator3, _step3, testCase, _t;
629
+ var unprocessedCases, _iterator5, _step5, testCase, _t;
588
630
  return _regenerator().w(function (_context2) {
589
631
  while (1) switch (_context2.n) {
590
632
  case 0:
@@ -593,15 +635,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
593
635
  var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
594
636
  return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
595
637
  });
596
- _iterator3 = _createForOfIteratorHelper(unprocessedCases);
638
+ _iterator5 = _createForOfIteratorHelper(unprocessedCases);
597
639
  _context2.p = 1;
598
- _iterator3.s();
640
+ _iterator5.s();
599
641
  case 2:
600
- if ((_step3 = _iterator3.n()).done) {
642
+ if ((_step5 = _iterator5.n()).done) {
601
643
  _context2.n = 4;
602
644
  break;
603
645
  }
604
- testCase = _step3.value;
646
+ testCase = _step5.value;
605
647
  this.onTestBegin(testCase);
606
648
  _context2.n = 3;
607
649
  return this.onTestEnd(testCase, {
@@ -627,10 +669,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
627
669
  case 5:
628
670
  _context2.p = 5;
629
671
  _t = _context2.v;
630
- _iterator3.e(_t);
672
+ _iterator5.e(_t);
631
673
  case 6:
632
674
  _context2.p = 6;
633
- _iterator3.f();
675
+ _iterator5.f();
634
676
  return _context2.f(6);
635
677
  case 7:
636
678
  return _context2.a(2);
@@ -687,38 +729,39 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
687
729
  }, {
688
730
  key: "processAttachment",
689
731
  value: function () {
690
- var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(testUuid, attachmentStepUuid, attachment) {
691
- var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
692
- return _regenerator().w(function (_context4) {
693
- while (1) switch (_context4.n) {
732
+ var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(testUuid, attachmentStepUuid, attachment) {
733
+ var _replace;
734
+ var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
735
+ return _regenerator().w(function (_context6) {
736
+ while (1) switch (_context6.n) {
694
737
  case 0:
695
738
  if (!(!attachment.body && !attachment.path)) {
696
- _context4.n = 1;
739
+ _context6.n = 1;
697
740
  break;
698
741
  }
699
- return _context4.a(2);
742
+ return _context6.a(2);
700
743
  case 1:
701
744
  allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
702
745
  if (!(allureRuntimeMessage && !attachment.body)) {
703
- _context4.n = 2;
746
+ _context6.n = 2;
704
747
  break;
705
748
  }
706
- return _context4.a(2);
749
+ return _context6.a(2);
707
750
  case 2:
708
751
  if (!allureRuntimeMessage) {
709
- _context4.n = 4;
752
+ _context6.n = 4;
710
753
  break;
711
754
  }
712
755
  message = JSON.parse(attachment.body.toString());
713
756
  if (!(message.type === "step_metadata")) {
714
- _context4.n = 3;
757
+ _context6.n = 3;
715
758
  break;
716
759
  }
717
760
  this.processStepMetadataMessage(attachmentStepUuid, message);
718
- return _context4.a(2);
761
+ return _context6.a(2);
719
762
  case 3:
720
763
  this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
721
- return _context4.a(2);
764
+ return _context6.a(2);
722
765
  case 4:
723
766
  parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
724
767
  name: attachment.name
@@ -729,20 +772,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
729
772
  this.allureRuntime.stopStep(parentUuid, undefined);
730
773
  }
731
774
  if (!attachment.body) {
732
- _context4.n = 5;
775
+ _context6.n = 5;
733
776
  break;
734
777
  }
735
778
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
736
779
  contentType: attachment.contentType
737
780
  });
738
- _context4.n = 7;
781
+ _context6.n = 7;
739
782
  break;
740
783
  case 5:
741
784
  if ((0, _nodeFs.existsSync)(attachment.path)) {
742
- _context4.n = 6;
785
+ _context6.n = 6;
743
786
  break;
744
787
  }
745
- return _context4.a(2);
788
+ return _context6.a(2);
746
789
  case 6:
747
790
  contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
748
791
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
@@ -750,30 +793,91 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
750
793
  });
751
794
  case 7:
752
795
  if (attachment.name.match(_utils.diffEndRegexp)) {
753
- _context4.n = 8;
796
+ _context6.n = 8;
754
797
  break;
755
798
  }
756
- return _context4.a(2);
799
+ return _context6.a(2);
757
800
  case 8:
758
- pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "");
759
- if (!this.processedDiffs.includes(pathWithoutEnd)) {
760
- _context4.n = 9;
801
+ pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
802
+ pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
803
+ if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
804
+ _context6.n = 9;
761
805
  break;
762
806
  }
763
- return _context4.a(2);
807
+ return _context6.a(2);
764
808
  case 9:
765
- _context4.n = 10;
766
- return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-actual.png"));
809
+ fileExists = /*#__PURE__*/function () {
810
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
811
+ return _regenerator().w(function (_context4) {
812
+ while (1) switch (_context4.n) {
813
+ case 0:
814
+ _context4.n = 1;
815
+ return (0, _promises.access)(filePath).then(function () {
816
+ return true;
817
+ })["catch"](function () {
818
+ return false;
819
+ });
820
+ case 1:
821
+ return _context4.a(2, _context4.v);
822
+ }
823
+ }, _callee4);
824
+ }));
825
+ return function fileExists(_x6) {
826
+ return _ref5.apply(this, arguments);
827
+ };
828
+ }();
829
+ readImageFromDirs = /*#__PURE__*/function () {
830
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
831
+ var defaultPath, snapshotPath;
832
+ return _regenerator().w(function (_context5) {
833
+ while (1) switch (_context5.n) {
834
+ case 0:
835
+ defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
836
+ snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
837
+ _context5.n = 1;
838
+ return fileExists(defaultPath);
839
+ case 1:
840
+ if (!_context5.v) {
841
+ _context5.n = 3;
842
+ break;
843
+ }
844
+ _context5.n = 2;
845
+ return (0, _reporter.readImageAsBase64)(defaultPath);
846
+ case 2:
847
+ return _context5.a(2, _context5.v);
848
+ case 3:
849
+ _context5.n = 4;
850
+ return fileExists(snapshotPath);
851
+ case 4:
852
+ if (!_context5.v) {
853
+ _context5.n = 6;
854
+ break;
855
+ }
856
+ _context5.n = 5;
857
+ return (0, _reporter.readImageAsBase64)(snapshotPath);
858
+ case 5:
859
+ return _context5.a(2, _context5.v);
860
+ case 6:
861
+ return _context5.a(2, undefined);
862
+ }
863
+ }, _callee5);
864
+ }));
865
+ return function readImageFromDirs(_x7) {
866
+ return _ref6.apply(this, arguments);
867
+ };
868
+ }();
869
+ _context6.n = 10;
870
+ return readImageFromDirs("actual");
767
871
  case 10:
768
- actualBase64 = _context4.v;
769
- _context4.n = 11;
770
- return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-expected.png"));
872
+ actualBase64 = _context6.v;
873
+ _context6.n = 11;
874
+ return readImageFromDirs("expected");
771
875
  case 11:
772
- expectedBase64 = _context4.v;
773
- _context4.n = 12;
774
- return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-diff.png"));
876
+ expectedBase64 = _context6.v;
877
+ _context6.n = 12;
878
+ return readImageFromDirs("diff");
775
879
  case 12:
776
- diffBase64 = _context4.v;
880
+ diffBase64 = _context6.v;
777
881
  diffName = attachment.name.replace(_utils.diffEndRegexp, "");
778
882
  this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
779
883
  expected: expectedBase64,
@@ -786,9 +890,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
786
890
  });
787
891
  this.processedDiffs.push(pathWithoutEnd);
788
892
  case 13:
789
- return _context4.a(2);
893
+ return _context6.a(2);
790
894
  }
791
- }, _callee4, this);
895
+ }, _callee6, this);
792
896
  }));
793
897
  function processAttachment(_x3, _x4, _x5) {
794
898
  return _processAttachment.apply(this, arguments);