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/esm/index.js CHANGED
@@ -27,6 +27,7 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
27
27
  /* eslint max-lines: off */
28
28
 
29
29
  import { existsSync } from "node:fs";
30
+ import { access } from "node:fs/promises";
30
31
  import path from "node:path";
31
32
  import process from "node:process";
32
33
  import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
@@ -42,6 +43,8 @@ export var AllureReporter = /*#__PURE__*/function () {
42
43
  _defineProperty(this, "config", void 0);
43
44
  _defineProperty(this, "suite", void 0);
44
45
  _defineProperty(this, "options", void 0);
46
+ _defineProperty(this, "outputDir", void 0);
47
+ _defineProperty(this, "snapshotDir", void 0);
45
48
  _defineProperty(this, "allureRuntime", void 0);
46
49
  _defineProperty(this, "globalStartTime", new Date());
47
50
  _defineProperty(this, "processedDiffs", []);
@@ -52,6 +55,7 @@ export var AllureReporter = /*#__PURE__*/function () {
52
55
  _defineProperty(this, "afterHooksStepsStack", new Map());
53
56
  _defineProperty(this, "beforeHooksAttachmentsStack", new Map());
54
57
  _defineProperty(this, "afterHooksAttachmentsStack", new Map());
58
+ _defineProperty(this, "pwStepUuid", new WeakMap());
55
59
  this.options = _objectSpread({
56
60
  suiteTitle: true,
57
61
  detail: true
@@ -61,6 +65,8 @@ export var AllureReporter = /*#__PURE__*/function () {
61
65
  key: "onConfigure",
62
66
  value: function onConfigure(config) {
63
67
  this.config = config;
68
+ this.outputDir = config.projects[0].outputDir;
69
+ this.snapshotDir = config.projects[0].snapshotDir;
64
70
  var testPlan = parseTestPlan();
65
71
  if (!testPlan) {
66
72
  return;
@@ -248,6 +254,7 @@ export var AllureReporter = /*#__PURE__*/function () {
248
254
  }, {
249
255
  key: "onStepBegin",
250
256
  value: function onStepBegin(test, _result, step) {
257
+ var _this$pwStepUuid$get;
251
258
  var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
252
259
  var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
253
260
  var isRootHook = isRootBeforeHook || isRootAfterHook;
@@ -299,7 +306,11 @@ export var AllureReporter = /*#__PURE__*/function () {
299
306
  }
300
307
  return;
301
308
  }
302
- this.allureRuntime.startStep(testUuid, undefined, baseStep);
309
+ var parentUuid = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
310
+ var createdUuid = this.allureRuntime.startStep(testUuid, parentUuid, baseStep);
311
+ if (createdUuid) {
312
+ this.pwStepUuid.set(step, createdUuid);
313
+ }
303
314
  }
304
315
  }, {
305
316
  key: "onStepEnd",
@@ -340,7 +351,11 @@ export var AllureReporter = /*#__PURE__*/function () {
340
351
  if (!currentStep) {
341
352
  return;
342
353
  }
343
- this.allureRuntime.updateStep(currentStep, function (stepResult) {
354
+ var stepUuid = this.pwStepUuid.get(step);
355
+ if (!stepUuid) {
356
+ return;
357
+ }
358
+ this.allureRuntime.updateStep(stepUuid, function (stepResult) {
344
359
  var _getWorstTestStepResu2;
345
360
  var _ref3 = (_getWorstTestStepResu2 = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
346
361
  _ref3$status = _ref3.status,
@@ -351,7 +366,7 @@ export var AllureReporter = /*#__PURE__*/function () {
351
366
  stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
352
367
  }
353
368
  });
354
- this.allureRuntime.stopStep(currentStep, {
369
+ this.allureRuntime.stopStep(stepUuid, {
355
370
  duration: step.duration
356
371
  });
357
372
  }
@@ -363,7 +378,7 @@ export var AllureReporter = /*#__PURE__*/function () {
363
378
  _this$beforeHooksAtta,
364
379
  _this$afterHooksAttac,
365
380
  _this$attachmentSteps2;
366
- 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;
381
+ 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;
367
382
  return _regenerator().w(function (_context) {
368
383
  while (1) switch (_context.n) {
369
384
  case 0:
@@ -413,51 +428,87 @@ export var AllureReporter = /*#__PURE__*/function () {
413
428
  });
414
429
  attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
415
430
  attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
416
- hookAttachmentCounts = new Map();
417
- for (_i = 0, _arr = [].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)); _i < _arr.length; _i++) {
418
- hookStep = _arr[_i];
419
- name = normalizeHookTitle(hookStep.title);
420
- if (name) {
421
- hookAttachmentCounts.set(name, (hookAttachmentCounts.get(name) || 0) + 1);
422
- }
423
- }
424
431
  attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
425
- onlyHooksAttachments = [];
426
- attachmentsInSteps = [];
427
- attachmentCounts = new Map();
428
- _iterator2 = _createForOfIteratorHelper(result.attachments);
432
+ attachmentToStepMap = new Map();
433
+ attachmentIndex = 0;
434
+ _iterator2 = _createForOfIteratorHelper(attachmentsInBeforeHooks);
429
435
  try {
430
436
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
431
- _attachment2 = _step2.value;
432
- hookCount = hookAttachmentCounts.get(_attachment2.name) || 0;
433
- currentCount = attachmentCounts.get(_attachment2.name) || 0;
434
- if (currentCount < hookCount) {
435
- onlyHooksAttachments.push(_attachment2);
436
- } else {
437
- attachmentsInSteps.push(_attachment2);
438
- }
439
- attachmentCounts.set(_attachment2.name, currentCount + 1);
437
+ _hookStep = _step2.value;
438
+ attachmentToStepMap.set(attachmentIndex, {
439
+ stepUuid: _hookStep.uuid,
440
+ isHook: true,
441
+ hookStep: _hookStep
442
+ });
443
+ attachmentIndex++;
440
444
  }
441
445
  } catch (err) {
442
446
  _iterator2.e(err);
443
447
  } finally {
444
448
  _iterator2.f();
445
449
  }
450
+ _iterator3 = _createForOfIteratorHelper(attachmentSteps);
451
+ try {
452
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
453
+ stepUuid = _step3.value;
454
+ attachmentToStepMap.set(attachmentIndex, {
455
+ stepUuid: stepUuid,
456
+ isHook: false
457
+ });
458
+ attachmentIndex++;
459
+ }
460
+ } catch (err) {
461
+ _iterator3.e(err);
462
+ } finally {
463
+ _iterator3.f();
464
+ }
465
+ _iterator4 = _createForOfIteratorHelper(attachmentsInAfterHooks);
466
+ try {
467
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
468
+ _hookStep2 = _step4.value;
469
+ attachmentToStepMap.set(attachmentIndex, {
470
+ stepUuid: _hookStep2.uuid,
471
+ isHook: true,
472
+ hookStep: _hookStep2
473
+ });
474
+ attachmentIndex++;
475
+ }
476
+ } catch (err) {
477
+ _iterator4.e(err);
478
+ } finally {
479
+ _iterator4.f();
480
+ }
446
481
  i = 0;
447
482
  case 1:
448
- if (!(i < attachmentsInSteps.length)) {
449
- _context.n = 3;
483
+ if (!(i < result.attachments.length)) {
484
+ _context.n = 6;
485
+ break;
486
+ }
487
+ attachment = result.attachments[i];
488
+ stepInfo = attachmentToStepMap.get(i);
489
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.isHook)) {
490
+ _context.n = 2;
450
491
  break;
451
492
  }
452
- attachment = attachmentsInSteps[i];
453
- attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
454
- _context.n = 2;
455
- return this.processAttachment(testUuid, attachmentStep, attachment);
493
+ return _context.a(3, 5);
456
494
  case 2:
495
+ if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
496
+ _context.n = 4;
497
+ break;
498
+ }
499
+ _context.n = 3;
500
+ return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
501
+ case 3:
502
+ _context.n = 5;
503
+ break;
504
+ case 4:
505
+ _context.n = 5;
506
+ return this.processAttachment(testUuid, undefined, attachment);
507
+ case 5:
457
508
  i++;
458
509
  _context.n = 1;
459
510
  break;
460
- case 3:
511
+ case 6:
461
512
  if (result.stdout.length > 0) {
462
513
  this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from(stripAnsi(result.stdout.join("")), "utf-8"), {
463
514
  contentType: ContentType.TEXT
@@ -471,41 +522,32 @@ export var AllureReporter = /*#__PURE__*/function () {
471
522
 
472
523
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
473
524
  // in next iterations we need to implement the logic for every javascript integration
474
- beforeHookIndex = 0;
475
- afterHookIndex = 0;
476
- _i2 = 0, _onlyHooksAttachments = onlyHooksAttachments;
477
- case 4:
478
- if (!(_i2 < _onlyHooksAttachments.length)) {
479
- _context.n = 8;
525
+ _i = 0;
526
+ case 7:
527
+ if (!(_i < result.attachments.length)) {
528
+ _context.n = 11;
480
529
  break;
481
530
  }
482
- _attachment = _onlyHooksAttachments[_i2];
483
- matchingBeforeHookStep = null;
484
- matchingAfterHookStep = null;
485
- targetStack = null;
486
- _hookStep = null;
487
- if (beforeHookIndex < attachmentsInBeforeHooks.length) {
488
- matchingBeforeHookStep = attachmentsInBeforeHooks[beforeHookIndex];
489
- targetStack = beforeHooksStack;
490
- _hookStep = matchingBeforeHookStep;
491
- beforeHookIndex++;
492
- } else if (afterHookIndex < attachmentsInAfterHooks.length) {
493
- matchingAfterHookStep = attachmentsInAfterHooks[afterHookIndex];
494
- targetStack = afterHooksStack;
495
- _hookStep = matchingAfterHookStep;
496
- afterHookIndex++;
531
+ _attachment = result.attachments[_i];
532
+ _stepInfo = attachmentToStepMap.get(_i);
533
+ if (!(_stepInfo !== null && _stepInfo !== void 0 && _stepInfo.isHook && _stepInfo.hookStep)) {
534
+ _context.n = 10;
535
+ break;
497
536
  }
537
+ hookStep = _stepInfo.hookStep;
538
+ isBeforeHook = attachmentsInBeforeHooks.includes(hookStep);
539
+ targetStack = isBeforeHook ? beforeHooksStack : afterHooksStack;
498
540
  if (!(_attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE)) {
499
- _context.n = 6;
541
+ _context.n = 9;
500
542
  break;
501
543
  }
502
- _context.n = 5;
503
- return this.processAttachment(testUuid, (_hookStep2 = _hookStep) === null || _hookStep2 === void 0 ? void 0 : _hookStep2.uuid, _attachment);
504
- case 5:
505
- return _context.a(3, 7);
506
- case 6:
507
- if (targetStack && _hookStep) {
508
- stepResult = (_targetStack = targetStack) === null || _targetStack === void 0 ? void 0 : _targetStack.findStepByUuid((_hookStep3 = _hookStep) === null || _hookStep3 === void 0 ? void 0 : _hookStep3.uuid);
544
+ _context.n = 8;
545
+ return this.processAttachment(testUuid, hookStep.uuid, _attachment);
546
+ case 8:
547
+ return _context.a(3, 10);
548
+ case 9:
549
+ if (targetStack) {
550
+ stepResult = targetStack.findStepByUuid(hookStep.uuid);
509
551
  if (stepResult) {
510
552
  fileName = targetStack.addAttachment(_attachment, this.allureRuntime.writer);
511
553
  stepResult.attachments.push({
@@ -515,11 +557,11 @@ export var AllureReporter = /*#__PURE__*/function () {
515
557
  });
516
558
  }
517
559
  }
518
- case 7:
519
- _i2++;
520
- _context.n = 4;
560
+ case 10:
561
+ _i++;
562
+ _context.n = 7;
521
563
  break;
522
- case 8:
564
+ case 11:
523
565
  this.allureRuntime.updateTest(testUuid, function (testResult) {
524
566
  var mappedLabels = testResult.labels.reduce(function (acc, label) {
525
567
  if (!acc[label.name]) {
@@ -551,7 +593,7 @@ export var AllureReporter = /*#__PURE__*/function () {
551
593
  duration: result.duration
552
594
  });
553
595
  this.allureRuntime.writeTest(testUuid);
554
- case 9:
596
+ case 12:
555
597
  return _context.a(2);
556
598
  }
557
599
  }, _callee, this);
@@ -566,7 +608,7 @@ export var AllureReporter = /*#__PURE__*/function () {
566
608
  value: function () {
567
609
  var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
568
610
  var _this2 = this;
569
- var unprocessedCases, _iterator3, _step3, testCase, _t;
611
+ var unprocessedCases, _iterator5, _step5, testCase, _t;
570
612
  return _regenerator().w(function (_context2) {
571
613
  while (1) switch (_context2.n) {
572
614
  case 0:
@@ -575,15 +617,15 @@ export var AllureReporter = /*#__PURE__*/function () {
575
617
  var titleMetadata = extractMetadataFromString(title);
576
618
  return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
577
619
  });
578
- _iterator3 = _createForOfIteratorHelper(unprocessedCases);
620
+ _iterator5 = _createForOfIteratorHelper(unprocessedCases);
579
621
  _context2.p = 1;
580
- _iterator3.s();
622
+ _iterator5.s();
581
623
  case 2:
582
- if ((_step3 = _iterator3.n()).done) {
624
+ if ((_step5 = _iterator5.n()).done) {
583
625
  _context2.n = 4;
584
626
  break;
585
627
  }
586
- testCase = _step3.value;
628
+ testCase = _step5.value;
587
629
  this.onTestBegin(testCase);
588
630
  _context2.n = 3;
589
631
  return this.onTestEnd(testCase, {
@@ -609,10 +651,10 @@ export var AllureReporter = /*#__PURE__*/function () {
609
651
  case 5:
610
652
  _context2.p = 5;
611
653
  _t = _context2.v;
612
- _iterator3.e(_t);
654
+ _iterator5.e(_t);
613
655
  case 6:
614
656
  _context2.p = 6;
615
- _iterator3.f();
657
+ _iterator5.f();
616
658
  return _context2.f(6);
617
659
  case 7:
618
660
  return _context2.a(2);
@@ -669,38 +711,39 @@ export var AllureReporter = /*#__PURE__*/function () {
669
711
  }, {
670
712
  key: "processAttachment",
671
713
  value: function () {
672
- var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(testUuid, attachmentStepUuid, attachment) {
673
- var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
674
- return _regenerator().w(function (_context4) {
675
- while (1) switch (_context4.n) {
714
+ var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(testUuid, attachmentStepUuid, attachment) {
715
+ var _replace;
716
+ var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
717
+ return _regenerator().w(function (_context6) {
718
+ while (1) switch (_context6.n) {
676
719
  case 0:
677
720
  if (!(!attachment.body && !attachment.path)) {
678
- _context4.n = 1;
721
+ _context6.n = 1;
679
722
  break;
680
723
  }
681
- return _context4.a(2);
724
+ return _context6.a(2);
682
725
  case 1:
683
726
  allureRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
684
727
  if (!(allureRuntimeMessage && !attachment.body)) {
685
- _context4.n = 2;
728
+ _context6.n = 2;
686
729
  break;
687
730
  }
688
- return _context4.a(2);
731
+ return _context6.a(2);
689
732
  case 2:
690
733
  if (!allureRuntimeMessage) {
691
- _context4.n = 4;
734
+ _context6.n = 4;
692
735
  break;
693
736
  }
694
737
  message = JSON.parse(attachment.body.toString());
695
738
  if (!(message.type === "step_metadata")) {
696
- _context4.n = 3;
739
+ _context6.n = 3;
697
740
  break;
698
741
  }
699
742
  this.processStepMetadataMessage(attachmentStepUuid, message);
700
- return _context4.a(2);
743
+ return _context6.a(2);
701
744
  case 3:
702
745
  this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
703
- return _context4.a(2);
746
+ return _context6.a(2);
704
747
  case 4:
705
748
  parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
706
749
  name: attachment.name
@@ -711,20 +754,20 @@ export var AllureReporter = /*#__PURE__*/function () {
711
754
  this.allureRuntime.stopStep(parentUuid, undefined);
712
755
  }
713
756
  if (!attachment.body) {
714
- _context4.n = 5;
757
+ _context6.n = 5;
715
758
  break;
716
759
  }
717
760
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
718
761
  contentType: attachment.contentType
719
762
  });
720
- _context4.n = 7;
763
+ _context6.n = 7;
721
764
  break;
722
765
  case 5:
723
766
  if (existsSync(attachment.path)) {
724
- _context4.n = 6;
767
+ _context6.n = 6;
725
768
  break;
726
769
  }
727
- return _context4.a(2);
770
+ return _context6.a(2);
728
771
  case 6:
729
772
  contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
730
773
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
@@ -732,30 +775,91 @@ export var AllureReporter = /*#__PURE__*/function () {
732
775
  });
733
776
  case 7:
734
777
  if (attachment.name.match(diffEndRegexp)) {
735
- _context4.n = 8;
778
+ _context6.n = 8;
736
779
  break;
737
780
  }
738
- return _context4.a(2);
781
+ return _context6.a(2);
739
782
  case 8:
740
- pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
741
- if (!this.processedDiffs.includes(pathWithoutEnd)) {
742
- _context4.n = 9;
783
+ pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
784
+ pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
785
+ if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
786
+ _context6.n = 9;
743
787
  break;
744
788
  }
745
- return _context4.a(2);
789
+ return _context6.a(2);
746
790
  case 9:
747
- _context4.n = 10;
748
- return readImageAsBase64("".concat(pathWithoutEnd, "-actual.png"));
791
+ fileExists = /*#__PURE__*/function () {
792
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
793
+ return _regenerator().w(function (_context4) {
794
+ while (1) switch (_context4.n) {
795
+ case 0:
796
+ _context4.n = 1;
797
+ return access(filePath).then(function () {
798
+ return true;
799
+ })["catch"](function () {
800
+ return false;
801
+ });
802
+ case 1:
803
+ return _context4.a(2, _context4.v);
804
+ }
805
+ }, _callee4);
806
+ }));
807
+ return function fileExists(_x6) {
808
+ return _ref5.apply(this, arguments);
809
+ };
810
+ }();
811
+ readImageFromDirs = /*#__PURE__*/function () {
812
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
813
+ var defaultPath, snapshotPath;
814
+ return _regenerator().w(function (_context5) {
815
+ while (1) switch (_context5.n) {
816
+ case 0:
817
+ defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
818
+ snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
819
+ _context5.n = 1;
820
+ return fileExists(defaultPath);
821
+ case 1:
822
+ if (!_context5.v) {
823
+ _context5.n = 3;
824
+ break;
825
+ }
826
+ _context5.n = 2;
827
+ return readImageAsBase64(defaultPath);
828
+ case 2:
829
+ return _context5.a(2, _context5.v);
830
+ case 3:
831
+ _context5.n = 4;
832
+ return fileExists(snapshotPath);
833
+ case 4:
834
+ if (!_context5.v) {
835
+ _context5.n = 6;
836
+ break;
837
+ }
838
+ _context5.n = 5;
839
+ return readImageAsBase64(snapshotPath);
840
+ case 5:
841
+ return _context5.a(2, _context5.v);
842
+ case 6:
843
+ return _context5.a(2, undefined);
844
+ }
845
+ }, _callee5);
846
+ }));
847
+ return function readImageFromDirs(_x7) {
848
+ return _ref6.apply(this, arguments);
849
+ };
850
+ }();
851
+ _context6.n = 10;
852
+ return readImageFromDirs("actual");
749
853
  case 10:
750
- actualBase64 = _context4.v;
751
- _context4.n = 11;
752
- return readImageAsBase64("".concat(pathWithoutEnd, "-expected.png"));
854
+ actualBase64 = _context6.v;
855
+ _context6.n = 11;
856
+ return readImageFromDirs("expected");
753
857
  case 11:
754
- expectedBase64 = _context4.v;
755
- _context4.n = 12;
756
- return readImageAsBase64("".concat(pathWithoutEnd, "-diff.png"));
858
+ expectedBase64 = _context6.v;
859
+ _context6.n = 12;
860
+ return readImageFromDirs("diff");
757
861
  case 12:
758
- diffBase64 = _context4.v;
862
+ diffBase64 = _context6.v;
759
863
  diffName = attachment.name.replace(diffEndRegexp, "");
760
864
  this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
761
865
  expected: expectedBase64,
@@ -768,9 +872,9 @@ export var AllureReporter = /*#__PURE__*/function () {
768
872
  });
769
873
  this.processedDiffs.push(pathWithoutEnd);
770
874
  case 13:
771
- return _context4.a(2);
875
+ return _context6.a(2);
772
876
  }
773
- }, _callee4, this);
877
+ }, _callee6, this);
774
878
  }));
775
879
  function processAttachment(_x3, _x4, _x5) {
776
880
  return _processAttachment.apply(this, arguments);