allure-playwright 3.2.1 → 3.3.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/cjs/index.js +166 -78
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/utils.js +5 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +165 -78
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/utils.js +4 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +4 -20
- package/dist/types/model.d.ts +23 -0
- package/dist/types/utils.d.ts +2 -0
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -51,8 +51,6 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
51
51
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
52
52
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
53
53
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
54
|
-
// TODO: move to utils.ts
|
|
55
|
-
var diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/;
|
|
56
54
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
57
55
|
var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
58
56
|
function AllureReporter(config) {
|
|
@@ -69,6 +67,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
69
67
|
_defineProperty(this, "attachmentSteps", new Map());
|
|
70
68
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
71
69
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
70
|
+
_defineProperty(this, "beforeHooksAttachmentsStack", new Map());
|
|
71
|
+
_defineProperty(this, "afterHooksAttachmentsStack", new Map());
|
|
72
72
|
this.options = _objectSpread({
|
|
73
73
|
suiteTitle: true,
|
|
74
74
|
detail: true
|
|
@@ -159,7 +159,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
159
159
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
160
160
|
var project = suite.project();
|
|
161
161
|
var testFilePath = _nodePath["default"].relative(project === null || project === void 0 ? void 0 : project.testDir, test.location.file);
|
|
162
|
-
var
|
|
162
|
+
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
163
|
+
var relativeFile = relativeFileParts.join("/");
|
|
163
164
|
// root > project > file path > test.describe...
|
|
164
165
|
var _suite$titlePath = suite.titlePath(),
|
|
165
166
|
_suite$titlePath2 = _toArray(_suite$titlePath),
|
|
@@ -173,7 +174,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
173
174
|
parameters: [],
|
|
174
175
|
steps: [],
|
|
175
176
|
testCaseId: (0, _reporter.md5)(testCaseIdBase),
|
|
176
|
-
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column)
|
|
177
|
+
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
|
|
178
|
+
titlePath: relativeFileParts.concat.apply(relativeFileParts, _toConsumableArray(suiteTitles))
|
|
177
179
|
};
|
|
178
180
|
result.labels.push((0, _reporter.getLanguageLabel)());
|
|
179
181
|
result.labels.push((0, _reporter.getFrameworkLabel)("playwright"));
|
|
@@ -263,8 +265,14 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
263
265
|
}, {
|
|
264
266
|
key: "onStepBegin",
|
|
265
267
|
value: function onStepBegin(test, _result, step) {
|
|
268
|
+
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
269
|
+
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
270
|
+
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
271
|
+
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
272
|
+
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
273
|
+
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
266
274
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
267
|
-
if (step.category === "attach") {
|
|
275
|
+
if (step.category === "attach" && !isHookStep) {
|
|
268
276
|
var _this$allureRuntime, _this$attachmentSteps;
|
|
269
277
|
var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
|
|
270
278
|
this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
|
|
@@ -276,15 +284,25 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
276
284
|
var baseStep = _objectSpread(_objectSpread({}, (0, _reporter.createStepResult)()), {}, {
|
|
277
285
|
name: step.title,
|
|
278
286
|
start: step.startTime.getTime(),
|
|
279
|
-
stage: _allureJsCommons.Stage.RUNNING
|
|
287
|
+
stage: _allureJsCommons.Stage.RUNNING,
|
|
288
|
+
uuid: (0, _reporter.randomUuid)()
|
|
280
289
|
});
|
|
281
|
-
|
|
282
|
-
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
283
|
-
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
284
|
-
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
285
|
-
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
286
|
-
if (isBeforeHookDescendant || isAfterHookDescendant) {
|
|
290
|
+
if (isHookStep) {
|
|
287
291
|
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
292
|
+
if (step.category === "attach") {
|
|
293
|
+
stack.startStep(baseStep);
|
|
294
|
+
var attachStack = isBeforeHookDescendant ? this.beforeHooksAttachmentsStack : this.afterHooksAttachmentsStack;
|
|
295
|
+
stack.updateStep(function (stepResult) {
|
|
296
|
+
var _attachStack$get;
|
|
297
|
+
stepResult.name = (0, _utils.normalizeHookTitle)(stepResult.name);
|
|
298
|
+
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
299
|
+
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [_objectSpread(_objectSpread({}, step), {}, {
|
|
300
|
+
uuid: stepResult.uuid
|
|
301
|
+
})]));
|
|
302
|
+
});
|
|
303
|
+
stack.stopStep();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
288
306
|
stack.startStep(baseStep);
|
|
289
307
|
return;
|
|
290
308
|
}
|
|
@@ -306,7 +324,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
306
324
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
307
325
|
return;
|
|
308
326
|
}
|
|
309
|
-
|
|
310
327
|
// ignore attach steps since attachments are already in the report
|
|
311
328
|
if (step.category === "attach") {
|
|
312
329
|
return;
|
|
@@ -360,10 +377,12 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
360
377
|
value: function () {
|
|
361
378
|
var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
|
|
362
379
|
var _this = this,
|
|
380
|
+
_this$beforeHooksAtta,
|
|
381
|
+
_this$afterHooksAttac,
|
|
363
382
|
_this$attachmentSteps2;
|
|
364
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentSteps, i, attachment, attachmentStep;
|
|
365
|
-
return _regeneratorRuntime().wrap(function _callee$(
|
|
366
|
-
while (1) switch (
|
|
383
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentsInBeforeHooks, attachmentsInAfterHooks, hookAttachmentUuids, attachmentSteps, attachmentsInSteps, i, attachment, attachmentStep, hookAttachmentNames, onlyHooksAttachments, _iterator2, _step2, _loop;
|
|
384
|
+
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
385
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
367
386
|
case 0:
|
|
368
387
|
testUuid = this.allureResultsUuids.get(test.id); // We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
369
388
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
@@ -409,22 +428,30 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
409
428
|
testResult.status = (0, _utils.statusToAllureStats)(result.status, test.expectedStatus);
|
|
410
429
|
testResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
411
430
|
});
|
|
431
|
+
attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
|
|
432
|
+
attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
|
|
433
|
+
hookAttachmentUuids = new Set([].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)).map(function (hookStep) {
|
|
434
|
+
return (0, _utils.normalizeHookTitle)(hookStep.title);
|
|
435
|
+
}).filter(Boolean));
|
|
412
436
|
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
437
|
+
attachmentsInSteps = result.attachments.filter(function (attachment) {
|
|
438
|
+
return !hookAttachmentUuids.has(attachment.name);
|
|
439
|
+
});
|
|
413
440
|
i = 0;
|
|
414
|
-
case
|
|
415
|
-
if (!(i <
|
|
416
|
-
|
|
441
|
+
case 14:
|
|
442
|
+
if (!(i < attachmentsInSteps.length)) {
|
|
443
|
+
_context2.next = 22;
|
|
417
444
|
break;
|
|
418
445
|
}
|
|
419
|
-
attachment =
|
|
446
|
+
attachment = attachmentsInSteps[i];
|
|
420
447
|
attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
|
|
421
|
-
|
|
448
|
+
_context2.next = 19;
|
|
422
449
|
return this.processAttachment(testUuid, attachmentStep, attachment);
|
|
423
|
-
case
|
|
450
|
+
case 19:
|
|
424
451
|
i++;
|
|
425
|
-
|
|
452
|
+
_context2.next = 14;
|
|
426
453
|
break;
|
|
427
|
-
case
|
|
454
|
+
case 22:
|
|
428
455
|
if (result.stdout.length > 0) {
|
|
429
456
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
|
|
430
457
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
@@ -438,6 +465,67 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
438
465
|
|
|
439
466
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
440
467
|
// in next iterations we need to implement the logic for every javascript integration
|
|
468
|
+
hookAttachmentNames = new Set([].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)).map(function (hookStep) {
|
|
469
|
+
return (0, _utils.normalizeHookTitle)(hookStep.title);
|
|
470
|
+
}).filter(Boolean));
|
|
471
|
+
onlyHooksAttachments = result.attachments.filter(function (att) {
|
|
472
|
+
return hookAttachmentNames.has(att.name);
|
|
473
|
+
});
|
|
474
|
+
_iterator2 = _createForOfIteratorHelper(onlyHooksAttachments);
|
|
475
|
+
_context2.prev = 27;
|
|
476
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
477
|
+
var attachment, matchingBeforeHookStep, matchingAfterHookStep, targetStack, hookStep, stepResult, fileName;
|
|
478
|
+
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
479
|
+
while (1) switch (_context.prev = _context.next) {
|
|
480
|
+
case 0:
|
|
481
|
+
attachment = _step2.value;
|
|
482
|
+
matchingBeforeHookStep = attachmentsInBeforeHooks.find(function (step) {
|
|
483
|
+
return (0, _utils.normalizeHookTitle)(step.title) === attachment.name;
|
|
484
|
+
});
|
|
485
|
+
matchingAfterHookStep = attachmentsInAfterHooks.find(function (step) {
|
|
486
|
+
return (0, _utils.normalizeHookTitle)(step.title) === attachment.name;
|
|
487
|
+
});
|
|
488
|
+
targetStack = matchingBeforeHookStep ? beforeHooksStack : afterHooksStack;
|
|
489
|
+
hookStep = matchingBeforeHookStep || matchingAfterHookStep;
|
|
490
|
+
if (targetStack && hookStep) {
|
|
491
|
+
stepResult = targetStack === null || targetStack === void 0 ? void 0 : targetStack.findStepByUuid(hookStep === null || hookStep === void 0 ? void 0 : hookStep.uuid);
|
|
492
|
+
if (stepResult) {
|
|
493
|
+
fileName = targetStack.addAttachment(attachment, _this.allureRuntime.writer);
|
|
494
|
+
stepResult.attachments.push({
|
|
495
|
+
name: attachment.name,
|
|
496
|
+
type: attachment.contentType,
|
|
497
|
+
source: fileName
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
case 6:
|
|
502
|
+
case "end":
|
|
503
|
+
return _context.stop();
|
|
504
|
+
}
|
|
505
|
+
}, _loop);
|
|
506
|
+
});
|
|
507
|
+
_iterator2.s();
|
|
508
|
+
case 30:
|
|
509
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
510
|
+
_context2.next = 34;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
return _context2.delegateYield(_loop(), "t0", 32);
|
|
514
|
+
case 32:
|
|
515
|
+
_context2.next = 30;
|
|
516
|
+
break;
|
|
517
|
+
case 34:
|
|
518
|
+
_context2.next = 39;
|
|
519
|
+
break;
|
|
520
|
+
case 36:
|
|
521
|
+
_context2.prev = 36;
|
|
522
|
+
_context2.t1 = _context2["catch"](27);
|
|
523
|
+
_iterator2.e(_context2.t1);
|
|
524
|
+
case 39:
|
|
525
|
+
_context2.prev = 39;
|
|
526
|
+
_iterator2.f();
|
|
527
|
+
return _context2.finish(39);
|
|
528
|
+
case 42:
|
|
441
529
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
442
530
|
var mappedLabels = testResult.labels.reduce(function (acc, label) {
|
|
443
531
|
if (!acc[label.name]) {
|
|
@@ -469,11 +557,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
469
557
|
duration: result.duration
|
|
470
558
|
});
|
|
471
559
|
this.allureRuntime.writeTest(testUuid);
|
|
472
|
-
case
|
|
560
|
+
case 45:
|
|
473
561
|
case "end":
|
|
474
|
-
return
|
|
562
|
+
return _context2.stop();
|
|
475
563
|
}
|
|
476
|
-
}, _callee, this);
|
|
564
|
+
}, _callee, this, [[27, 36, 39, 42]]);
|
|
477
565
|
}));
|
|
478
566
|
function onTestEnd(_x, _x2) {
|
|
479
567
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -485,26 +573,26 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
485
573
|
value: function () {
|
|
486
574
|
var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
487
575
|
var _this2 = this;
|
|
488
|
-
var unprocessedCases,
|
|
489
|
-
return _regeneratorRuntime().wrap(function _callee2$(
|
|
490
|
-
while (1) switch (
|
|
576
|
+
var unprocessedCases, _iterator3, _step3, testCase;
|
|
577
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
578
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
491
579
|
case 0:
|
|
492
580
|
unprocessedCases = this.suite.allTests().filter(function (_ref4) {
|
|
493
581
|
var title = _ref4.title;
|
|
494
582
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
495
583
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
496
584
|
});
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
585
|
+
_iterator3 = _createForOfIteratorHelper(unprocessedCases);
|
|
586
|
+
_context3.prev = 2;
|
|
587
|
+
_iterator3.s();
|
|
500
588
|
case 4:
|
|
501
|
-
if ((
|
|
502
|
-
|
|
589
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
590
|
+
_context3.next = 11;
|
|
503
591
|
break;
|
|
504
592
|
}
|
|
505
|
-
testCase =
|
|
593
|
+
testCase = _step3.value;
|
|
506
594
|
this.onTestBegin(testCase);
|
|
507
|
-
|
|
595
|
+
_context3.next = 9;
|
|
508
596
|
return this.onTestEnd(testCase, {
|
|
509
597
|
status: _allureJsCommons.Status.SKIPPED,
|
|
510
598
|
attachments: [],
|
|
@@ -519,22 +607,22 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
519
607
|
startTime: this.globalStartTime
|
|
520
608
|
});
|
|
521
609
|
case 9:
|
|
522
|
-
|
|
610
|
+
_context3.next = 4;
|
|
523
611
|
break;
|
|
524
612
|
case 11:
|
|
525
|
-
|
|
613
|
+
_context3.next = 16;
|
|
526
614
|
break;
|
|
527
615
|
case 13:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
616
|
+
_context3.prev = 13;
|
|
617
|
+
_context3.t0 = _context3["catch"](2);
|
|
618
|
+
_iterator3.e(_context3.t0);
|
|
531
619
|
case 16:
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return
|
|
620
|
+
_context3.prev = 16;
|
|
621
|
+
_iterator3.f();
|
|
622
|
+
return _context3.finish(16);
|
|
535
623
|
case 19:
|
|
536
624
|
case "end":
|
|
537
|
-
return
|
|
625
|
+
return _context3.stop();
|
|
538
626
|
}
|
|
539
627
|
}, _callee2, this, [[2, 13, 16, 19]]);
|
|
540
628
|
}));
|
|
@@ -547,17 +635,17 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
547
635
|
key: "onEnd",
|
|
548
636
|
value: function () {
|
|
549
637
|
var _onEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
550
|
-
return _regeneratorRuntime().wrap(function _callee3$(
|
|
551
|
-
while (1) switch (
|
|
638
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
639
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
552
640
|
case 0:
|
|
553
|
-
|
|
641
|
+
_context4.next = 2;
|
|
554
642
|
return this.addSkippedResults();
|
|
555
643
|
case 2:
|
|
556
644
|
this.allureRuntime.writeEnvironmentInfo();
|
|
557
645
|
this.allureRuntime.writeCategoriesDefinitions();
|
|
558
646
|
case 4:
|
|
559
647
|
case "end":
|
|
560
|
-
return
|
|
648
|
+
return _context4.stop();
|
|
561
649
|
}
|
|
562
650
|
}, _callee3, this);
|
|
563
651
|
}));
|
|
@@ -591,36 +679,36 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
591
679
|
value: function () {
|
|
592
680
|
var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(testUuid, attachmentStepUuid, attachment) {
|
|
593
681
|
var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
|
|
594
|
-
return _regeneratorRuntime().wrap(function _callee4$(
|
|
595
|
-
while (1) switch (
|
|
682
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
683
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
596
684
|
case 0:
|
|
597
685
|
if (!(!attachment.body && !attachment.path)) {
|
|
598
|
-
|
|
686
|
+
_context5.next = 2;
|
|
599
687
|
break;
|
|
600
688
|
}
|
|
601
|
-
return
|
|
689
|
+
return _context5.abrupt("return");
|
|
602
690
|
case 2:
|
|
603
691
|
allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
604
692
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
605
|
-
|
|
693
|
+
_context5.next = 5;
|
|
606
694
|
break;
|
|
607
695
|
}
|
|
608
|
-
return
|
|
696
|
+
return _context5.abrupt("return");
|
|
609
697
|
case 5:
|
|
610
698
|
if (!allureRuntimeMessage) {
|
|
611
|
-
|
|
699
|
+
_context5.next = 12;
|
|
612
700
|
break;
|
|
613
701
|
}
|
|
614
702
|
message = JSON.parse(attachment.body.toString());
|
|
615
703
|
if (!(message.type === "step_metadata")) {
|
|
616
|
-
|
|
704
|
+
_context5.next = 10;
|
|
617
705
|
break;
|
|
618
706
|
}
|
|
619
707
|
this.processStepMetadataMessage(attachmentStepUuid, message);
|
|
620
|
-
return
|
|
708
|
+
return _context5.abrupt("return");
|
|
621
709
|
case 10:
|
|
622
710
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
623
|
-
return
|
|
711
|
+
return _context5.abrupt("return");
|
|
624
712
|
case 12:
|
|
625
713
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
626
714
|
name: attachment.name
|
|
@@ -631,52 +719,52 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
631
719
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
632
720
|
}
|
|
633
721
|
if (!attachment.body) {
|
|
634
|
-
|
|
722
|
+
_context5.next = 18;
|
|
635
723
|
break;
|
|
636
724
|
}
|
|
637
725
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
638
726
|
contentType: attachment.contentType
|
|
639
727
|
});
|
|
640
|
-
|
|
728
|
+
_context5.next = 24;
|
|
641
729
|
break;
|
|
642
730
|
case 18:
|
|
643
731
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
644
|
-
|
|
732
|
+
_context5.next = 22;
|
|
645
733
|
break;
|
|
646
734
|
}
|
|
647
|
-
return
|
|
735
|
+
return _context5.abrupt("return");
|
|
648
736
|
case 22:
|
|
649
737
|
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
|
|
650
738
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
651
739
|
contentType: contentType
|
|
652
740
|
});
|
|
653
741
|
case 24:
|
|
654
|
-
if (attachment.name.match(diffEndRegexp)) {
|
|
655
|
-
|
|
742
|
+
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
743
|
+
_context5.next = 26;
|
|
656
744
|
break;
|
|
657
745
|
}
|
|
658
|
-
return
|
|
746
|
+
return _context5.abrupt("return");
|
|
659
747
|
case 26:
|
|
660
|
-
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
|
|
748
|
+
pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "");
|
|
661
749
|
if (!this.processedDiffs.includes(pathWithoutEnd)) {
|
|
662
|
-
|
|
750
|
+
_context5.next = 29;
|
|
663
751
|
break;
|
|
664
752
|
}
|
|
665
|
-
return
|
|
753
|
+
return _context5.abrupt("return");
|
|
666
754
|
case 29:
|
|
667
|
-
|
|
755
|
+
_context5.next = 31;
|
|
668
756
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-actual.png"));
|
|
669
757
|
case 31:
|
|
670
|
-
actualBase64 =
|
|
671
|
-
|
|
758
|
+
actualBase64 = _context5.sent;
|
|
759
|
+
_context5.next = 34;
|
|
672
760
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-expected.png"));
|
|
673
761
|
case 34:
|
|
674
|
-
expectedBase64 =
|
|
675
|
-
|
|
762
|
+
expectedBase64 = _context5.sent;
|
|
763
|
+
_context5.next = 37;
|
|
676
764
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-diff.png"));
|
|
677
765
|
case 37:
|
|
678
|
-
diffBase64 =
|
|
679
|
-
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
766
|
+
diffBase64 = _context5.sent;
|
|
767
|
+
diffName = attachment.name.replace(_utils.diffEndRegexp, "");
|
|
680
768
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
681
769
|
expected: expectedBase64,
|
|
682
770
|
actual: actualBase64,
|
|
@@ -689,7 +777,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
689
777
|
this.processedDiffs.push(pathWithoutEnd);
|
|
690
778
|
case 41:
|
|
691
779
|
case "end":
|
|
692
|
-
return
|
|
780
|
+
return _context5.stop();
|
|
693
781
|
}
|
|
694
782
|
}, _callee4, this);
|
|
695
783
|
}));
|