allure-playwright 3.7.2 → 3.8.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/README.md +20 -0
- package/dist/cjs/index.js +439 -157
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/playwrightInternals.js +2 -0
- package/dist/cjs/playwrightInternals.js.map +1 -0
- package/dist/cjs/runtime.js +197 -3
- package/dist/cjs/runtime.js.map +1 -1
- package/dist/cjs/syncAnnotations.js +12 -0
- package/dist/cjs/syncAnnotations.js.map +1 -0
- package/dist/cjs/utils.js +14 -8
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +439 -157
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/playwrightInternals.js +2 -0
- package/dist/esm/playwrightInternals.js.map +1 -0
- package/dist/esm/runtime.js +197 -3
- package/dist/esm/runtime.js.map +1 -1
- package/dist/esm/syncAnnotations.js +6 -0
- package/dist/esm/syncAnnotations.js.map +1 -0
- package/dist/esm/utils.js +14 -8
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +14 -0
- package/dist/types/model.d.ts +3 -0
- package/dist/types/playwrightInternals.d.ts +29 -0
- package/dist/types/runtime.d.ts +6 -2
- package/dist/types/syncAnnotations.d.ts +3 -0
- package/dist/types/utils.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -28,11 +28,11 @@ var _legacy = require("./legacy.js");
|
|
|
28
28
|
var _utils = require("./utils.js");
|
|
29
29
|
var _test = require("@playwright/test");
|
|
30
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
31
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
32
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
33
31
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
34
32
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
35
33
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
34
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
35
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
36
36
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
37
37
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
38
38
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -71,6 +71,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
71
71
|
_defineProperty(this, "attachmentTargets", new Map());
|
|
72
72
|
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
73
73
|
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
74
|
+
_defineProperty(this, "pendingAttachmentTasks", new Map());
|
|
75
|
+
_defineProperty(this, "attachmentTargetByStep", new WeakMap());
|
|
74
76
|
_defineProperty(this, "pwStepUuid", new WeakMap());
|
|
75
77
|
_defineProperty(this, "testPlan", (0, _reporter.parseTestPlan)());
|
|
76
78
|
this.options = _objectSpread({
|
|
@@ -267,6 +269,259 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
267
269
|
this.allureResultsUuids.set(test.id, testUuid);
|
|
268
270
|
this.startedTestCasesTitlesCache.push(metadata.titleMetadata.cleanTitle);
|
|
269
271
|
}
|
|
272
|
+
}, {
|
|
273
|
+
key: "queueAttachmentTask",
|
|
274
|
+
value: function queueAttachmentTask(testId, task) {
|
|
275
|
+
var _this$pendingAttachme;
|
|
276
|
+
var tasks = (_this$pendingAttachme = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme !== void 0 ? _this$pendingAttachme : [];
|
|
277
|
+
tasks.push(task);
|
|
278
|
+
this.pendingAttachmentTasks.set(testId, tasks);
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
key: "flushAttachmentTasks",
|
|
282
|
+
value: function () {
|
|
283
|
+
var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(testId) {
|
|
284
|
+
var _this$pendingAttachme2;
|
|
285
|
+
var tasks;
|
|
286
|
+
return _regenerator().w(function (_context) {
|
|
287
|
+
while (1) switch (_context.n) {
|
|
288
|
+
case 0:
|
|
289
|
+
tasks = (_this$pendingAttachme2 = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme2 !== void 0 ? _this$pendingAttachme2 : [];
|
|
290
|
+
this.pendingAttachmentTasks["delete"](testId);
|
|
291
|
+
if (!(tasks.length > 0)) {
|
|
292
|
+
_context.n = 1;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
_context.n = 1;
|
|
296
|
+
return Promise.all(tasks);
|
|
297
|
+
case 1:
|
|
298
|
+
return _context.a(2);
|
|
299
|
+
}
|
|
300
|
+
}, _callee, this);
|
|
301
|
+
}));
|
|
302
|
+
function flushAttachmentTasks(_x) {
|
|
303
|
+
return _flushAttachmentTasks.apply(this, arguments);
|
|
304
|
+
}
|
|
305
|
+
return flushAttachmentTasks;
|
|
306
|
+
}()
|
|
307
|
+
}, {
|
|
308
|
+
key: "recordAttachmentTarget",
|
|
309
|
+
value: function recordAttachmentTarget(testId, target) {
|
|
310
|
+
var _this$attachmentTarge;
|
|
311
|
+
var targets = (_this$attachmentTarge = this.attachmentTargets.get(testId)) !== null && _this$attachmentTarge !== void 0 ? _this$attachmentTarge : [];
|
|
312
|
+
targets.push(target);
|
|
313
|
+
this.attachmentTargets.set(testId, targets);
|
|
314
|
+
}
|
|
315
|
+
}, {
|
|
316
|
+
key: "getHookStepsStack",
|
|
317
|
+
value: function getHookStepsStack(testId, hookStep) {
|
|
318
|
+
return hookStep.hookScope === "before" ? this.beforeHooksStepsStack.get(testId) : this.afterHooksStepsStack.get(testId);
|
|
319
|
+
}
|
|
320
|
+
}, {
|
|
321
|
+
key: "removeHookAttachmentPlaceholder",
|
|
322
|
+
value: function removeHookAttachmentPlaceholder(steps, stepUuid) {
|
|
323
|
+
var index = steps.findIndex(function (step) {
|
|
324
|
+
return step.uuid === stepUuid;
|
|
325
|
+
});
|
|
326
|
+
if (index !== -1) {
|
|
327
|
+
steps.splice(index, 1);
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
var _iterator2 = _createForOfIteratorHelper(steps),
|
|
331
|
+
_step2;
|
|
332
|
+
try {
|
|
333
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
334
|
+
var step = _step2.value;
|
|
335
|
+
if (this.removeHookAttachmentPlaceholder(step.steps, stepUuid)) {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
} catch (err) {
|
|
340
|
+
_iterator2.e(err);
|
|
341
|
+
} finally {
|
|
342
|
+
_iterator2.f();
|
|
343
|
+
}
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
}, {
|
|
347
|
+
key: "addAttachmentToHookStep",
|
|
348
|
+
value: function addAttachmentToHookStep(test, hookStep, attachment) {
|
|
349
|
+
var targetStack = this.getHookStepsStack(test.id, hookStep);
|
|
350
|
+
if (!targetStack) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
var stepResult = targetStack.findStepByUuid(hookStep.uuid);
|
|
354
|
+
if (!stepResult) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
var fileName = targetStack.addAttachment(attachment, this.allureRuntime.writer);
|
|
358
|
+
stepResult.attachments.push({
|
|
359
|
+
name: attachment.name,
|
|
360
|
+
type: attachment.contentType,
|
|
361
|
+
source: fileName
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}, {
|
|
365
|
+
key: "addRuntimeAttachmentToHookStack",
|
|
366
|
+
value: function addRuntimeAttachmentToHookStack(targetStack, attachment, options) {
|
|
367
|
+
var _this2 = this;
|
|
368
|
+
var currentStep = targetStack.currentStep();
|
|
369
|
+
if (!currentStep) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
var addAttachment = function addAttachment(stepResult) {
|
|
373
|
+
var fileName = targetStack.addAttachment(attachment, _this2.allureRuntime.writer);
|
|
374
|
+
stepResult.attachments.push({
|
|
375
|
+
name: attachment.name,
|
|
376
|
+
type: attachment.contentType,
|
|
377
|
+
source: fileName
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
if (options !== null && options !== void 0 && options.wrapInStep) {
|
|
381
|
+
targetStack.startStep({
|
|
382
|
+
name: attachment.name,
|
|
383
|
+
start: options.timestamp
|
|
384
|
+
});
|
|
385
|
+
addAttachment(targetStack.currentStep());
|
|
386
|
+
targetStack.stopStep({
|
|
387
|
+
stop: options.timestamp
|
|
388
|
+
});
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
addAttachment(currentStep);
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
key: "processHookRuntimeMessage",
|
|
395
|
+
value: function processHookRuntimeMessage(test, testUuid, hookStep, attachment) {
|
|
396
|
+
if (!attachment.body) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
var targetStack = this.getHookStepsStack(test.id, hookStep);
|
|
400
|
+
if (!targetStack) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
this.removeHookAttachmentPlaceholder(targetStack.steps, hookStep.uuid);
|
|
404
|
+
var message = JSON.parse(attachment.body.toString());
|
|
405
|
+
switch (message.type) {
|
|
406
|
+
case "step_start":
|
|
407
|
+
targetStack.startStep(_objectSpread({}, message.data));
|
|
408
|
+
return true;
|
|
409
|
+
case "step_stop":
|
|
410
|
+
{
|
|
411
|
+
var currentStep = targetStack.currentStep();
|
|
412
|
+
if (!currentStep) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
targetStack.updateStep(function (stepResult) {
|
|
416
|
+
if (message.data.status && !stepResult.status) {
|
|
417
|
+
stepResult.status = message.data.status;
|
|
418
|
+
}
|
|
419
|
+
if (message.data.statusDetails) {
|
|
420
|
+
stepResult.statusDetails = _objectSpread(_objectSpread({}, stepResult.statusDetails), message.data.statusDetails);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
targetStack.stopStep({
|
|
424
|
+
stop: message.data.stop
|
|
425
|
+
});
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
case "step_metadata":
|
|
429
|
+
{
|
|
430
|
+
var _currentStep$paramete, _message$data$paramet;
|
|
431
|
+
var _currentStep = targetStack.currentStep();
|
|
432
|
+
if (!_currentStep) {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
if (message.data.name) {
|
|
436
|
+
_currentStep.name = message.data.name;
|
|
437
|
+
}
|
|
438
|
+
(_currentStep$paramete = _currentStep.parameters).push.apply(_currentStep$paramete, _toConsumableArray((_message$data$paramet = message.data.parameters) !== null && _message$data$paramet !== void 0 ? _message$data$paramet : []));
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
case "attachment_content":
|
|
442
|
+
this.addRuntimeAttachmentToHookStack(targetStack, {
|
|
443
|
+
name: message.data.name,
|
|
444
|
+
body: Buffer.from(message.data.content, message.data.encoding),
|
|
445
|
+
contentType: message.data.contentType
|
|
446
|
+
}, {
|
|
447
|
+
wrapInStep: message.data.wrapInStep,
|
|
448
|
+
timestamp: message.data.timestamp
|
|
449
|
+
});
|
|
450
|
+
return true;
|
|
451
|
+
case "attachment_path":
|
|
452
|
+
this.addRuntimeAttachmentToHookStack(targetStack, {
|
|
453
|
+
name: message.data.name,
|
|
454
|
+
path: message.data.path,
|
|
455
|
+
contentType: message.data.contentType
|
|
456
|
+
}, {
|
|
457
|
+
wrapInStep: message.data.wrapInStep,
|
|
458
|
+
timestamp: message.data.timestamp
|
|
459
|
+
});
|
|
460
|
+
return true;
|
|
461
|
+
default:
|
|
462
|
+
this.queueAttachmentTask(test.id, this.processAttachment(testUuid, undefined, attachment));
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}, {
|
|
467
|
+
key: "shouldProcessAttachmentAtTestEnd",
|
|
468
|
+
value: function shouldProcessAttachmentAtTestEnd(attachment) {
|
|
469
|
+
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
if (attachment.contentType === "application/vnd.allure.playwright-trace") {
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
return attachment.name === "trace" && attachment.contentType === "application/zip";
|
|
476
|
+
}
|
|
477
|
+
}, {
|
|
478
|
+
key: "processStepEndAttachments",
|
|
479
|
+
value: function processStepEndAttachments(test, step) {
|
|
480
|
+
var _step$attachments;
|
|
481
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
482
|
+
var stepAttachments = (_step$attachments = step.attachments) !== null && _step$attachments !== void 0 ? _step$attachments : [];
|
|
483
|
+
var stepInfo = this.attachmentTargetByStep.get(step);
|
|
484
|
+
var hasExplicitParent = Boolean((stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.hookStep) || (stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid));
|
|
485
|
+
if (stepAttachments.length === 0) {
|
|
486
|
+
if (stepInfo) {
|
|
487
|
+
this.recordAttachmentTarget(test.id, stepInfo);
|
|
488
|
+
}
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
var _iterator3 = _createForOfIteratorHelper(stepAttachments),
|
|
492
|
+
_step3;
|
|
493
|
+
try {
|
|
494
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
495
|
+
var _stepInfo$hookStep$uu, _stepInfo$hookStep;
|
|
496
|
+
var attachment = _step3.value;
|
|
497
|
+
var isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
498
|
+
var attachmentTarget = _objectSpread(_objectSpread({}, stepInfo), {}, {
|
|
499
|
+
name: attachment.name
|
|
500
|
+
});
|
|
501
|
+
this.recordAttachmentTarget(test.id, attachmentTarget);
|
|
502
|
+
if (this.shouldProcessAttachmentAtTestEnd(attachment) || !isRuntimeMessage && !hasExplicitParent) {
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
attachmentTarget.processedAtStepEnd = true;
|
|
506
|
+
if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep && isRuntimeMessage) {
|
|
507
|
+
if (!this.processHookRuntimeMessage(test, testUuid, stepInfo.hookStep, attachment)) {
|
|
508
|
+
attachmentTarget.processedAtStepEnd = false;
|
|
509
|
+
}
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
|
|
513
|
+
this.addAttachmentToHookStep(test, stepInfo.hookStep, attachment);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
var attachmentStepUuid = (_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;
|
|
517
|
+
this.queueAttachmentTask(test.id, this.processAttachment(testUuid, attachmentStepUuid, attachment));
|
|
518
|
+
}
|
|
519
|
+
} catch (err) {
|
|
520
|
+
_iterator3.e(err);
|
|
521
|
+
} finally {
|
|
522
|
+
_iterator3.f();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
270
525
|
}, {
|
|
271
526
|
key: "onStepBegin",
|
|
272
527
|
value: function onStepBegin(test, _result, step) {
|
|
@@ -288,19 +543,17 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
288
543
|
uuid: (0, _reporter.randomUuid)()
|
|
289
544
|
});
|
|
290
545
|
if (["test.attach", "attach"].includes(step.category) && !isHookStep) {
|
|
291
|
-
var _this$pwStepUuid$get
|
|
546
|
+
var _this$pwStepUuid$get;
|
|
292
547
|
var parent = step.parent ? (_this$pwStepUuid$get = this.pwStepUuid.get(step.parent)) !== null && _this$pwStepUuid$get !== void 0 ? _this$pwStepUuid$get : null : null;
|
|
293
|
-
|
|
294
|
-
targets.push({
|
|
548
|
+
this.attachmentTargetByStep.set(step, {
|
|
295
549
|
name: (0, _utils.normalizeAttachStepTitle)(step.title),
|
|
296
550
|
stepUuid: parent !== null && parent !== void 0 ? parent : undefined
|
|
297
551
|
});
|
|
298
|
-
this.attachmentTargets.set(test.id, targets);
|
|
299
552
|
return;
|
|
300
553
|
}
|
|
301
554
|
if (isHookStep) {
|
|
302
555
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
303
|
-
var _stack$currentStep
|
|
556
|
+
var _stack$currentStep;
|
|
304
557
|
var attachmentName = (0, _utils.normalizeAttachStepTitle)(step.title);
|
|
305
558
|
var _stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
306
559
|
var hookStepWithUuid;
|
|
@@ -308,19 +561,18 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
308
561
|
_stack.startStep(baseStep);
|
|
309
562
|
_stack.updateStep(function (stepResult) {
|
|
310
563
|
hookStepWithUuid = _objectSpread(_objectSpread({}, step), {}, {
|
|
311
|
-
uuid: stepResult.uuid
|
|
564
|
+
uuid: stepResult.uuid,
|
|
565
|
+
hookScope: isBeforeHookDescendant ? "before" : "after"
|
|
312
566
|
});
|
|
313
567
|
stepResult.name = (0, _utils.normalizeHookTitle)(stepResult.name);
|
|
314
568
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
315
569
|
});
|
|
316
570
|
_stack.stopStep();
|
|
317
|
-
|
|
318
|
-
_targets.push({
|
|
571
|
+
this.attachmentTargetByStep.set(step, {
|
|
319
572
|
name: attachmentName,
|
|
320
573
|
hookStep: hookStepWithUuid,
|
|
321
574
|
stepUuid: attachmentName === "Allure Step Metadata" ? parentHookStepUuid : undefined
|
|
322
575
|
});
|
|
323
|
-
this.attachmentTargets.set(test.id, _targets);
|
|
324
576
|
return;
|
|
325
577
|
}
|
|
326
578
|
var stack = _assertClassBrand(_AllureReporter_brand, this, _getOrCreateHookStack).call(this, test.id, isBeforeHookDescendant, step.startTime);
|
|
@@ -368,8 +620,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
368
620
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
369
621
|
return;
|
|
370
622
|
}
|
|
371
|
-
// ignore test.attach steps since attachments are already in the report
|
|
372
623
|
if (["test.attach", "attach"].includes(step.category)) {
|
|
624
|
+
this.processStepEndAttachments(test, step);
|
|
373
625
|
return;
|
|
374
626
|
}
|
|
375
627
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
@@ -410,12 +662,12 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
410
662
|
}, {
|
|
411
663
|
key: "onTestEnd",
|
|
412
664
|
value: function () {
|
|
413
|
-
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
414
|
-
var
|
|
415
|
-
_this$
|
|
416
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName,
|
|
417
|
-
return _regenerator().w(function (
|
|
418
|
-
while (1) switch (
|
|
665
|
+
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(test, result) {
|
|
666
|
+
var _this3 = this,
|
|
667
|
+
_this$attachmentTarge2;
|
|
668
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator4, _step4, _targetsByName$get, t, q, takeByName, _iterator5, _step5, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu2, _stepInfo$hookStep2, message, targetStack, _targetStack, stepUuid, _targetStack2, stepResult, fileName, _t;
|
|
669
|
+
return _regenerator().w(function (_context2) {
|
|
670
|
+
while (1) switch (_context2.n) {
|
|
419
671
|
case 0:
|
|
420
672
|
testUuid = this.allureResultsUuids.get(test.id); // We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
421
673
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
@@ -433,7 +685,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
433
685
|
value: projectSuiteTitle
|
|
434
686
|
});
|
|
435
687
|
}
|
|
436
|
-
if (
|
|
688
|
+
if (_this3.options.suiteTitle && fileSuiteTitle && !(0, _sdk.hasLabel)(testResult, _allureJsCommons.LabelName.SUITE)) {
|
|
437
689
|
testResult.labels.push({
|
|
438
690
|
name: _allureJsCommons.LabelName.SUITE,
|
|
439
691
|
value: fileSuiteTitle
|
|
@@ -473,20 +725,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
473
725
|
}
|
|
474
726
|
|
|
475
727
|
// FIFO
|
|
476
|
-
targets = (_this$
|
|
728
|
+
targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
|
|
477
729
|
targetsByName = new Map();
|
|
478
|
-
|
|
730
|
+
_iterator4 = _createForOfIteratorHelper(targets);
|
|
479
731
|
try {
|
|
480
|
-
for (
|
|
481
|
-
t =
|
|
732
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
733
|
+
t = _step4.value;
|
|
482
734
|
q = (_targetsByName$get = targetsByName.get(t.name)) !== null && _targetsByName$get !== void 0 ? _targetsByName$get : [];
|
|
483
735
|
q.push(t);
|
|
484
736
|
targetsByName.set(t.name, q);
|
|
485
737
|
}
|
|
486
738
|
} catch (err) {
|
|
487
|
-
|
|
739
|
+
_iterator4.e(err);
|
|
488
740
|
} finally {
|
|
489
|
-
|
|
741
|
+
_iterator4.f();
|
|
490
742
|
}
|
|
491
743
|
takeByName = function takeByName(name) {
|
|
492
744
|
var target = targetsByName.get(name);
|
|
@@ -495,52 +747,57 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
495
747
|
}
|
|
496
748
|
return target.shift();
|
|
497
749
|
};
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
750
|
+
_iterator5 = _createForOfIteratorHelper(result.attachments);
|
|
751
|
+
_context2.p = 1;
|
|
752
|
+
_iterator5.s();
|
|
501
753
|
case 2:
|
|
502
|
-
if ((
|
|
503
|
-
|
|
754
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
755
|
+
_context2.n = 11;
|
|
504
756
|
break;
|
|
505
757
|
}
|
|
506
|
-
attachment =
|
|
758
|
+
attachment = _step5.value;
|
|
507
759
|
isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
508
760
|
stepInfo = takeByName(attachment.name);
|
|
761
|
+
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
|
|
762
|
+
_context2.n = 3;
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
return _context2.a(3, 10);
|
|
766
|
+
case 3:
|
|
509
767
|
if (!isRuntimeMessage) {
|
|
510
|
-
|
|
768
|
+
_context2.n = 6;
|
|
511
769
|
break;
|
|
512
770
|
}
|
|
513
771
|
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
514
772
|
if (stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep) {
|
|
515
|
-
targetStack = (
|
|
773
|
+
targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
516
774
|
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
517
775
|
}
|
|
518
776
|
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
519
|
-
|
|
777
|
+
_context2.n = 4;
|
|
520
778
|
break;
|
|
521
779
|
}
|
|
522
780
|
if (stepInfo.hookStep) {
|
|
523
|
-
_targetStack = (
|
|
781
|
+
_targetStack = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
524
782
|
this.processHookStepMetadataMessage(_targetStack, stepInfo.stepUuid, message);
|
|
525
783
|
} else {
|
|
526
784
|
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
527
785
|
}
|
|
528
|
-
return
|
|
529
|
-
case 3:
|
|
530
|
-
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;
|
|
531
|
-
_context.n = 4;
|
|
532
|
-
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
786
|
+
return _context2.a(3, 10);
|
|
533
787
|
case 4:
|
|
534
|
-
|
|
788
|
+
stepUuid = (_stepInfo$hookStep$uu2 = stepInfo === null || stepInfo === void 0 || (_stepInfo$hookStep2 = stepInfo.hookStep) === null || _stepInfo$hookStep2 === void 0 ? void 0 : _stepInfo$hookStep2.uuid) !== null && _stepInfo$hookStep$uu2 !== void 0 ? _stepInfo$hookStep$uu2 : stepInfo === null || stepInfo === void 0 ? void 0 : stepInfo.stepUuid;
|
|
789
|
+
_context2.n = 5;
|
|
790
|
+
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
535
791
|
case 5:
|
|
792
|
+
return _context2.a(3, 10);
|
|
793
|
+
case 6:
|
|
536
794
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
537
|
-
|
|
795
|
+
_context2.n = 7;
|
|
538
796
|
break;
|
|
539
797
|
}
|
|
540
|
-
|
|
541
|
-
_targetStack2 = (0, _utils.isBeforeHookStep)(hookStep) ? beforeHooksStack : afterHooksStack;
|
|
798
|
+
_targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
542
799
|
if (_targetStack2) {
|
|
543
|
-
stepResult = _targetStack2.findStepByUuid(hookStep.uuid);
|
|
800
|
+
stepResult = _targetStack2.findStepByUuid(stepInfo.hookStep.uuid);
|
|
544
801
|
if (stepResult) {
|
|
545
802
|
fileName = _targetStack2.addAttachment(attachment, this.allureRuntime.writer);
|
|
546
803
|
stepResult.attachments.push({
|
|
@@ -550,34 +807,37 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
550
807
|
});
|
|
551
808
|
}
|
|
552
809
|
}
|
|
553
|
-
return
|
|
554
|
-
case
|
|
810
|
+
return _context2.a(3, 10);
|
|
811
|
+
case 7:
|
|
555
812
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
556
|
-
|
|
813
|
+
_context2.n = 9;
|
|
557
814
|
break;
|
|
558
815
|
}
|
|
559
|
-
|
|
816
|
+
_context2.n = 8;
|
|
560
817
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
561
|
-
case 7:
|
|
562
|
-
return _context.a(3, 9);
|
|
563
818
|
case 8:
|
|
564
|
-
|
|
565
|
-
return this.processAttachment(testUuid, undefined, attachment);
|
|
819
|
+
return _context2.a(3, 10);
|
|
566
820
|
case 9:
|
|
567
|
-
|
|
568
|
-
|
|
821
|
+
_context2.n = 10;
|
|
822
|
+
return this.processAttachment(testUuid, undefined, attachment);
|
|
569
823
|
case 10:
|
|
570
|
-
|
|
824
|
+
_context2.n = 2;
|
|
571
825
|
break;
|
|
572
826
|
case 11:
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
_iterator3.e(_t);
|
|
827
|
+
_context2.n = 13;
|
|
828
|
+
break;
|
|
576
829
|
case 12:
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
830
|
+
_context2.p = 12;
|
|
831
|
+
_t = _context2.v;
|
|
832
|
+
_iterator5.e(_t);
|
|
580
833
|
case 13:
|
|
834
|
+
_context2.p = 13;
|
|
835
|
+
_iterator5.f();
|
|
836
|
+
return _context2.f(13);
|
|
837
|
+
case 14:
|
|
838
|
+
_context2.n = 15;
|
|
839
|
+
return this.flushAttachmentTasks(test.id);
|
|
840
|
+
case 15:
|
|
581
841
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
582
842
|
// in next iterations we need to implement the logic for every javascript integration
|
|
583
843
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
@@ -597,14 +857,14 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
597
857
|
});
|
|
598
858
|
if (beforeHooksStack) {
|
|
599
859
|
var _testResult$steps;
|
|
600
|
-
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
|
|
860
|
+
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this3.pruneEmptyHookRoots(beforeHooksStack.steps)));
|
|
601
861
|
}
|
|
602
|
-
|
|
862
|
+
_this3.beforeHooksStepsStack["delete"](test.id);
|
|
603
863
|
if (afterHooksStack) {
|
|
604
864
|
var _testResult$steps2;
|
|
605
|
-
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
|
|
865
|
+
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this3.pruneEmptyHookRoots(afterHooksStack.steps)));
|
|
606
866
|
}
|
|
607
|
-
|
|
867
|
+
_this3.afterHooksStepsStack["delete"](test.id);
|
|
608
868
|
testResult.labels = newLabels;
|
|
609
869
|
});
|
|
610
870
|
this.allureRuntime.stopTest(testUuid, {
|
|
@@ -612,12 +872,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
612
872
|
});
|
|
613
873
|
this.allureRuntime.writeTest(testUuid);
|
|
614
874
|
this.attachmentTargets["delete"](test.id);
|
|
615
|
-
|
|
616
|
-
|
|
875
|
+
this.pendingAttachmentTasks["delete"](test.id);
|
|
876
|
+
case 16:
|
|
877
|
+
return _context2.a(2);
|
|
617
878
|
}
|
|
618
|
-
},
|
|
879
|
+
}, _callee2, this, [[1, 12, 13, 14]]);
|
|
619
880
|
}));
|
|
620
|
-
function onTestEnd(
|
|
881
|
+
function onTestEnd(_x2, _x3) {
|
|
621
882
|
return _onTestEnd.apply(this, arguments);
|
|
622
883
|
}
|
|
623
884
|
return onTestEnd;
|
|
@@ -625,28 +886,28 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
625
886
|
}, {
|
|
626
887
|
key: "addSkippedResults",
|
|
627
888
|
value: function () {
|
|
628
|
-
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
629
|
-
var
|
|
630
|
-
var unprocessedCases,
|
|
631
|
-
return _regenerator().w(function (
|
|
632
|
-
while (1) switch (
|
|
889
|
+
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
890
|
+
var _this4 = this;
|
|
891
|
+
var unprocessedCases, _iterator6, _step6, testCase, _t2;
|
|
892
|
+
return _regenerator().w(function (_context3) {
|
|
893
|
+
while (1) switch (_context3.n) {
|
|
633
894
|
case 0:
|
|
634
895
|
unprocessedCases = this.suite.allTests().filter(function (_ref2) {
|
|
635
896
|
var title = _ref2.title;
|
|
636
897
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
637
|
-
return !
|
|
898
|
+
return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
638
899
|
});
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
900
|
+
_iterator6 = _createForOfIteratorHelper(unprocessedCases);
|
|
901
|
+
_context3.p = 1;
|
|
902
|
+
_iterator6.s();
|
|
642
903
|
case 2:
|
|
643
|
-
if ((
|
|
644
|
-
|
|
904
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
905
|
+
_context3.n = 4;
|
|
645
906
|
break;
|
|
646
907
|
}
|
|
647
|
-
testCase =
|
|
908
|
+
testCase = _step6.value;
|
|
648
909
|
this.onTestBegin(testCase);
|
|
649
|
-
|
|
910
|
+
_context3.n = 3;
|
|
650
911
|
return this.onTestEnd(testCase, {
|
|
651
912
|
status: _allureJsCommons.Status.SKIPPED,
|
|
652
913
|
attachments: [],
|
|
@@ -662,23 +923,23 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
662
923
|
annotations: []
|
|
663
924
|
});
|
|
664
925
|
case 3:
|
|
665
|
-
|
|
926
|
+
_context3.n = 2;
|
|
666
927
|
break;
|
|
667
928
|
case 4:
|
|
668
|
-
|
|
929
|
+
_context3.n = 6;
|
|
669
930
|
break;
|
|
670
931
|
case 5:
|
|
671
|
-
|
|
672
|
-
_t2 =
|
|
673
|
-
|
|
932
|
+
_context3.p = 5;
|
|
933
|
+
_t2 = _context3.v;
|
|
934
|
+
_iterator6.e(_t2);
|
|
674
935
|
case 6:
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return
|
|
936
|
+
_context3.p = 6;
|
|
937
|
+
_iterator6.f();
|
|
938
|
+
return _context3.f(6);
|
|
678
939
|
case 7:
|
|
679
|
-
return
|
|
940
|
+
return _context3.a(2);
|
|
680
941
|
}
|
|
681
|
-
},
|
|
942
|
+
}, _callee3, this, [[1, 5, 6, 7]]);
|
|
682
943
|
}));
|
|
683
944
|
function addSkippedResults() {
|
|
684
945
|
return _addSkippedResults.apply(this, arguments);
|
|
@@ -688,19 +949,19 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
688
949
|
}, {
|
|
689
950
|
key: "onEnd",
|
|
690
951
|
value: function () {
|
|
691
|
-
var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
692
|
-
return _regenerator().w(function (
|
|
693
|
-
while (1) switch (
|
|
952
|
+
var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
953
|
+
return _regenerator().w(function (_context4) {
|
|
954
|
+
while (1) switch (_context4.n) {
|
|
694
955
|
case 0:
|
|
695
|
-
|
|
956
|
+
_context4.n = 1;
|
|
696
957
|
return this.addSkippedResults();
|
|
697
958
|
case 1:
|
|
698
959
|
this.allureRuntime.writeEnvironmentInfo();
|
|
699
960
|
this.allureRuntime.writeCategoriesDefinitions();
|
|
700
961
|
case 2:
|
|
701
|
-
return
|
|
962
|
+
return _context4.a(2);
|
|
702
963
|
}
|
|
703
|
-
},
|
|
964
|
+
}, _callee4, this);
|
|
704
965
|
}));
|
|
705
966
|
function onEnd() {
|
|
706
967
|
return _onEnd.apply(this, arguments);
|
|
@@ -712,9 +973,30 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
712
973
|
value: function printsToStdio() {
|
|
713
974
|
return false;
|
|
714
975
|
}
|
|
976
|
+
}, {
|
|
977
|
+
key: "isEmptyPassedHookRoot",
|
|
978
|
+
value: function isEmptyPassedHookRoot(step) {
|
|
979
|
+
if (this.options.detail) {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
return (step.name === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE || step.name === _utils.AFTER_HOOKS_ROOT_STEP_TITLE) && step.steps.length === 0 && step.attachments.length === 0 && step.status === _allureJsCommons.Status.PASSED;
|
|
983
|
+
}
|
|
984
|
+
}, {
|
|
985
|
+
key: "pruneEmptyHookRoots",
|
|
986
|
+
value: function pruneEmptyHookRoots(steps) {
|
|
987
|
+
var _this5 = this;
|
|
988
|
+
return steps.map(function (step) {
|
|
989
|
+
return _objectSpread(_objectSpread({}, step), {}, {
|
|
990
|
+
steps: _this5.pruneEmptyHookRoots(step.steps)
|
|
991
|
+
});
|
|
992
|
+
}).filter(function (step) {
|
|
993
|
+
return !_this5.isEmptyPassedHookRoot(step);
|
|
994
|
+
});
|
|
995
|
+
}
|
|
715
996
|
}, {
|
|
716
997
|
key: "removeStepFromHookStack",
|
|
717
998
|
value: function removeStepFromHookStack(stack, stepUuid) {
|
|
999
|
+
var _this6 = this;
|
|
718
1000
|
if (!stack) {
|
|
719
1001
|
return;
|
|
720
1002
|
}
|
|
@@ -726,7 +1008,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
726
1008
|
steps: _removeRecursively(step.steps)
|
|
727
1009
|
});
|
|
728
1010
|
}).filter(function (step) {
|
|
729
|
-
return
|
|
1011
|
+
return !_this6.isEmptyPassedHookRoot(step);
|
|
730
1012
|
});
|
|
731
1013
|
};
|
|
732
1014
|
stack.steps = _removeRecursively(stack.steps);
|
|
@@ -760,11 +1042,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
760
1042
|
|
|
761
1043
|
// Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
|
|
762
1044
|
if (!staticAllureId && "annotations" in test) {
|
|
763
|
-
var
|
|
764
|
-
|
|
1045
|
+
var _iterator7 = _createForOfIteratorHelper(test.annotations),
|
|
1046
|
+
_step7;
|
|
765
1047
|
try {
|
|
766
|
-
for (
|
|
767
|
-
var annotation =
|
|
1048
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1049
|
+
var annotation = _step7.value;
|
|
768
1050
|
var label = (0, _sdk.getMetadataLabel)(annotation.type, annotation.description);
|
|
769
1051
|
if ((label === null || label === void 0 ? void 0 : label.name) === _allureJsCommons.LabelName.ALLURE_ID) {
|
|
770
1052
|
staticAllureId = label.value;
|
|
@@ -772,9 +1054,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
772
1054
|
}
|
|
773
1055
|
}
|
|
774
1056
|
} catch (err) {
|
|
775
|
-
|
|
1057
|
+
_iterator7.e(err);
|
|
776
1058
|
} finally {
|
|
777
|
-
|
|
1059
|
+
_iterator7.f();
|
|
778
1060
|
}
|
|
779
1061
|
}
|
|
780
1062
|
return {
|
|
@@ -812,8 +1094,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
812
1094
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
813
1095
|
var _message$data = message.data,
|
|
814
1096
|
name = _message$data.name,
|
|
815
|
-
_message$data$
|
|
816
|
-
parameters = _message$data$
|
|
1097
|
+
_message$data$paramet2 = _message$data.parameters,
|
|
1098
|
+
parameters = _message$data$paramet2 === void 0 ? [] : _message$data$paramet2;
|
|
817
1099
|
this.allureRuntime.updateStep(attachmentStepUuid, function (step) {
|
|
818
1100
|
var _step$parameters;
|
|
819
1101
|
if (name) {
|
|
@@ -842,32 +1124,32 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
842
1124
|
}, {
|
|
843
1125
|
key: "processAttachment",
|
|
844
1126
|
value: function () {
|
|
845
|
-
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1127
|
+
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(testUuid, attachmentStepUuid, attachment) {
|
|
846
1128
|
var _replace;
|
|
847
1129
|
var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
|
|
848
|
-
return _regenerator().w(function (
|
|
849
|
-
while (1) switch (
|
|
1130
|
+
return _regenerator().w(function (_context7) {
|
|
1131
|
+
while (1) switch (_context7.n) {
|
|
850
1132
|
case 0:
|
|
851
1133
|
if (!(!attachment.body && !attachment.path)) {
|
|
852
|
-
|
|
1134
|
+
_context7.n = 1;
|
|
853
1135
|
break;
|
|
854
1136
|
}
|
|
855
|
-
return
|
|
1137
|
+
return _context7.a(2);
|
|
856
1138
|
case 1:
|
|
857
1139
|
allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
858
1140
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
859
|
-
|
|
1141
|
+
_context7.n = 2;
|
|
860
1142
|
break;
|
|
861
1143
|
}
|
|
862
|
-
return
|
|
1144
|
+
return _context7.a(2);
|
|
863
1145
|
case 2:
|
|
864
1146
|
if (!allureRuntimeMessage) {
|
|
865
|
-
|
|
1147
|
+
_context7.n = 3;
|
|
866
1148
|
break;
|
|
867
1149
|
}
|
|
868
1150
|
message = JSON.parse(attachment.body.toString());
|
|
869
1151
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
870
|
-
return
|
|
1152
|
+
return _context7.a(2);
|
|
871
1153
|
case 3:
|
|
872
1154
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
873
1155
|
name: attachment.name
|
|
@@ -878,20 +1160,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
878
1160
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
879
1161
|
}
|
|
880
1162
|
if (!attachment.body) {
|
|
881
|
-
|
|
1163
|
+
_context7.n = 4;
|
|
882
1164
|
break;
|
|
883
1165
|
}
|
|
884
1166
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
885
1167
|
contentType: attachment.contentType
|
|
886
1168
|
});
|
|
887
|
-
|
|
1169
|
+
_context7.n = 6;
|
|
888
1170
|
break;
|
|
889
1171
|
case 4:
|
|
890
1172
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
891
|
-
|
|
1173
|
+
_context7.n = 5;
|
|
892
1174
|
break;
|
|
893
1175
|
}
|
|
894
|
-
return
|
|
1176
|
+
return _context7.a(2);
|
|
895
1177
|
case 5:
|
|
896
1178
|
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? _allureJsCommons.ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
|
|
897
1179
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
@@ -899,91 +1181,91 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
899
1181
|
});
|
|
900
1182
|
case 6:
|
|
901
1183
|
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
902
|
-
|
|
1184
|
+
_context7.n = 7;
|
|
903
1185
|
break;
|
|
904
1186
|
}
|
|
905
|
-
return
|
|
1187
|
+
return _context7.a(2);
|
|
906
1188
|
case 7:
|
|
907
1189
|
pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
908
1190
|
pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
909
1191
|
if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
|
|
910
|
-
|
|
1192
|
+
_context7.n = 8;
|
|
911
1193
|
break;
|
|
912
1194
|
}
|
|
913
|
-
return
|
|
1195
|
+
return _context7.a(2);
|
|
914
1196
|
case 8:
|
|
915
1197
|
fileExists = /*#__PURE__*/function () {
|
|
916
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
917
|
-
return _regenerator().w(function (
|
|
918
|
-
while (1) switch (
|
|
1198
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
|
|
1199
|
+
return _regenerator().w(function (_context5) {
|
|
1200
|
+
while (1) switch (_context5.n) {
|
|
919
1201
|
case 0:
|
|
920
|
-
|
|
1202
|
+
_context5.n = 1;
|
|
921
1203
|
return (0, _promises.access)(filePath).then(function () {
|
|
922
1204
|
return true;
|
|
923
1205
|
})["catch"](function () {
|
|
924
1206
|
return false;
|
|
925
1207
|
});
|
|
926
1208
|
case 1:
|
|
927
|
-
return
|
|
1209
|
+
return _context5.a(2, _context5.v);
|
|
928
1210
|
}
|
|
929
|
-
},
|
|
1211
|
+
}, _callee5);
|
|
930
1212
|
}));
|
|
931
|
-
return function fileExists(
|
|
1213
|
+
return function fileExists(_x7) {
|
|
932
1214
|
return _ref4.apply(this, arguments);
|
|
933
1215
|
};
|
|
934
1216
|
}();
|
|
935
1217
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
936
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1218
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
|
|
937
1219
|
var defaultPath, snapshotPath;
|
|
938
|
-
return _regenerator().w(function (
|
|
939
|
-
while (1) switch (
|
|
1220
|
+
return _regenerator().w(function (_context6) {
|
|
1221
|
+
while (1) switch (_context6.n) {
|
|
940
1222
|
case 0:
|
|
941
1223
|
defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
|
|
942
1224
|
snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
|
|
943
|
-
|
|
1225
|
+
_context6.n = 1;
|
|
944
1226
|
return fileExists(defaultPath);
|
|
945
1227
|
case 1:
|
|
946
|
-
if (!
|
|
947
|
-
|
|
1228
|
+
if (!_context6.v) {
|
|
1229
|
+
_context6.n = 3;
|
|
948
1230
|
break;
|
|
949
1231
|
}
|
|
950
|
-
|
|
1232
|
+
_context6.n = 2;
|
|
951
1233
|
return (0, _reporter.readImageAsBase64)(defaultPath);
|
|
952
1234
|
case 2:
|
|
953
|
-
return
|
|
1235
|
+
return _context6.a(2, _context6.v);
|
|
954
1236
|
case 3:
|
|
955
|
-
|
|
1237
|
+
_context6.n = 4;
|
|
956
1238
|
return fileExists(snapshotPath);
|
|
957
1239
|
case 4:
|
|
958
|
-
if (!
|
|
959
|
-
|
|
1240
|
+
if (!_context6.v) {
|
|
1241
|
+
_context6.n = 6;
|
|
960
1242
|
break;
|
|
961
1243
|
}
|
|
962
|
-
|
|
1244
|
+
_context6.n = 5;
|
|
963
1245
|
return (0, _reporter.readImageAsBase64)(snapshotPath);
|
|
964
1246
|
case 5:
|
|
965
|
-
return
|
|
1247
|
+
return _context6.a(2, _context6.v);
|
|
966
1248
|
case 6:
|
|
967
|
-
return
|
|
1249
|
+
return _context6.a(2, undefined);
|
|
968
1250
|
}
|
|
969
|
-
},
|
|
1251
|
+
}, _callee6);
|
|
970
1252
|
}));
|
|
971
|
-
return function readImageFromDirs(
|
|
1253
|
+
return function readImageFromDirs(_x8) {
|
|
972
1254
|
return _ref5.apply(this, arguments);
|
|
973
1255
|
};
|
|
974
1256
|
}();
|
|
975
|
-
|
|
1257
|
+
_context7.n = 9;
|
|
976
1258
|
return readImageFromDirs("actual");
|
|
977
1259
|
case 9:
|
|
978
|
-
actualBase64 =
|
|
979
|
-
|
|
1260
|
+
actualBase64 = _context7.v;
|
|
1261
|
+
_context7.n = 10;
|
|
980
1262
|
return readImageFromDirs("expected");
|
|
981
1263
|
case 10:
|
|
982
|
-
expectedBase64 =
|
|
983
|
-
|
|
1264
|
+
expectedBase64 = _context7.v;
|
|
1265
|
+
_context7.n = 11;
|
|
984
1266
|
return readImageFromDirs("diff");
|
|
985
1267
|
case 11:
|
|
986
|
-
diffBase64 =
|
|
1268
|
+
diffBase64 = _context7.v;
|
|
987
1269
|
diffName = attachment.name.replace(_utils.diffEndRegexp, "");
|
|
988
1270
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
989
1271
|
expected: expectedBase64,
|
|
@@ -996,11 +1278,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
996
1278
|
});
|
|
997
1279
|
this.processedDiffs.push(pathWithoutEnd);
|
|
998
1280
|
case 12:
|
|
999
|
-
return
|
|
1281
|
+
return _context7.a(2);
|
|
1000
1282
|
}
|
|
1001
|
-
},
|
|
1283
|
+
}, _callee7, this);
|
|
1002
1284
|
}));
|
|
1003
|
-
function processAttachment(
|
|
1285
|
+
function processAttachment(_x4, _x5, _x6) {
|
|
1004
1286
|
return _processAttachment.apply(this, arguments);
|
|
1005
1287
|
}
|
|
1006
1288
|
return processAttachment;
|