allure-playwright 3.0.0-beta.2 → 3.0.0-beta.4

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 CHANGED
@@ -28,8 +28,8 @@ var _utils = require("./utils.js");
28
28
  var _test = require("@playwright/test");
29
29
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
30
30
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
31
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
32
31
  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; } } }; }
32
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
33
33
  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); }
34
34
  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); }); }; }
35
35
  function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
@@ -65,6 +65,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
65
65
  _defineProperty(this, "processedDiffs", []);
66
66
  _defineProperty(this, "startedTestCasesTitlesCache", []);
67
67
  _defineProperty(this, "allureResultsUuids", new Map());
68
+ _defineProperty(this, "attachmentSteps", new Map());
68
69
  this.options = _objectSpread({
69
70
  suiteTitle: true,
70
71
  detail: true
@@ -91,6 +92,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
91
92
  var v2ReporterTests = [];
92
93
  var cliArgs = [];
93
94
  testsWithSelectors.forEach(function (test) {
95
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
94
96
  if (!/#/.test(test.selector)) {
95
97
  v2ReporterTests.push(test);
96
98
  return;
@@ -99,7 +101,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
99
101
  });
100
102
  if (v2ReporterTests.length) {
101
103
  // we need to cut off column because playwright works only with line number
102
- var v2SelectorsArgs = v2ReporterTests.map(function (test) {
104
+ var v2SelectorsArgs = v2ReporterTests
105
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
106
+ .map(function (test) {
103
107
  return test.selector.replace(/:\d+$/, "");
104
108
  }).map(function (selector) {
105
109
  return (0, _reporter.escapeRegExp)(selector);
@@ -109,6 +113,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
109
113
  if (v1ReporterTests.length) {
110
114
  var v1SelectorsArgs = v1ReporterTests
111
115
  // we can filter tests only by absolute path, so we need to cut off test name
116
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
112
117
  .map(function (test) {
113
118
  return test.selector.split("#")[0];
114
119
  }).map(function (selector) {
@@ -138,7 +143,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
138
143
  }, {
139
144
  key: "onBegin",
140
145
  value: function onBegin(suite) {
141
- var writer = this.options.testMode ? new _reporter.MessageWriter() : new _reporter.FileSystemWriter({
146
+ var writer = _nodeProcess["default"].env.ALLURE_TEST_MODE ? new _reporter.MessageWriter() : new _reporter.FileSystemWriter({
142
147
  resultsDir: this.options.resultsDir || "./allure-results"
143
148
  });
144
149
  this.suite = suite;
@@ -198,19 +203,22 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
198
203
  }, {
199
204
  key: "onStepBegin",
200
205
  value: function onStepBegin(test, _result, step) {
201
- if (!this.options.detail && step.category !== "test.step") {
206
+ var testUuid = this.allureResultsUuids.get(test.id);
207
+ if (step.category === "attach") {
208
+ var _this$allureRuntime, _this$attachmentSteps;
209
+ var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
210
+ this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
202
211
  return;
203
212
  }
204
213
 
205
- // ignore attach steps since attachments are already in the report
206
- if (step.category === "attach") {
214
+ // TODO fix the details disable, e.g. only ignore pw:api steps
215
+ if (!this.options.detail && step.category !== "test.step") {
207
216
  return;
208
217
  }
209
- var testUuid = this.allureResultsUuids.get(test.id);
210
- this.allureRuntime.startStep({
218
+ this.allureRuntime.startStep(testUuid, undefined, {
211
219
  name: step.title.substring(0, stepAttachPrefixLength),
212
220
  start: step.startTime.getTime()
213
- }, testUuid);
221
+ });
214
222
  }
215
223
  }, {
216
224
  key: "onStepEnd",
@@ -224,23 +232,26 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
224
232
  return;
225
233
  }
226
234
  var testUuid = this.allureResultsUuids.get(test.id);
227
- this.allureRuntime.updateStep(function (stepResult) {
235
+ var currentStep = this.allureRuntime.currentStep(testUuid);
236
+ if (!currentStep) {
237
+ return;
238
+ }
239
+ this.allureRuntime.updateStep(currentStep, function (stepResult) {
228
240
  stepResult.status = step.error ? _allureJsCommons.Status.FAILED : _allureJsCommons.Status.PASSED;
229
241
  stepResult.stage = _allureJsCommons.Stage.FINISHED;
230
242
  if (step.error) {
231
243
  stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
232
244
  }
233
- }, testUuid);
234
- this.allureRuntime.stopStep({
235
- uuid: testUuid
236
245
  });
246
+ this.allureRuntime.stopStep(currentStep, step.startTime.getTime() + step.duration);
237
247
  }
238
248
  }, {
239
249
  key: "onTestEnd",
240
250
  value: function () {
241
251
  var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
242
- var _this = this;
243
- var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, _iterator, _step, attachment;
252
+ var _this = this,
253
+ _this$attachmentSteps2;
254
+ var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, attachmentSteps, i, attachment, attachmentStep;
244
255
  return _regeneratorRuntime().wrap(function _callee$(_context) {
245
256
  while (1) switch (_context.prev = _context.next) {
246
257
  case 0:
@@ -249,7 +260,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
249
260
  thread = _nodeProcess["default"].env.ALLURE_THREAD_NAME || "".concat(this.hostname, "-").concat(_nodeProcess["default"].pid, "-playwright-worker-").concat(threadId);
250
261
  error = result.error; // only apply default suites if not set by user
251
262
  _test$parent$titlePat = test.parent.titlePath(), _test$parent$titlePat2 = _toArray(_test$parent$titlePat), projectSuiteTitle = _test$parent$titlePat2[1], fileSuiteTitle = _test$parent$titlePat2[2], suiteTitles = _test$parent$titlePat2.slice(3);
252
- this.allureRuntime.updateTest(function (testResult) {
263
+ this.allureRuntime.updateTest(testUuid, function (testResult) {
253
264
  testResult.labels.push({
254
265
  name: _allureJsCommons.LabelName.HOST,
255
266
  value: _this.hostname
@@ -281,47 +292,37 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
281
292
  }
282
293
  testResult.status = (0, _utils.statusToAllureStats)(result.status, test.expectedStatus);
283
294
  testResult.stage = _allureJsCommons.Stage.FINISHED;
284
- }, testUuid);
285
- _iterator = _createForOfIteratorHelper(result.attachments);
286
- _context.prev = 7;
287
- _iterator.s();
288
- case 9:
289
- if ((_step = _iterator.n()).done) {
290
- _context.next = 15;
295
+ });
296
+ attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
297
+ i = 0;
298
+ case 8:
299
+ if (!(i < result.attachments.length)) {
300
+ _context.next = 16;
291
301
  break;
292
302
  }
293
- attachment = _step.value;
303
+ attachment = result.attachments[i];
304
+ attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
294
305
  _context.next = 13;
295
- return this.processAttachment(test.id, attachment);
306
+ return this.processAttachment(testUuid, attachmentStep, attachment);
296
307
  case 13:
297
- _context.next = 9;
308
+ i++;
309
+ _context.next = 8;
298
310
  break;
299
- case 15:
300
- _context.next = 20;
301
- break;
302
- case 17:
303
- _context.prev = 17;
304
- _context.t0 = _context["catch"](7);
305
- _iterator.e(_context.t0);
306
- case 20:
307
- _context.prev = 20;
308
- _iterator.f();
309
- return _context.finish(20);
310
- case 23:
311
+ case 16:
311
312
  if (result.stdout.length > 0) {
312
- this.allureRuntime.writeAttachment("stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
313
+ this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
313
314
  contentType: _allureJsCommons.ContentType.TEXT
314
- }, testUuid);
315
+ });
315
316
  }
316
317
  if (result.stderr.length > 0) {
317
- this.allureRuntime.writeAttachment("stderr", Buffer.from((0, _sdk.stripAnsi)(result.stderr.join("")), "utf-8"), {
318
+ this.allureRuntime.writeAttachment(testUuid, undefined, "stderr", Buffer.from((0, _sdk.stripAnsi)(result.stderr.join("")), "utf-8"), {
318
319
  contentType: _allureJsCommons.ContentType.TEXT
319
- }, testUuid);
320
+ });
320
321
  }
321
322
 
322
323
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
323
324
  // in next iterations we need to implement the logic for every javascript integration
324
- this.allureRuntime.updateTest(function (testResult) {
325
+ this.allureRuntime.updateTest(testUuid, function (testResult) {
325
326
  var mappedLabels = testResult.labels.reduce(function (acc, label) {
326
327
  if (!acc[label.name]) {
327
328
  acc[label.name] = [];
@@ -337,16 +338,14 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
337
338
  return labelsGroup;
338
339
  });
339
340
  testResult.labels = newLabels;
340
- }, testUuid);
341
- this.allureRuntime.stopTest({
342
- uuid: testUuid
343
341
  });
342
+ this.allureRuntime.stopTest(testUuid, result.startTime.getTime() + result.duration);
344
343
  this.allureRuntime.writeTest(testUuid);
345
- case 28:
344
+ case 21:
346
345
  case "end":
347
346
  return _context.stop();
348
347
  }
349
- }, _callee, this, [[7, 17, 20, 23]]);
348
+ }, _callee, this);
350
349
  }));
351
350
  function onTestEnd(_x, _x2) {
352
351
  return _onTestEnd.apply(this, arguments);
@@ -358,7 +357,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
358
357
  value: function () {
359
358
  var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
360
359
  var _this2 = this;
361
- var unprocessedCases, _iterator2, _step2, testCase;
360
+ var unprocessedCases, _iterator, _step, testCase;
362
361
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
363
362
  while (1) switch (_context2.prev = _context2.next) {
364
363
  case 0:
@@ -367,15 +366,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
367
366
  var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
368
367
  return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
369
368
  });
370
- _iterator2 = _createForOfIteratorHelper(unprocessedCases);
369
+ _iterator = _createForOfIteratorHelper(unprocessedCases);
371
370
  _context2.prev = 2;
372
- _iterator2.s();
371
+ _iterator.s();
373
372
  case 4:
374
- if ((_step2 = _iterator2.n()).done) {
373
+ if ((_step = _iterator.n()).done) {
375
374
  _context2.next = 11;
376
375
  break;
377
376
  }
378
- testCase = _step2.value;
377
+ testCase = _step.value;
379
378
  this.onTestBegin(testCase);
380
379
  _context2.next = 9;
381
380
  return this.onTestEnd(testCase, {
@@ -400,10 +399,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
400
399
  case 13:
401
400
  _context2.prev = 13;
402
401
  _context2.t0 = _context2["catch"](2);
403
- _iterator2.e(_context2.t0);
402
+ _iterator.e(_context2.t0);
404
403
  case 16:
405
404
  _context2.prev = 16;
406
- _iterator2.f();
405
+ _iterator.f();
407
406
  return _context2.finish(16);
408
407
  case 19:
409
408
  case "end":
@@ -447,82 +446,88 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
447
446
  }, {
448
447
  key: "processAttachment",
449
448
  value: function () {
450
- var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(testId, attachment) {
451
- var testUuid, allureRuntimeMessage, message, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
449
+ var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(testUuid, attachmentStepUuid, attachment) {
450
+ var allureRuntimeMessage, message, parentUuid, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
452
451
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
453
452
  while (1) switch (_context4.prev = _context4.next) {
454
453
  case 0:
455
- testUuid = this.allureResultsUuids.get(testId);
456
454
  if (!(!attachment.body && !attachment.path)) {
457
- _context4.next = 3;
455
+ _context4.next = 2;
458
456
  break;
459
457
  }
460
458
  return _context4.abrupt("return");
461
- case 3:
459
+ case 2:
462
460
  allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
463
461
  if (!(allureRuntimeMessage && !attachment.body)) {
464
- _context4.next = 6;
462
+ _context4.next = 5;
465
463
  break;
466
464
  }
467
465
  return _context4.abrupt("return");
468
- case 6:
466
+ case 5:
469
467
  if (!allureRuntimeMessage) {
470
- _context4.next = 10;
468
+ _context4.next = 9;
471
469
  break;
472
470
  }
473
- message = JSON.parse(attachment.body.toString()); // TODO: make possible to pass single message and list of them
474
- this.allureRuntime.applyRuntimeMessages([message], {
475
- testUuid: testUuid
476
- });
471
+ message = JSON.parse(attachment.body.toString()); // TODO fix step metadata messages
472
+ this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
477
473
  return _context4.abrupt("return");
478
- case 10:
474
+ case 9:
475
+ parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
476
+ name: attachment.name
477
+ }); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
478
+ // usually, missing test by uuid means we should completely skip result processing;
479
+ // the later operations are safe and will only produce console warnings
480
+ if (parentUuid) {
481
+ this.allureRuntime.stopStep(parentUuid, undefined);
482
+ }
479
483
  if (!attachment.body) {
480
- _context4.next = 14;
484
+ _context4.next = 15;
481
485
  break;
482
486
  }
483
- this.allureRuntime.writeAttachment(attachment.name, attachment.body, {
487
+ this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
484
488
  contentType: attachment.contentType
485
- }, testUuid);
486
- _context4.next = 19;
489
+ });
490
+ _context4.next = 20;
487
491
  break;
488
- case 14:
492
+ case 15:
489
493
  if ((0, _nodeFs.existsSync)(attachment.path)) {
490
- _context4.next = 18;
494
+ _context4.next = 19;
491
495
  break;
492
496
  }
493
497
  return _context4.abrupt("return");
494
- case 18:
495
- this.allureRuntime.writeAttachmentFromPath(attachment.name, attachment.path, {
496
- contentType: attachment.contentType
497
- }, testUuid);
498
498
  case 19:
499
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
500
+ this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
501
+ contentType: attachment.contentType
502
+ });
503
+ case 20:
499
504
  if (attachment.name.match(diffEndRegexp)) {
500
- _context4.next = 21;
505
+ _context4.next = 22;
501
506
  break;
502
507
  }
503
508
  return _context4.abrupt("return");
504
- case 21:
509
+ case 22:
505
510
  pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
506
511
  if (!this.processedDiffs.includes(pathWithoutEnd)) {
507
- _context4.next = 24;
512
+ _context4.next = 25;
508
513
  break;
509
514
  }
510
515
  return _context4.abrupt("return");
511
- case 24:
512
- _context4.next = 26;
516
+ case 25:
517
+ _context4.next = 27;
513
518
  return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-actual.png"));
514
- case 26:
519
+ case 27:
515
520
  actualBase64 = _context4.sent;
516
- _context4.next = 29;
521
+ _context4.next = 30;
517
522
  return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-expected.png"));
518
- case 29:
523
+ case 30:
519
524
  expectedBase64 = _context4.sent;
520
- _context4.next = 32;
525
+ _context4.next = 33;
521
526
  return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-diff.png"));
522
- case 32:
527
+ case 33:
523
528
  diffBase64 = _context4.sent;
524
529
  diffName = attachment.name.replace(diffEndRegexp, "");
525
- this.allureRuntime.writeAttachment(diffName, Buffer.from(JSON.stringify({
530
+ this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
526
531
  expected: expectedBase64,
527
532
  actual: actualBase64,
528
533
  diff: diffBase64,
@@ -530,15 +535,15 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
530
535
  }), "utf-8"), {
531
536
  contentType: _allureJsCommons.ContentType.IMAGEDIFF,
532
537
  fileExtension: ".imagediff"
533
- }, testUuid);
538
+ });
534
539
  this.processedDiffs.push(pathWithoutEnd);
535
- case 36:
540
+ case 37:
536
541
  case "end":
537
542
  return _context4.stop();
538
543
  }
539
544
  }, _callee4, this);
540
545
  }));
541
- function processAttachment(_x3, _x4) {
546
+ function processAttachment(_x3, _x4, _x5) {
542
547
  return _processAttachment.apply(this, arguments);
543
548
  }
544
549
  return processAttachment;