allure-playwright 3.4.2 → 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 +93 -136
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +93 -136
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +6 -6
package/dist/cjs/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
68
68
|
_defineProperty(this, "processedDiffs", []);
|
|
69
69
|
_defineProperty(this, "startedTestCasesTitlesCache", []);
|
|
70
70
|
_defineProperty(this, "allureResultsUuids", new Map());
|
|
71
|
-
_defineProperty(this, "
|
|
71
|
+
_defineProperty(this, "attachmentTargets", new Map());
|
|
72
72
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
73
73
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
74
74
|
_defineProperty(this, "beforeHooksAttachmentsStack", new Map());
|
|
@@ -272,7 +272,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
272
272
|
}, {
|
|
273
273
|
key: "onStepBegin",
|
|
274
274
|
value: function onStepBegin(test, _result, step) {
|
|
275
|
-
var _this$pwStepUuid$
|
|
275
|
+
var _this$pwStepUuid$get2;
|
|
276
276
|
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
277
277
|
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
278
278
|
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
@@ -280,12 +280,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
280
280
|
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
281
281
|
var isHookStep = isBeforeHookDescendant || isAfterHookDescendant;
|
|
282
282
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
283
|
-
if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
|
|
284
|
-
var _this$allureRuntime, _this$attachmentSteps;
|
|
285
|
-
var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
|
|
286
|
-
this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
283
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
290
284
|
return;
|
|
291
285
|
}
|
|
@@ -295,20 +289,38 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
295
289
|
stage: _allureJsCommons.Stage.RUNNING,
|
|
296
290
|
uuid: (0, _reporter.randomUuid)()
|
|
297
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
|
+
}
|
|
298
302
|
if (isHookStep) {
|
|
299
303
|
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
300
304
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
305
|
+
var _this$attachmentTarge2;
|
|
306
|
+
var hookStepWithUuid;
|
|
301
307
|
stack.startStep(baseStep);
|
|
302
308
|
var attachStack = isBeforeHookDescendant ? this.beforeHooksAttachmentsStack : this.afterHooksAttachmentsStack;
|
|
303
309
|
stack.updateStep(function (stepResult) {
|
|
304
310
|
var _attachStack$get;
|
|
311
|
+
hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
|
|
312
|
+
uuid: stepResult.uuid
|
|
313
|
+
});
|
|
305
314
|
stepResult.name = (0, _utils.normalizeHookTitle)(stepResult.name);
|
|
306
315
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
307
|
-
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [
|
|
308
|
-
uuid: stepResult.uuid
|
|
309
|
-
})]));
|
|
316
|
+
attachStack.set(test.id, [].concat(_toConsumableArray((_attachStack$get = attachStack.get(test.id)) !== null && _attachStack$get !== void 0 ? _attachStack$get : []), [hookStepWithUuid]));
|
|
310
317
|
});
|
|
311
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);
|
|
312
324
|
return;
|
|
313
325
|
}
|
|
314
326
|
stack.startStep(baseStep);
|
|
@@ -324,7 +336,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
324
336
|
}
|
|
325
337
|
return;
|
|
326
338
|
}
|
|
327
|
-
var parentUuid = step.parent ? (_this$pwStepUuid$
|
|
339
|
+
var parentUuid = step.parent ? (_this$pwStepUuid$get2 = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get2 !== void 0 ? _this$pwStepUuid$get2 : null : null;
|
|
328
340
|
var createdUuid = this.allureRuntime.startStep(testUuid, parentUuid, baseStep);
|
|
329
341
|
if (createdUuid) {
|
|
330
342
|
this.pwStepUuid.set(step, createdUuid);
|
|
@@ -394,9 +406,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
394
406
|
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(test, result) {
|
|
395
407
|
var _this = this,
|
|
396
408
|
_this$beforeHooksAtta,
|
|
397
|
-
_this$
|
|
398
|
-
|
|
399
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentsInBeforeHooks, attachmentsInAfterHooks, attachmentSteps, attachmentToStepMap, attachmentIndex, _iterator2, _step2, _hookStep, _iterator3, _step3, stepUuid, _iterator4, _step4, _hookStep2, i, attachment, stepInfo, _i, _attachment, _stepInfo, hookStep, isBeforeHook, targetStack, stepResult, fileName;
|
|
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;
|
|
400
411
|
return _regenerator().w(function (_context) {
|
|
401
412
|
while (1) switch (_context.n) {
|
|
402
413
|
case 0:
|
|
@@ -444,89 +455,6 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
444
455
|
testResult.status = (0, _utils.statusToAllureStats)(result.status, test.expectedStatus);
|
|
445
456
|
testResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
446
457
|
});
|
|
447
|
-
attachmentsInBeforeHooks = (_this$beforeHooksAtta = this.beforeHooksAttachmentsStack.get(test.id)) !== null && _this$beforeHooksAtta !== void 0 ? _this$beforeHooksAtta : [];
|
|
448
|
-
attachmentsInAfterHooks = (_this$afterHooksAttac = this.afterHooksAttachmentsStack.get(test.id)) !== null && _this$afterHooksAttac !== void 0 ? _this$afterHooksAttac : [];
|
|
449
|
-
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
450
|
-
attachmentToStepMap = new Map();
|
|
451
|
-
attachmentIndex = 0;
|
|
452
|
-
_iterator2 = _createForOfIteratorHelper(attachmentsInBeforeHooks);
|
|
453
|
-
try {
|
|
454
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
455
|
-
_hookStep = _step2.value;
|
|
456
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
457
|
-
stepUuid: _hookStep.uuid,
|
|
458
|
-
isHook: true,
|
|
459
|
-
hookStep: _hookStep
|
|
460
|
-
});
|
|
461
|
-
attachmentIndex++;
|
|
462
|
-
}
|
|
463
|
-
} catch (err) {
|
|
464
|
-
_iterator2.e(err);
|
|
465
|
-
} finally {
|
|
466
|
-
_iterator2.f();
|
|
467
|
-
}
|
|
468
|
-
_iterator3 = _createForOfIteratorHelper(attachmentSteps);
|
|
469
|
-
try {
|
|
470
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
471
|
-
stepUuid = _step3.value;
|
|
472
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
473
|
-
stepUuid: stepUuid,
|
|
474
|
-
isHook: false
|
|
475
|
-
});
|
|
476
|
-
attachmentIndex++;
|
|
477
|
-
}
|
|
478
|
-
} catch (err) {
|
|
479
|
-
_iterator3.e(err);
|
|
480
|
-
} finally {
|
|
481
|
-
_iterator3.f();
|
|
482
|
-
}
|
|
483
|
-
_iterator4 = _createForOfIteratorHelper(attachmentsInAfterHooks);
|
|
484
|
-
try {
|
|
485
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
486
|
-
_hookStep2 = _step4.value;
|
|
487
|
-
attachmentToStepMap.set(attachmentIndex, {
|
|
488
|
-
stepUuid: _hookStep2.uuid,
|
|
489
|
-
isHook: true,
|
|
490
|
-
hookStep: _hookStep2
|
|
491
|
-
});
|
|
492
|
-
attachmentIndex++;
|
|
493
|
-
}
|
|
494
|
-
} catch (err) {
|
|
495
|
-
_iterator4.e(err);
|
|
496
|
-
} finally {
|
|
497
|
-
_iterator4.f();
|
|
498
|
-
}
|
|
499
|
-
i = 0;
|
|
500
|
-
case 1:
|
|
501
|
-
if (!(i < result.attachments.length)) {
|
|
502
|
-
_context.n = 6;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
attachment = result.attachments[i];
|
|
506
|
-
stepInfo = attachmentToStepMap.get(i);
|
|
507
|
-
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.isHook)) {
|
|
508
|
-
_context.n = 2;
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
return _context.a(3, 5);
|
|
512
|
-
case 2:
|
|
513
|
-
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
514
|
-
_context.n = 4;
|
|
515
|
-
break;
|
|
516
|
-
}
|
|
517
|
-
_context.n = 3;
|
|
518
|
-
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
519
|
-
case 3:
|
|
520
|
-
_context.n = 5;
|
|
521
|
-
break;
|
|
522
|
-
case 4:
|
|
523
|
-
_context.n = 5;
|
|
524
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
525
|
-
case 5:
|
|
526
|
-
i++;
|
|
527
|
-
_context.n = 1;
|
|
528
|
-
break;
|
|
529
|
-
case 6:
|
|
530
458
|
if (result.stdout.length > 0) {
|
|
531
459
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
|
|
532
460
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
@@ -537,49 +465,78 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
537
465
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
538
466
|
});
|
|
539
467
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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;
|
|
547
477
|
break;
|
|
548
478
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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;
|
|
553
484
|
break;
|
|
554
485
|
}
|
|
555
|
-
hookStep = _stepInfo.hookStep;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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;
|
|
560
494
|
break;
|
|
561
495
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
return _context.a(3, 10);
|
|
566
|
-
case 9:
|
|
496
|
+
hookStep = stepInfo.hookStep;
|
|
497
|
+
isBeforeHook = attachmentsInBeforeHooks.includes(hookStep);
|
|
498
|
+
targetStack = isBeforeHook ? beforeHooksStack : afterHooksStack;
|
|
567
499
|
if (targetStack) {
|
|
568
500
|
stepResult = targetStack.findStepByUuid(hookStep.uuid);
|
|
569
501
|
if (stepResult) {
|
|
570
|
-
fileName = targetStack.addAttachment(
|
|
502
|
+
fileName = targetStack.addAttachment(attachment, this.allureRuntime.writer);
|
|
571
503
|
stepResult.attachments.push({
|
|
572
|
-
name:
|
|
573
|
-
type:
|
|
504
|
+
name: attachment.name,
|
|
505
|
+
type: attachment.contentType,
|
|
574
506
|
source: fileName
|
|
575
507
|
});
|
|
576
508
|
}
|
|
577
509
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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;
|
|
525
|
+
break;
|
|
526
|
+
case 9:
|
|
527
|
+
_context.n = 11;
|
|
581
528
|
break;
|
|
529
|
+
case 10:
|
|
530
|
+
_context.p = 10;
|
|
531
|
+
_t = _context.v;
|
|
532
|
+
_iterator2.e(_t);
|
|
582
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
|
|
583
540
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
584
541
|
var mappedLabels = testResult.labels.reduce(function (acc, label) {
|
|
585
542
|
if (!acc[label.name]) {
|
|
@@ -611,10 +568,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
611
568
|
duration: result.duration
|
|
612
569
|
});
|
|
613
570
|
this.allureRuntime.writeTest(testUuid);
|
|
614
|
-
case
|
|
571
|
+
case 13:
|
|
615
572
|
return _context.a(2);
|
|
616
573
|
}
|
|
617
|
-
}, _callee, this);
|
|
574
|
+
}, _callee, this, [[1, 10, 11, 12]]);
|
|
618
575
|
}));
|
|
619
576
|
function onTestEnd(_x, _x2) {
|
|
620
577
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -626,7 +583,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
626
583
|
value: function () {
|
|
627
584
|
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
628
585
|
var _this2 = this;
|
|
629
|
-
var unprocessedCases,
|
|
586
|
+
var unprocessedCases, _iterator3, _step3, testCase, _t2;
|
|
630
587
|
return _regenerator().w(function (_context2) {
|
|
631
588
|
while (1) switch (_context2.n) {
|
|
632
589
|
case 0:
|
|
@@ -635,15 +592,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
635
592
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
636
593
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
637
594
|
});
|
|
638
|
-
|
|
595
|
+
_iterator3 = _createForOfIteratorHelper(unprocessedCases);
|
|
639
596
|
_context2.p = 1;
|
|
640
|
-
|
|
597
|
+
_iterator3.s();
|
|
641
598
|
case 2:
|
|
642
|
-
if ((
|
|
599
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
643
600
|
_context2.n = 4;
|
|
644
601
|
break;
|
|
645
602
|
}
|
|
646
|
-
testCase =
|
|
603
|
+
testCase = _step3.value;
|
|
647
604
|
this.onTestBegin(testCase);
|
|
648
605
|
_context2.n = 3;
|
|
649
606
|
return this.onTestEnd(testCase, {
|
|
@@ -668,11 +625,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
668
625
|
break;
|
|
669
626
|
case 5:
|
|
670
627
|
_context2.p = 5;
|
|
671
|
-
|
|
672
|
-
|
|
628
|
+
_t2 = _context2.v;
|
|
629
|
+
_iterator3.e(_t2);
|
|
673
630
|
case 6:
|
|
674
631
|
_context2.p = 6;
|
|
675
|
-
|
|
632
|
+
_iterator3.f();
|
|
676
633
|
return _context2.f(6);
|
|
677
634
|
case 7:
|
|
678
635
|
return _context2.a(2);
|
|
@@ -910,7 +867,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
910
867
|
* @deprecated for removal, import functions directly from "allure-js-commons".
|
|
911
868
|
*/
|
|
912
869
|
function _shouldIgnoreStep(step) {
|
|
913
|
-
if (!this.options.detail && step
|
|
870
|
+
if (!this.options.detail && !["test.step", "attach", "test.attach"].includes(step.category)) {
|
|
914
871
|
return true;
|
|
915
872
|
}
|
|
916
873
|
|