allure-playwright 3.4.1 → 3.4.3
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 +204 -170
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +204 -170
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/package.json +6 -6
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,16 +61,19 @@ 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", []);
|
|
66
69
|
_defineProperty(this, "startedTestCasesTitlesCache", []);
|
|
67
70
|
_defineProperty(this, "allureResultsUuids", new Map());
|
|
68
|
-
_defineProperty(this, "
|
|
71
|
+
_defineProperty(this, "attachmentTargets", new Map());
|
|
69
72
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
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$get2;
|
|
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;
|
|
@@ -273,12 +280,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
273
280
|
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
274
281
|
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
275
282
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
276
|
-
if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
|
|
277
|
-
var _this$allureRuntime, _this$attachmentSteps;
|
|
278
|
-
var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
|
|
279
|
-
this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
283
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
@@ -288,20 +289,38 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
288
289
|
stage: _allureJsCommons.Stage.RUNNING,
|
|
289
290
|
uuid: (0, _reporter.randomUuid)()
|
|
290
291
|
});
|
|
292
|
+
if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
|
|
293
|
+
var _this$pwStepUuid$get, _this$attachmentTarge;
|
|
294
|
+
var parent = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
|
|
295
|
+
var targets = (_this$attachmentTarge = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge !== void 0 ? _this$attachmentTarge : [];
|
|
296
|
+
targets.push({
|
|
297
|
+
stepUuid: parent !== null && parent !== void 0 ? parent : undefined
|
|
298
|
+
});
|
|
299
|
+
this.attachmentTargets.set(test.id, targets);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
291
302
|
if (isHookStep) {
|
|
292
303
|
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
293
304
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
305
|
+
var _this$attachmentTarge2;
|
|
306
|
+
var hookStepWithUuid;
|
|
294
307
|
stack.startStep(baseStep);
|
|
295
308
|
var attachStack = isBeforeHookDescendant ? this.beforeHooksAttachmentsStack : this.afterHooksAttachmentsStack;
|
|
296
309
|
stack.updateStep(function (stepResult) {
|
|
297
310
|
var _attachStack$get;
|
|
311
|
+
hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
|
|
312
|
+
uuid: stepResult.uuid
|
|
313
|
+
});
|
|
298
314
|
stepResult.name = (0, _utils.normalizeHookTitle)(stepResult.name);
|
|
299
315
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
300
|
-
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [
|
|
301
|
-
uuid: stepResult.uuid
|
|
302
|
-
})]));
|
|
316
|
+
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [hookStepWithUuid]));
|
|
303
317
|
});
|
|
304
318
|
stack.stopStep();
|
|
319
|
+
var _targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
|
|
320
|
+
_targets.push({
|
|
321
|
+
hookStep: hookStepWithUuid
|
|
322
|
+
});
|
|
323
|
+
this.attachmentTargets.set(test.id, _targets);
|
|
305
324
|
return;
|
|
306
325
|
}
|
|
307
326
|
stack.startStep(baseStep);
|
|
@@ -317,7 +336,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
317
336
|
}
|
|
318
337
|
return;
|
|
319
338
|
}
|
|
320
|
-
this.
|
|
339
|
+
var parentUuid = step.parent ? (_this$pwStepUuid$get2 = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get2 !== void 0 ? _this$pwStepUuid$get2 : null : null;
|
|
340
|
+
var createdUuid = this.allureRuntime.startStep(testUuid, parentUuid, baseStep);
|
|
341
|
+
if (createdUuid) {
|
|
342
|
+
this.pwStepUuid.set(step, createdUuid);
|
|
343
|
+
}
|
|
321
344
|
}
|
|
322
345
|
}, {
|
|
323
346
|
key: "onStepEnd",
|
|
@@ -358,7 +381,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
358
381
|
if (!currentStep) {
|
|
359
382
|
return;
|
|
360
383
|
}
|
|
361
|
-
this.
|
|
384
|
+
var stepUuid = this.pwStepUuid.get(step);
|
|
385
|
+
if (!stepUuid) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
this.allureRuntime.updateStep(stepUuid, function (stepResult) {
|
|
362
389
|
var _getWorstTestStepResu2;
|
|
363
390
|
var _ref3 = (_getWorstTestStepResu2 = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
|
|
364
391
|
_ref3$status = _ref3.status,
|
|
@@ -369,7 +396,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
369
396
|
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
370
397
|
}
|
|
371
398
|
});
|
|
372
|
-
this.allureRuntime.stopStep(
|
|
399
|
+
this.allureRuntime.stopStep(stepUuid, {
|
|
373
400
|
duration: step.duration
|
|
374
401
|
});
|
|
375
402
|
}
|
|
@@ -379,9 +406,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
379
406
|
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(test, result) {
|
|
380
407
|
var _this = this,
|
|
381
408
|
_this$beforeHooksAtta,
|
|
382
|
-
_this$
|
|
383
|
-
|
|
384
|
-
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;
|
|
409
|
+
_this$attachmentTarge3;
|
|
410
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentsInBeforeHooks, attachmentTargets, targetIndex, _iterator2, _step2, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu, _stepInfo$hookStep, stepUuid, hookStep, isBeforeHook, targetStack, stepResult, fileName, _t;
|
|
385
411
|
return _regenerator().w(function (_context) {
|
|
386
412
|
while (1) switch (_context.n) {
|
|
387
413
|
case 0:
|
|
@@ -429,89 +455,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
429
455
|
testResult.status = (0, _utils.statusToAllureStats)(result.status, test.expectedStatus);
|
|
430
456
|
testResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
431
457
|
});
|
|
432
|
-
attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
|
|
433
|
-
attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
|
|
434
|
-
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
435
|
-
attachmentToStepMap = new Map();
|
|
436
|
-
attachmentIndex = 0;
|
|
437
|
-
_iterator2 = _createForOfIteratorHelper(attachmentsInBeforeHooks);
|
|
438
|
-
try {
|
|
439
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
440
|
-
_hookStep = _step2.value;
|
|
441
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
442
|
-
stepUuid: _hookStep.uuid,
|
|
443
|
-
isHook: true,
|
|
444
|
-
hookStep: _hookStep
|
|
445
|
-
});
|
|
446
|
-
attachmentIndex++;
|
|
447
|
-
}
|
|
448
|
-
} catch (err) {
|
|
449
|
-
_iterator2.e(err);
|
|
450
|
-
} finally {
|
|
451
|
-
_iterator2.f();
|
|
452
|
-
}
|
|
453
|
-
_iterator3 = _createForOfIteratorHelper(attachmentSteps);
|
|
454
|
-
try {
|
|
455
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
456
|
-
stepUuid = _step3.value;
|
|
457
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
458
|
-
stepUuid: stepUuid,
|
|
459
|
-
isHook: false
|
|
460
|
-
});
|
|
461
|
-
attachmentIndex++;
|
|
462
|
-
}
|
|
463
|
-
} catch (err) {
|
|
464
|
-
_iterator3.e(err);
|
|
465
|
-
} finally {
|
|
466
|
-
_iterator3.f();
|
|
467
|
-
}
|
|
468
|
-
_iterator4 = _createForOfIteratorHelper(attachmentsInAfterHooks);
|
|
469
|
-
try {
|
|
470
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
471
|
-
_hookStep2 = _step4.value;
|
|
472
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
473
|
-
stepUuid: _hookStep2.uuid,
|
|
474
|
-
isHook: true,
|
|
475
|
-
hookStep: _hookStep2
|
|
476
|
-
});
|
|
477
|
-
attachmentIndex++;
|
|
478
|
-
}
|
|
479
|
-
} catch (err) {
|
|
480
|
-
_iterator4.e(err);
|
|
481
|
-
} finally {
|
|
482
|
-
_iterator4.f();
|
|
483
|
-
}
|
|
484
|
-
i = 0;
|
|
485
|
-
case 1:
|
|
486
|
-
if (!(i < result.attachments.length)) {
|
|
487
|
-
_context.n = 6;
|
|
488
|
-
break;
|
|
489
|
-
}
|
|
490
|
-
attachment = result.attachments[i];
|
|
491
|
-
stepInfo = attachmentToStepMap.get(i);
|
|
492
|
-
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.isHook)) {
|
|
493
|
-
_context.n = 2;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
return _context.a(3, 5);
|
|
497
|
-
case 2:
|
|
498
|
-
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
499
|
-
_context.n = 4;
|
|
500
|
-
break;
|
|
501
|
-
}
|
|
502
|
-
_context.n = 3;
|
|
503
|
-
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
504
|
-
case 3:
|
|
505
|
-
_context.n = 5;
|
|
506
|
-
break;
|
|
507
|
-
case 4:
|
|
508
|
-
_context.n = 5;
|
|
509
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
510
|
-
case 5:
|
|
511
|
-
i++;
|
|
512
|
-
_context.n = 1;
|
|
513
|
-
break;
|
|
514
|
-
case 6:
|
|
515
458
|
if (result.stdout.length > 0) {
|
|
516
459
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
|
|
517
460
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
@@ -522,49 +465,78 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
522
465
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
523
466
|
});
|
|
524
467
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
468
|
+
attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
|
|
469
|
+
attachmentTargets = (_this$attachmentTarge3 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge3 !== void 0 ? _this$attachmentTarge3 : [];
|
|
470
|
+
targetIndex = 0;
|
|
471
|
+
_iterator2 = _createForOfIteratorHelper(result.attachments);
|
|
472
|
+
_context.p = 1;
|
|
473
|
+
_iterator2.s();
|
|
474
|
+
case 2:
|
|
475
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
476
|
+
_context.n = 9;
|
|
532
477
|
break;
|
|
533
478
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
479
|
+
attachment = _step2.value;
|
|
480
|
+
isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
481
|
+
stepInfo = targetIndex < attachmentTargets.length ? attachmentTargets[targetIndex++] : undefined;
|
|
482
|
+
if (!isRuntimeMessage) {
|
|
483
|
+
_context.n = 4;
|
|
538
484
|
break;
|
|
539
485
|
}
|
|
540
|
-
hookStep = _stepInfo.hookStep;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
486
|
+
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;
|
|
487
|
+
_context.n = 3;
|
|
488
|
+
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
489
|
+
case 3:
|
|
490
|
+
return _context.a(3, 8);
|
|
491
|
+
case 4:
|
|
492
|
+
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
493
|
+
_context.n = 5;
|
|
545
494
|
break;
|
|
546
495
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
return _context.a(3, 10);
|
|
551
|
-
case 9:
|
|
496
|
+
hookStep = stepInfo.hookStep;
|
|
497
|
+
isBeforeHook = attachmentsInBeforeHooks.includes(hookStep);
|
|
498
|
+
targetStack = isBeforeHook ? beforeHooksStack : afterHooksStack;
|
|
552
499
|
if (targetStack) {
|
|
553
500
|
stepResult = targetStack.findStepByUuid(hookStep.uuid);
|
|
554
501
|
if (stepResult) {
|
|
555
|
-
fileName = targetStack.addAttachment(
|
|
502
|
+
fileName = targetStack.addAttachment(attachment, this.allureRuntime.writer);
|
|
556
503
|
stepResult.attachments.push({
|
|
557
|
-
name:
|
|
558
|
-
type:
|
|
504
|
+
name: attachment.name,
|
|
505
|
+
type: attachment.contentType,
|
|
559
506
|
source: fileName
|
|
560
507
|
});
|
|
561
508
|
}
|
|
562
509
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
510
|
+
return _context.a(3, 8);
|
|
511
|
+
case 5:
|
|
512
|
+
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
513
|
+
_context.n = 7;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
_context.n = 6;
|
|
517
|
+
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
518
|
+
case 6:
|
|
519
|
+
return _context.a(3, 8);
|
|
520
|
+
case 7:
|
|
521
|
+
_context.n = 8;
|
|
522
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
523
|
+
case 8:
|
|
524
|
+
_context.n = 2;
|
|
566
525
|
break;
|
|
526
|
+
case 9:
|
|
527
|
+
_context.n = 11;
|
|
528
|
+
break;
|
|
529
|
+
case 10:
|
|
530
|
+
_context.p = 10;
|
|
531
|
+
_t = _context.v;
|
|
532
|
+
_iterator2.e(_t);
|
|
567
533
|
case 11:
|
|
534
|
+
_context.p = 11;
|
|
535
|
+
_iterator2.f();
|
|
536
|
+
return _context.f(11);
|
|
537
|
+
case 12:
|
|
538
|
+
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
539
|
+
// in next iterations we need to implement the logic for every javascript integration
|
|
568
540
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
569
541
|
var mappedLabels = testResult.labels.reduce(function (acc, label) {
|
|
570
542
|
if (!acc[label.name]) {
|
|
@@ -596,10 +568,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
596
568
|
duration: result.duration
|
|
597
569
|
});
|
|
598
570
|
this.allureRuntime.writeTest(testUuid);
|
|
599
|
-
case
|
|
571
|
+
case 13:
|
|
600
572
|
return _context.a(2);
|
|
601
573
|
}
|
|
602
|
-
}, _callee, this);
|
|
574
|
+
}, _callee, this, [[1, 10, 11, 12]]);
|
|
603
575
|
}));
|
|
604
576
|
function onTestEnd(_x, _x2) {
|
|
605
577
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -611,7 +583,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
611
583
|
value: function () {
|
|
612
584
|
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
613
585
|
var _this2 = this;
|
|
614
|
-
var unprocessedCases,
|
|
586
|
+
var unprocessedCases, _iterator3, _step3, testCase, _t2;
|
|
615
587
|
return _regenerator().w(function (_context2) {
|
|
616
588
|
while (1) switch (_context2.n) {
|
|
617
589
|
case 0:
|
|
@@ -620,15 +592,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
620
592
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
621
593
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
622
594
|
});
|
|
623
|
-
|
|
595
|
+
_iterator3 = _createForOfIteratorHelper(unprocessedCases);
|
|
624
596
|
_context2.p = 1;
|
|
625
|
-
|
|
597
|
+
_iterator3.s();
|
|
626
598
|
case 2:
|
|
627
|
-
if ((
|
|
599
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
628
600
|
_context2.n = 4;
|
|
629
601
|
break;
|
|
630
602
|
}
|
|
631
|
-
testCase =
|
|
603
|
+
testCase = _step3.value;
|
|
632
604
|
this.onTestBegin(testCase);
|
|
633
605
|
_context2.n = 3;
|
|
634
606
|
return this.onTestEnd(testCase, {
|
|
@@ -653,11 +625,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
653
625
|
break;
|
|
654
626
|
case 5:
|
|
655
627
|
_context2.p = 5;
|
|
656
|
-
|
|
657
|
-
|
|
628
|
+
_t2 = _context2.v;
|
|
629
|
+
_iterator3.e(_t2);
|
|
658
630
|
case 6:
|
|
659
631
|
_context2.p = 6;
|
|
660
|
-
|
|
632
|
+
_iterator3.f();
|
|
661
633
|
return _context2.f(6);
|
|
662
634
|
case 7:
|
|
663
635
|
return _context2.a(2);
|
|
@@ -714,38 +686,39 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
714
686
|
}, {
|
|
715
687
|
key: "processAttachment",
|
|
716
688
|
value: function () {
|
|
717
|
-
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
718
|
-
var
|
|
719
|
-
|
|
720
|
-
|
|
689
|
+
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(testUuid, attachmentStepUuid, attachment) {
|
|
690
|
+
var _replace;
|
|
691
|
+
var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
|
|
692
|
+
return _regenerator().w(function (_context6) {
|
|
693
|
+
while (1) switch (_context6.n) {
|
|
721
694
|
case 0:
|
|
722
695
|
if (!(!attachment.body && !attachment.path)) {
|
|
723
|
-
|
|
696
|
+
_context6.n = 1;
|
|
724
697
|
break;
|
|
725
698
|
}
|
|
726
|
-
return
|
|
699
|
+
return _context6.a(2);
|
|
727
700
|
case 1:
|
|
728
701
|
allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
729
702
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
730
|
-
|
|
703
|
+
_context6.n = 2;
|
|
731
704
|
break;
|
|
732
705
|
}
|
|
733
|
-
return
|
|
706
|
+
return _context6.a(2);
|
|
734
707
|
case 2:
|
|
735
708
|
if (!allureRuntimeMessage) {
|
|
736
|
-
|
|
709
|
+
_context6.n = 4;
|
|
737
710
|
break;
|
|
738
711
|
}
|
|
739
712
|
message = JSON.parse(attachment.body.toString());
|
|
740
713
|
if (!(message.type === "step_metadata")) {
|
|
741
|
-
|
|
714
|
+
_context6.n = 3;
|
|
742
715
|
break;
|
|
743
716
|
}
|
|
744
717
|
this.processStepMetadataMessage(attachmentStepUuid, message);
|
|
745
|
-
return
|
|
718
|
+
return _context6.a(2);
|
|
746
719
|
case 3:
|
|
747
720
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
748
|
-
return
|
|
721
|
+
return _context6.a(2);
|
|
749
722
|
case 4:
|
|
750
723
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
751
724
|
name: attachment.name
|
|
@@ -756,20 +729,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
756
729
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
757
730
|
}
|
|
758
731
|
if (!attachment.body) {
|
|
759
|
-
|
|
732
|
+
_context6.n = 5;
|
|
760
733
|
break;
|
|
761
734
|
}
|
|
762
735
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
763
736
|
contentType: attachment.contentType
|
|
764
737
|
});
|
|
765
|
-
|
|
738
|
+
_context6.n = 7;
|
|
766
739
|
break;
|
|
767
740
|
case 5:
|
|
768
741
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
769
|
-
|
|
742
|
+
_context6.n = 6;
|
|
770
743
|
break;
|
|
771
744
|
}
|
|
772
|
-
return
|
|
745
|
+
return _context6.a(2);
|
|
773
746
|
case 6:
|
|
774
747
|
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
|
|
775
748
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
@@ -777,30 +750,91 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
777
750
|
});
|
|
778
751
|
case 7:
|
|
779
752
|
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
780
|
-
|
|
753
|
+
_context6.n = 8;
|
|
781
754
|
break;
|
|
782
755
|
}
|
|
783
|
-
return
|
|
756
|
+
return _context6.a(2);
|
|
784
757
|
case 8:
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
758
|
+
pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
759
|
+
pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
760
|
+
if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
|
|
761
|
+
_context6.n = 9;
|
|
788
762
|
break;
|
|
789
763
|
}
|
|
790
|
-
return
|
|
764
|
+
return _context6.a(2);
|
|
791
765
|
case 9:
|
|
792
|
-
|
|
793
|
-
|
|
766
|
+
fileExists = /*#__PURE__*/function () {
|
|
767
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(filePath) {
|
|
768
|
+
return _regenerator().w(function (_context4) {
|
|
769
|
+
while (1) switch (_context4.n) {
|
|
770
|
+
case 0:
|
|
771
|
+
_context4.n = 1;
|
|
772
|
+
return (0, _promises.access)(filePath).then(function () {
|
|
773
|
+
return true;
|
|
774
|
+
})["catch"](function () {
|
|
775
|
+
return false;
|
|
776
|
+
});
|
|
777
|
+
case 1:
|
|
778
|
+
return _context4.a(2, _context4.v);
|
|
779
|
+
}
|
|
780
|
+
}, _callee4);
|
|
781
|
+
}));
|
|
782
|
+
return function fileExists(_x6) {
|
|
783
|
+
return _ref5.apply(this, arguments);
|
|
784
|
+
};
|
|
785
|
+
}();
|
|
786
|
+
readImageFromDirs = /*#__PURE__*/function () {
|
|
787
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(modifier) {
|
|
788
|
+
var defaultPath, snapshotPath;
|
|
789
|
+
return _regenerator().w(function (_context5) {
|
|
790
|
+
while (1) switch (_context5.n) {
|
|
791
|
+
case 0:
|
|
792
|
+
defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
|
|
793
|
+
snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
|
|
794
|
+
_context5.n = 1;
|
|
795
|
+
return fileExists(defaultPath);
|
|
796
|
+
case 1:
|
|
797
|
+
if (!_context5.v) {
|
|
798
|
+
_context5.n = 3;
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
_context5.n = 2;
|
|
802
|
+
return (0, _reporter.readImageAsBase64)(defaultPath);
|
|
803
|
+
case 2:
|
|
804
|
+
return _context5.a(2, _context5.v);
|
|
805
|
+
case 3:
|
|
806
|
+
_context5.n = 4;
|
|
807
|
+
return fileExists(snapshotPath);
|
|
808
|
+
case 4:
|
|
809
|
+
if (!_context5.v) {
|
|
810
|
+
_context5.n = 6;
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
_context5.n = 5;
|
|
814
|
+
return (0, _reporter.readImageAsBase64)(snapshotPath);
|
|
815
|
+
case 5:
|
|
816
|
+
return _context5.a(2, _context5.v);
|
|
817
|
+
case 6:
|
|
818
|
+
return _context5.a(2, undefined);
|
|
819
|
+
}
|
|
820
|
+
}, _callee5);
|
|
821
|
+
}));
|
|
822
|
+
return function readImageFromDirs(_x7) {
|
|
823
|
+
return _ref6.apply(this, arguments);
|
|
824
|
+
};
|
|
825
|
+
}();
|
|
826
|
+
_context6.n = 10;
|
|
827
|
+
return readImageFromDirs("actual");
|
|
794
828
|
case 10:
|
|
795
|
-
actualBase64 =
|
|
796
|
-
|
|
797
|
-
return (
|
|
829
|
+
actualBase64 = _context6.v;
|
|
830
|
+
_context6.n = 11;
|
|
831
|
+
return readImageFromDirs("expected");
|
|
798
832
|
case 11:
|
|
799
|
-
expectedBase64 =
|
|
800
|
-
|
|
801
|
-
return (
|
|
833
|
+
expectedBase64 = _context6.v;
|
|
834
|
+
_context6.n = 12;
|
|
835
|
+
return readImageFromDirs("diff");
|
|
802
836
|
case 12:
|
|
803
|
-
diffBase64 =
|
|
837
|
+
diffBase64 = _context6.v;
|
|
804
838
|
diffName = attachment.name.replace(_utils.diffEndRegexp, "");
|
|
805
839
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
806
840
|
expected: expectedBase64,
|
|
@@ -813,9 +847,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
813
847
|
});
|
|
814
848
|
this.processedDiffs.push(pathWithoutEnd);
|
|
815
849
|
case 13:
|
|
816
|
-
return
|
|
850
|
+
return _context6.a(2);
|
|
817
851
|
}
|
|
818
|
-
},
|
|
852
|
+
}, _callee6, this);
|
|
819
853
|
}));
|
|
820
854
|
function processAttachment(_x3, _x4, _x5) {
|
|
821
855
|
return _processAttachment.apply(this, arguments);
|
|
@@ -833,7 +867,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
833
867
|
* @deprecated for removal, import functions directly from "allure-js-commons".
|
|
834
868
|
*/
|
|
835
869
|
function _shouldIgnoreStep(step) {
|
|
836
|
-
if (!this.options.detail && step
|
|
870
|
+
if (!this.options.detail && !["test.step", "attach", "test.attach"].includes(step.category)) {
|
|
837
871
|
return true;
|
|
838
872
|
}
|
|
839
873
|
|