allure-playwright 3.2.0 → 3.2.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 +172 -86
- 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 +171 -86
- 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 +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -28,12 +28,9 @@ import path from "node:path";
|
|
|
28
28
|
import process from "node:process";
|
|
29
29
|
import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
|
|
30
30
|
import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
|
|
31
|
-
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getThreadLabel, getWorstTestStepResult, md5, parseTestPlan, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
31
|
+
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getThreadLabel, getWorstTestStepResult, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
32
32
|
import { allurePlaywrightLegacyApi } from "./legacy.js";
|
|
33
|
-
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, statusToAllureStats } from "./utils.js";
|
|
34
|
-
|
|
35
|
-
// TODO: move to utils.ts
|
|
36
|
-
var diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/;
|
|
33
|
+
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
|
|
37
34
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
38
35
|
export var AllureReporter = /*#__PURE__*/function () {
|
|
39
36
|
function AllureReporter(config) {
|
|
@@ -50,6 +47,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
50
47
|
_defineProperty(this, "attachmentSteps", new Map());
|
|
51
48
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
52
49
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
50
|
+
_defineProperty(this, "beforeHooksAttachmentsStack", new Map());
|
|
51
|
+
_defineProperty(this, "afterHooksAttachmentsStack", new Map());
|
|
53
52
|
this.options = _objectSpread({
|
|
54
53
|
suiteTitle: true,
|
|
55
54
|
detail: true
|
|
@@ -244,8 +243,14 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
244
243
|
}, {
|
|
245
244
|
key: "onStepBegin",
|
|
246
245
|
value: function onStepBegin(test, _result, step) {
|
|
246
|
+
var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
247
|
+
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
248
|
+
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
249
|
+
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
250
|
+
var isAfterHookDescendant = isAfterHookStep(step);
|
|
251
|
+
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
247
252
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
248
|
-
if (step.category === "attach") {
|
|
253
|
+
if (step.category === "attach" && !isHookStep) {
|
|
249
254
|
var _this$allureRuntime, _this$attachmentSteps;
|
|
250
255
|
var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
|
|
251
256
|
this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
|
|
@@ -257,15 +262,25 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
257
262
|
var baseStep = _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
258
263
|
name: step.title,
|
|
259
264
|
start: step.startTime.getTime(),
|
|
260
|
-
stage: Stage.RUNNING
|
|
265
|
+
stage: Stage.RUNNING,
|
|
266
|
+
uuid: randomUuid()
|
|
261
267
|
});
|
|
262
|
-
|
|
263
|
-
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
264
|
-
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
265
|
-
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
266
|
-
var isAfterHookDescendant = isAfterHookStep(step);
|
|
267
|
-
if (isBeforeHookDescendant || isAfterHookDescendant) {
|
|
268
|
+
if (isHookStep) {
|
|
268
269
|
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
270
|
+
if (step.category === "attach") {
|
|
271
|
+
stack.startStep(baseStep);
|
|
272
|
+
var attachStack = isBeforeHookDescendant ? this.beforeHooksAttachmentsStack : this.afterHooksAttachmentsStack;
|
|
273
|
+
stack.updateStep(function (stepResult) {
|
|
274
|
+
var _attachStack$get;
|
|
275
|
+
stepResult.name = normalizeHookTitle(stepResult.name);
|
|
276
|
+
stepResult.stage = Stage.FINISHED;
|
|
277
|
+
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [_objectSpread(_objectSpread({}, step), {}, {
|
|
278
|
+
uuid: stepResult.uuid
|
|
279
|
+
})]));
|
|
280
|
+
});
|
|
281
|
+
stack.stopStep();
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
269
284
|
stack.startStep(baseStep);
|
|
270
285
|
return;
|
|
271
286
|
}
|
|
@@ -287,7 +302,6 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
287
302
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
288
303
|
return;
|
|
289
304
|
}
|
|
290
|
-
|
|
291
305
|
// ignore attach steps since attachments are already in the report
|
|
292
306
|
if (step.category === "attach") {
|
|
293
307
|
return;
|
|
@@ -341,10 +355,12 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
341
355
|
value: function () {
|
|
342
356
|
var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
|
|
343
357
|
var _this = this,
|
|
358
|
+
_this$beforeHooksAtta,
|
|
359
|
+
_this$afterHooksAttac,
|
|
344
360
|
_this$attachmentSteps2;
|
|
345
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentSteps, i, attachment, attachmentStep;
|
|
346
|
-
return _regeneratorRuntime().wrap(function _callee$(
|
|
347
|
-
while (1) switch (
|
|
361
|
+
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;
|
|
362
|
+
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
363
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
348
364
|
case 0:
|
|
349
365
|
testUuid = this.allureResultsUuids.get(test.id); // We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
350
366
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
@@ -390,22 +406,30 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
390
406
|
testResult.status = statusToAllureStats(result.status, test.expectedStatus);
|
|
391
407
|
testResult.stage = Stage.FINISHED;
|
|
392
408
|
});
|
|
409
|
+
attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
|
|
410
|
+
attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
|
|
411
|
+
hookAttachmentUuids = new Set([].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)).map(function (hookStep) {
|
|
412
|
+
return normalizeHookTitle(hookStep.title);
|
|
413
|
+
}).filter(Boolean));
|
|
393
414
|
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
415
|
+
attachmentsInSteps = result.attachments.filter(function (attachment) {
|
|
416
|
+
return !hookAttachmentUuids.has(attachment.name);
|
|
417
|
+
});
|
|
394
418
|
i = 0;
|
|
395
|
-
case
|
|
396
|
-
if (!(i <
|
|
397
|
-
|
|
419
|
+
case 14:
|
|
420
|
+
if (!(i < attachmentsInSteps.length)) {
|
|
421
|
+
_context2.next = 22;
|
|
398
422
|
break;
|
|
399
423
|
}
|
|
400
|
-
attachment =
|
|
424
|
+
attachment = attachmentsInSteps[i];
|
|
401
425
|
attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
|
|
402
|
-
|
|
426
|
+
_context2.next = 19;
|
|
403
427
|
return this.processAttachment(testUuid, attachmentStep, attachment);
|
|
404
|
-
case
|
|
428
|
+
case 19:
|
|
405
429
|
i++;
|
|
406
|
-
|
|
430
|
+
_context2.next = 14;
|
|
407
431
|
break;
|
|
408
|
-
case
|
|
432
|
+
case 22:
|
|
409
433
|
if (result.stdout.length > 0) {
|
|
410
434
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from(stripAnsi(result.stdout.join("")), "utf-8"), {
|
|
411
435
|
contentType: ContentType.TEXT
|
|
@@ -419,6 +443,67 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
419
443
|
|
|
420
444
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
421
445
|
// in next iterations we need to implement the logic for every javascript integration
|
|
446
|
+
hookAttachmentNames = new Set([].concat(_toConsumableArray(attachmentsInBeforeHooks), _toConsumableArray(attachmentsInAfterHooks)).map(function (hookStep) {
|
|
447
|
+
return normalizeHookTitle(hookStep.title);
|
|
448
|
+
}).filter(Boolean));
|
|
449
|
+
onlyHooksAttachments = result.attachments.filter(function (att) {
|
|
450
|
+
return hookAttachmentNames.has(att.name);
|
|
451
|
+
});
|
|
452
|
+
_iterator2 = _createForOfIteratorHelper(onlyHooksAttachments);
|
|
453
|
+
_context2.prev = 27;
|
|
454
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
455
|
+
var attachment, matchingBeforeHookStep, matchingAfterHookStep, targetStack, hookStep, stepResult, fileName;
|
|
456
|
+
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
457
|
+
while (1) switch (_context.prev = _context.next) {
|
|
458
|
+
case 0:
|
|
459
|
+
attachment = _step2.value;
|
|
460
|
+
matchingBeforeHookStep = attachmentsInBeforeHooks.find(function (step) {
|
|
461
|
+
return normalizeHookTitle(step.title) === attachment.name;
|
|
462
|
+
});
|
|
463
|
+
matchingAfterHookStep = attachmentsInAfterHooks.find(function (step) {
|
|
464
|
+
return normalizeHookTitle(step.title) === attachment.name;
|
|
465
|
+
});
|
|
466
|
+
targetStack = matchingBeforeHookStep ? beforeHooksStack : afterHooksStack;
|
|
467
|
+
hookStep = matchingBeforeHookStep || matchingAfterHookStep;
|
|
468
|
+
if (targetStack && hookStep) {
|
|
469
|
+
stepResult = targetStack === null || targetStack === void 0 ? void 0 : targetStack.findStepByUuid(hookStep === null || hookStep === void 0 ? void 0 : hookStep.uuid);
|
|
470
|
+
if (stepResult) {
|
|
471
|
+
fileName = targetStack.addAttachment(attachment, _this.allureRuntime.writer);
|
|
472
|
+
stepResult.attachments.push({
|
|
473
|
+
name: attachment.name,
|
|
474
|
+
type: attachment.contentType,
|
|
475
|
+
source: fileName
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
case 6:
|
|
480
|
+
case "end":
|
|
481
|
+
return _context.stop();
|
|
482
|
+
}
|
|
483
|
+
}, _loop);
|
|
484
|
+
});
|
|
485
|
+
_iterator2.s();
|
|
486
|
+
case 30:
|
|
487
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
488
|
+
_context2.next = 34;
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
return _context2.delegateYield(_loop(), "t0", 32);
|
|
492
|
+
case 32:
|
|
493
|
+
_context2.next = 30;
|
|
494
|
+
break;
|
|
495
|
+
case 34:
|
|
496
|
+
_context2.next = 39;
|
|
497
|
+
break;
|
|
498
|
+
case 36:
|
|
499
|
+
_context2.prev = 36;
|
|
500
|
+
_context2.t1 = _context2["catch"](27);
|
|
501
|
+
_iterator2.e(_context2.t1);
|
|
502
|
+
case 39:
|
|
503
|
+
_context2.prev = 39;
|
|
504
|
+
_iterator2.f();
|
|
505
|
+
return _context2.finish(39);
|
|
506
|
+
case 42:
|
|
422
507
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
423
508
|
var mappedLabels = testResult.labels.reduce(function (acc, label) {
|
|
424
509
|
if (!acc[label.name]) {
|
|
@@ -450,11 +535,11 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
450
535
|
duration: result.duration
|
|
451
536
|
});
|
|
452
537
|
this.allureRuntime.writeTest(testUuid);
|
|
453
|
-
case
|
|
538
|
+
case 45:
|
|
454
539
|
case "end":
|
|
455
|
-
return
|
|
540
|
+
return _context2.stop();
|
|
456
541
|
}
|
|
457
|
-
}, _callee, this);
|
|
542
|
+
}, _callee, this, [[27, 36, 39, 42]]);
|
|
458
543
|
}));
|
|
459
544
|
function onTestEnd(_x, _x2) {
|
|
460
545
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -466,26 +551,26 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
466
551
|
value: function () {
|
|
467
552
|
var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
468
553
|
var _this2 = this;
|
|
469
|
-
var unprocessedCases,
|
|
470
|
-
return _regeneratorRuntime().wrap(function _callee2$(
|
|
471
|
-
while (1) switch (
|
|
554
|
+
var unprocessedCases, _iterator3, _step3, testCase;
|
|
555
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
556
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
472
557
|
case 0:
|
|
473
558
|
unprocessedCases = this.suite.allTests().filter(function (_ref4) {
|
|
474
559
|
var title = _ref4.title;
|
|
475
560
|
var titleMetadata = extractMetadataFromString(title);
|
|
476
561
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
477
562
|
});
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
563
|
+
_iterator3 = _createForOfIteratorHelper(unprocessedCases);
|
|
564
|
+
_context3.prev = 2;
|
|
565
|
+
_iterator3.s();
|
|
481
566
|
case 4:
|
|
482
|
-
if ((
|
|
483
|
-
|
|
567
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
568
|
+
_context3.next = 11;
|
|
484
569
|
break;
|
|
485
570
|
}
|
|
486
|
-
testCase =
|
|
571
|
+
testCase = _step3.value;
|
|
487
572
|
this.onTestBegin(testCase);
|
|
488
|
-
|
|
573
|
+
_context3.next = 9;
|
|
489
574
|
return this.onTestEnd(testCase, {
|
|
490
575
|
status: Status.SKIPPED,
|
|
491
576
|
attachments: [],
|
|
@@ -500,22 +585,22 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
500
585
|
startTime: this.globalStartTime
|
|
501
586
|
});
|
|
502
587
|
case 9:
|
|
503
|
-
|
|
588
|
+
_context3.next = 4;
|
|
504
589
|
break;
|
|
505
590
|
case 11:
|
|
506
|
-
|
|
591
|
+
_context3.next = 16;
|
|
507
592
|
break;
|
|
508
593
|
case 13:
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
594
|
+
_context3.prev = 13;
|
|
595
|
+
_context3.t0 = _context3["catch"](2);
|
|
596
|
+
_iterator3.e(_context3.t0);
|
|
512
597
|
case 16:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
return
|
|
598
|
+
_context3.prev = 16;
|
|
599
|
+
_iterator3.f();
|
|
600
|
+
return _context3.finish(16);
|
|
516
601
|
case 19:
|
|
517
602
|
case "end":
|
|
518
|
-
return
|
|
603
|
+
return _context3.stop();
|
|
519
604
|
}
|
|
520
605
|
}, _callee2, this, [[2, 13, 16, 19]]);
|
|
521
606
|
}));
|
|
@@ -528,17 +613,17 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
528
613
|
key: "onEnd",
|
|
529
614
|
value: function () {
|
|
530
615
|
var _onEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
531
|
-
return _regeneratorRuntime().wrap(function _callee3$(
|
|
532
|
-
while (1) switch (
|
|
616
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
617
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
533
618
|
case 0:
|
|
534
|
-
|
|
619
|
+
_context4.next = 2;
|
|
535
620
|
return this.addSkippedResults();
|
|
536
621
|
case 2:
|
|
537
622
|
this.allureRuntime.writeEnvironmentInfo();
|
|
538
623
|
this.allureRuntime.writeCategoriesDefinitions();
|
|
539
624
|
case 4:
|
|
540
625
|
case "end":
|
|
541
|
-
return
|
|
626
|
+
return _context4.stop();
|
|
542
627
|
}
|
|
543
628
|
}, _callee3, this);
|
|
544
629
|
}));
|
|
@@ -571,37 +656,37 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
571
656
|
key: "processAttachment",
|
|
572
657
|
value: function () {
|
|
573
658
|
var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(testUuid, attachmentStepUuid, attachment) {
|
|
574
|
-
var allureRuntimeMessage, message, parentUuid, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
|
|
575
|
-
return _regeneratorRuntime().wrap(function _callee4$(
|
|
576
|
-
while (1) switch (
|
|
659
|
+
var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
|
|
660
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
661
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
577
662
|
case 0:
|
|
578
663
|
if (!(!attachment.body && !attachment.path)) {
|
|
579
|
-
|
|
664
|
+
_context5.next = 2;
|
|
580
665
|
break;
|
|
581
666
|
}
|
|
582
|
-
return
|
|
667
|
+
return _context5.abrupt("return");
|
|
583
668
|
case 2:
|
|
584
669
|
allureRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
585
670
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
586
|
-
|
|
671
|
+
_context5.next = 5;
|
|
587
672
|
break;
|
|
588
673
|
}
|
|
589
|
-
return
|
|
674
|
+
return _context5.abrupt("return");
|
|
590
675
|
case 5:
|
|
591
676
|
if (!allureRuntimeMessage) {
|
|
592
|
-
|
|
677
|
+
_context5.next = 12;
|
|
593
678
|
break;
|
|
594
679
|
}
|
|
595
680
|
message = JSON.parse(attachment.body.toString());
|
|
596
681
|
if (!(message.type === "step_metadata")) {
|
|
597
|
-
|
|
682
|
+
_context5.next = 10;
|
|
598
683
|
break;
|
|
599
684
|
}
|
|
600
685
|
this.processStepMetadataMessage(attachmentStepUuid, message);
|
|
601
|
-
return
|
|
686
|
+
return _context5.abrupt("return");
|
|
602
687
|
case 10:
|
|
603
688
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
604
|
-
return
|
|
689
|
+
return _context5.abrupt("return");
|
|
605
690
|
case 12:
|
|
606
691
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
607
692
|
name: attachment.name
|
|
@@ -612,51 +697,51 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
612
697
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
613
698
|
}
|
|
614
699
|
if (!attachment.body) {
|
|
615
|
-
|
|
700
|
+
_context5.next = 18;
|
|
616
701
|
break;
|
|
617
702
|
}
|
|
618
703
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
619
704
|
contentType: attachment.contentType
|
|
620
705
|
});
|
|
621
|
-
|
|
706
|
+
_context5.next = 24;
|
|
622
707
|
break;
|
|
623
708
|
case 18:
|
|
624
709
|
if (existsSync(attachment.path)) {
|
|
625
|
-
|
|
710
|
+
_context5.next = 22;
|
|
626
711
|
break;
|
|
627
712
|
}
|
|
628
|
-
return
|
|
713
|
+
return _context5.abrupt("return");
|
|
629
714
|
case 22:
|
|
630
|
-
|
|
715
|
+
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
|
|
631
716
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
632
|
-
contentType:
|
|
717
|
+
contentType: contentType
|
|
633
718
|
});
|
|
634
|
-
case
|
|
719
|
+
case 24:
|
|
635
720
|
if (attachment.name.match(diffEndRegexp)) {
|
|
636
|
-
|
|
721
|
+
_context5.next = 26;
|
|
637
722
|
break;
|
|
638
723
|
}
|
|
639
|
-
return
|
|
640
|
-
case
|
|
724
|
+
return _context5.abrupt("return");
|
|
725
|
+
case 26:
|
|
641
726
|
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
|
|
642
727
|
if (!this.processedDiffs.includes(pathWithoutEnd)) {
|
|
643
|
-
|
|
728
|
+
_context5.next = 29;
|
|
644
729
|
break;
|
|
645
730
|
}
|
|
646
|
-
return
|
|
647
|
-
case
|
|
648
|
-
|
|
731
|
+
return _context5.abrupt("return");
|
|
732
|
+
case 29:
|
|
733
|
+
_context5.next = 31;
|
|
649
734
|
return readImageAsBase64("".concat(pathWithoutEnd, "-actual.png"));
|
|
650
|
-
case
|
|
651
|
-
actualBase64 =
|
|
652
|
-
|
|
735
|
+
case 31:
|
|
736
|
+
actualBase64 = _context5.sent;
|
|
737
|
+
_context5.next = 34;
|
|
653
738
|
return readImageAsBase64("".concat(pathWithoutEnd, "-expected.png"));
|
|
654
|
-
case
|
|
655
|
-
expectedBase64 =
|
|
656
|
-
|
|
739
|
+
case 34:
|
|
740
|
+
expectedBase64 = _context5.sent;
|
|
741
|
+
_context5.next = 37;
|
|
657
742
|
return readImageAsBase64("".concat(pathWithoutEnd, "-diff.png"));
|
|
658
|
-
case
|
|
659
|
-
diffBase64 =
|
|
743
|
+
case 37:
|
|
744
|
+
diffBase64 = _context5.sent;
|
|
660
745
|
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
661
746
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
662
747
|
expected: expectedBase64,
|
|
@@ -668,9 +753,9 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
668
753
|
fileExtension: ".imagediff"
|
|
669
754
|
});
|
|
670
755
|
this.processedDiffs.push(pathWithoutEnd);
|
|
671
|
-
case
|
|
756
|
+
case 41:
|
|
672
757
|
case "end":
|
|
673
|
-
return
|
|
758
|
+
return _context5.stop();
|
|
674
759
|
}
|
|
675
760
|
}, _callee4, this);
|
|
676
761
|
}));
|