allure-playwright 3.0.0-beta.1 → 3.0.0-beta.10
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 +64 -375
- package/dist/cjs/index.js +143 -120
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/legacy.js +28 -26
- package/dist/cjs/legacy.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/runtime.js +77 -8
- package/dist/cjs/runtime.js.map +1 -1
- package/dist/cjs/testplan.js +4 -2
- package/dist/cjs/testplan.js.map +1 -1
- package/dist/esm/index.js +144 -122
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/legacy.js +28 -26
- package/dist/esm/legacy.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/package.json +3 -0
- package/dist/esm/runtime.js +77 -7
- package/dist/esm/runtime.js.map +1 -1
- package/dist/esm/testplan.js +4 -2
- package/dist/esm/testplan.js.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/legacy.d.ts +6 -0
- package/dist/types/model.d.ts +2 -4
- package/dist/types/runtime.d.ts +5 -0
- package/package.json +22 -15
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(); }
|
|
@@ -51,8 +51,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
51
51
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
52
52
|
// TODO: move to utils.ts
|
|
53
53
|
var diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/;
|
|
54
|
-
// 12 (allureattach) + 1 (_) + 36 (uuid v4) + 1 (_)
|
|
55
|
-
var stepAttachPrefixLength = 50;
|
|
56
54
|
var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
57
55
|
function AllureReporter(config) {
|
|
58
56
|
_classCallCheck(this, AllureReporter);
|
|
@@ -65,6 +63,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
65
63
|
_defineProperty(this, "processedDiffs", []);
|
|
66
64
|
_defineProperty(this, "startedTestCasesTitlesCache", []);
|
|
67
65
|
_defineProperty(this, "allureResultsUuids", new Map());
|
|
66
|
+
_defineProperty(this, "attachmentSteps", new Map());
|
|
68
67
|
this.options = _objectSpread({
|
|
69
68
|
suiteTitle: true,
|
|
70
69
|
detail: true
|
|
@@ -91,6 +90,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
91
90
|
var v2ReporterTests = [];
|
|
92
91
|
var cliArgs = [];
|
|
93
92
|
testsWithSelectors.forEach(function (test) {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
94
94
|
if (!/#/.test(test.selector)) {
|
|
95
95
|
v2ReporterTests.push(test);
|
|
96
96
|
return;
|
|
@@ -99,7 +99,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
99
99
|
});
|
|
100
100
|
if (v2ReporterTests.length) {
|
|
101
101
|
// we need to cut off column because playwright works only with line number
|
|
102
|
-
var v2SelectorsArgs = v2ReporterTests
|
|
102
|
+
var v2SelectorsArgs = v2ReporterTests
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
104
|
+
.map(function (test) {
|
|
103
105
|
return test.selector.replace(/:\d+$/, "");
|
|
104
106
|
}).map(function (selector) {
|
|
105
107
|
return (0, _reporter.escapeRegExp)(selector);
|
|
@@ -109,6 +111,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
109
111
|
if (v1ReporterTests.length) {
|
|
110
112
|
var v1SelectorsArgs = v1ReporterTests
|
|
111
113
|
// we can filter tests only by absolute path, so we need to cut off test name
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
112
115
|
.map(function (test) {
|
|
113
116
|
return test.selector.split("#")[0];
|
|
114
117
|
}).map(function (selector) {
|
|
@@ -138,12 +141,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
138
141
|
}, {
|
|
139
142
|
key: "onBegin",
|
|
140
143
|
value: function onBegin(suite) {
|
|
141
|
-
var writer = this.options.testMode ? new _reporter.MessageWriter() : new _reporter.FileSystemWriter({
|
|
142
|
-
resultsDir: this.options.resultsDir || "./allure-results"
|
|
143
|
-
});
|
|
144
144
|
this.suite = suite;
|
|
145
145
|
this.allureRuntime = new _reporter.ReporterRuntime(_objectSpread(_objectSpread({}, this.options), {}, {
|
|
146
|
-
writer:
|
|
146
|
+
writer: (0, _reporter.createDefaultWriter)({
|
|
147
|
+
resultsDir: this.options.resultsDir
|
|
148
|
+
})
|
|
147
149
|
}));
|
|
148
150
|
}
|
|
149
151
|
}, {
|
|
@@ -152,7 +154,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
152
154
|
var suite = test.parent;
|
|
153
155
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
154
156
|
var project = suite.project();
|
|
155
|
-
var
|
|
157
|
+
var pathElements = _nodePath["default"].relative(project === null || project === void 0 ? void 0 : project.testDir, test.location.file).split(_nodePath["default"].sep);
|
|
158
|
+
var relativeFile = pathElements.join("/");
|
|
156
159
|
// root > project > file path > test.describe...
|
|
157
160
|
var _suite$titlePath = suite.titlePath(),
|
|
158
161
|
_suite$titlePath2 = _toArray(_suite$titlePath),
|
|
@@ -161,7 +164,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
161
164
|
var testCaseIdBase = "".concat(relativeFile, "#").concat(nameSuites).concat(test.title);
|
|
162
165
|
var result = {
|
|
163
166
|
name: titleMetadata.cleanTitle,
|
|
164
|
-
labels: titleMetadata.labels,
|
|
167
|
+
labels: [].concat(_toConsumableArray(titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
165
168
|
links: [],
|
|
166
169
|
parameters: [],
|
|
167
170
|
testCaseId: (0, _reporter.md5)(testCaseIdBase),
|
|
@@ -179,6 +182,22 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
179
182
|
name: "titlePath",
|
|
180
183
|
value: suite.titlePath().join(" > ")
|
|
181
184
|
});
|
|
185
|
+
result.labels.push({
|
|
186
|
+
name: _allureJsCommons.LabelName.PACKAGE,
|
|
187
|
+
value: pathElements.join(".")
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// support for earlier playwright versions
|
|
191
|
+
if ("tags" in test) {
|
|
192
|
+
var _ref;
|
|
193
|
+
var tags = test.tags.map(function (tag) {
|
|
194
|
+
return {
|
|
195
|
+
name: _allureJsCommons.LabelName.TAG,
|
|
196
|
+
value: tag.startsWith("@") ? tag.substring(1) : tag
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
(_ref = result.labels).push.apply(_ref, _toConsumableArray(tags));
|
|
200
|
+
}
|
|
182
201
|
if (project !== null && project !== void 0 && project.name) {
|
|
183
202
|
result.parameters.push({
|
|
184
203
|
name: "Project",
|
|
@@ -198,19 +217,22 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
198
217
|
}, {
|
|
199
218
|
key: "onStepBegin",
|
|
200
219
|
value: function onStepBegin(test, _result, step) {
|
|
201
|
-
|
|
220
|
+
var testUuid = this.allureResultsUuids.get(test.id);
|
|
221
|
+
if (step.category === "attach") {
|
|
222
|
+
var _this$allureRuntime, _this$attachmentSteps;
|
|
223
|
+
var currentStep = (_this$allureRuntime = this.allureRuntime) === null || _this$allureRuntime === void 0 ? void 0 : _this$allureRuntime.currentStep(testUuid);
|
|
224
|
+
this.attachmentSteps.set(testUuid, [].concat(_toConsumableArray((_this$attachmentSteps = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps !== void 0 ? _this$attachmentSteps : []), [currentStep]));
|
|
202
225
|
return;
|
|
203
226
|
}
|
|
204
227
|
|
|
205
|
-
//
|
|
206
|
-
if (step.category
|
|
228
|
+
// TODO fix the details disable, e.g. only ignore pw:api steps
|
|
229
|
+
if (!this.options.detail && step.category !== "test.step") {
|
|
207
230
|
return;
|
|
208
231
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
name: step.title.substring(0, stepAttachPrefixLength),
|
|
232
|
+
this.allureRuntime.startStep(testUuid, undefined, {
|
|
233
|
+
name: step.title,
|
|
212
234
|
start: step.startTime.getTime()
|
|
213
|
-
}
|
|
235
|
+
});
|
|
214
236
|
}
|
|
215
237
|
}, {
|
|
216
238
|
key: "onStepEnd",
|
|
@@ -224,23 +246,28 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
224
246
|
return;
|
|
225
247
|
}
|
|
226
248
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
227
|
-
this.allureRuntime.
|
|
249
|
+
var currentStep = this.allureRuntime.currentStep(testUuid);
|
|
250
|
+
if (!currentStep) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this.allureRuntime.updateStep(currentStep, function (stepResult) {
|
|
228
254
|
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : _allureJsCommons.Status.PASSED;
|
|
229
255
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
230
256
|
if (step.error) {
|
|
231
257
|
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
232
258
|
}
|
|
233
|
-
}
|
|
234
|
-
this.allureRuntime.stopStep({
|
|
235
|
-
|
|
259
|
+
});
|
|
260
|
+
this.allureRuntime.stopStep(currentStep, {
|
|
261
|
+
duration: step.duration
|
|
236
262
|
});
|
|
237
263
|
}
|
|
238
264
|
}, {
|
|
239
265
|
key: "onTestEnd",
|
|
240
266
|
value: function () {
|
|
241
267
|
var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
|
|
242
|
-
var _this = this
|
|
243
|
-
|
|
268
|
+
var _this = this,
|
|
269
|
+
_this$attachmentSteps2;
|
|
270
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, attachmentSteps, i, attachment, attachmentStep;
|
|
244
271
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
245
272
|
while (1) switch (_context.prev = _context.next) {
|
|
246
273
|
case 0:
|
|
@@ -249,7 +276,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
249
276
|
thread = _nodeProcess["default"].env.ALLURE_THREAD_NAME || "".concat(this.hostname, "-").concat(_nodeProcess["default"].pid, "-playwright-worker-").concat(threadId);
|
|
250
277
|
error = result.error; // only apply default suites if not set by user
|
|
251
278
|
_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) {
|
|
279
|
+
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
253
280
|
testResult.labels.push({
|
|
254
281
|
name: _allureJsCommons.LabelName.HOST,
|
|
255
282
|
value: _this.hostname
|
|
@@ -278,56 +305,50 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
278
305
|
}
|
|
279
306
|
if (error) {
|
|
280
307
|
testResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(error));
|
|
308
|
+
} else {
|
|
309
|
+
var _test$annotations;
|
|
310
|
+
var skipReason = (_test$annotations = test.annotations) === null || _test$annotations === void 0 || (_test$annotations = _test$annotations.find(function (annotation) {
|
|
311
|
+
return annotation.type === "skip" || annotation.type === "fixme";
|
|
312
|
+
})) === null || _test$annotations === void 0 ? void 0 : _test$annotations.description;
|
|
313
|
+
if (skipReason) {
|
|
314
|
+
testResult.statusDetails = _objectSpread(_objectSpread({}, testResult.statusDetails), {}, {
|
|
315
|
+
message: skipReason
|
|
316
|
+
});
|
|
317
|
+
}
|
|
281
318
|
}
|
|
282
319
|
testResult.status = (0, _utils.statusToAllureStats)(result.status, test.expectedStatus);
|
|
283
320
|
testResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
_context.next = 15;
|
|
321
|
+
});
|
|
322
|
+
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
323
|
+
i = 0;
|
|
324
|
+
case 8:
|
|
325
|
+
if (!(i < result.attachments.length)) {
|
|
326
|
+
_context.next = 16;
|
|
291
327
|
break;
|
|
292
328
|
}
|
|
293
|
-
attachment =
|
|
329
|
+
attachment = result.attachments[i];
|
|
330
|
+
attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
|
|
294
331
|
_context.next = 13;
|
|
295
|
-
return this.processAttachment(
|
|
332
|
+
return this.processAttachment(testUuid, attachmentStep, attachment);
|
|
296
333
|
case 13:
|
|
297
|
-
|
|
334
|
+
i++;
|
|
335
|
+
_context.next = 8;
|
|
298
336
|
break;
|
|
299
|
-
case
|
|
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:
|
|
337
|
+
case 16:
|
|
311
338
|
if (result.stdout.length > 0) {
|
|
312
|
-
this.allureRuntime.writeAttachment({
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
316
|
-
content: Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf8")
|
|
317
|
-
}, testUuid);
|
|
339
|
+
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
|
|
340
|
+
contentType: _allureJsCommons.ContentType.TEXT
|
|
341
|
+
});
|
|
318
342
|
}
|
|
319
343
|
if (result.stderr.length > 0) {
|
|
320
|
-
this.allureRuntime.writeAttachment({
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
324
|
-
content: Buffer.from((0, _sdk.stripAnsi)(result.stderr.join("")), "utf8")
|
|
325
|
-
}, testUuid);
|
|
344
|
+
this.allureRuntime.writeAttachment(testUuid, undefined, "stderr", Buffer.from((0, _sdk.stripAnsi)(result.stderr.join("")), "utf-8"), {
|
|
345
|
+
contentType: _allureJsCommons.ContentType.TEXT
|
|
346
|
+
});
|
|
326
347
|
}
|
|
327
348
|
|
|
328
349
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
329
350
|
// in next iterations we need to implement the logic for every javascript integration
|
|
330
|
-
this.allureRuntime.updateTest(function (testResult) {
|
|
351
|
+
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
331
352
|
var mappedLabels = testResult.labels.reduce(function (acc, label) {
|
|
332
353
|
if (!acc[label.name]) {
|
|
333
354
|
acc[label.name] = [];
|
|
@@ -343,16 +364,16 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
343
364
|
return labelsGroup;
|
|
344
365
|
});
|
|
345
366
|
testResult.labels = newLabels;
|
|
346
|
-
}
|
|
347
|
-
this.allureRuntime.stopTest({
|
|
348
|
-
|
|
367
|
+
});
|
|
368
|
+
this.allureRuntime.stopTest(testUuid, {
|
|
369
|
+
duration: result.duration
|
|
349
370
|
});
|
|
350
371
|
this.allureRuntime.writeTest(testUuid);
|
|
351
|
-
case
|
|
372
|
+
case 21:
|
|
352
373
|
case "end":
|
|
353
374
|
return _context.stop();
|
|
354
375
|
}
|
|
355
|
-
}, _callee, this
|
|
376
|
+
}, _callee, this);
|
|
356
377
|
}));
|
|
357
378
|
function onTestEnd(_x, _x2) {
|
|
358
379
|
return _onTestEnd.apply(this, arguments);
|
|
@@ -364,24 +385,24 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
364
385
|
value: function () {
|
|
365
386
|
var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
366
387
|
var _this2 = this;
|
|
367
|
-
var unprocessedCases,
|
|
388
|
+
var unprocessedCases, _iterator, _step, testCase;
|
|
368
389
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
369
390
|
while (1) switch (_context2.prev = _context2.next) {
|
|
370
391
|
case 0:
|
|
371
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
372
|
-
var title =
|
|
392
|
+
unprocessedCases = this.suite.allTests().filter(function (_ref2) {
|
|
393
|
+
var title = _ref2.title;
|
|
373
394
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
374
395
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
375
396
|
});
|
|
376
|
-
|
|
397
|
+
_iterator = _createForOfIteratorHelper(unprocessedCases);
|
|
377
398
|
_context2.prev = 2;
|
|
378
|
-
|
|
399
|
+
_iterator.s();
|
|
379
400
|
case 4:
|
|
380
|
-
if ((
|
|
401
|
+
if ((_step = _iterator.n()).done) {
|
|
381
402
|
_context2.next = 11;
|
|
382
403
|
break;
|
|
383
404
|
}
|
|
384
|
-
testCase =
|
|
405
|
+
testCase = _step.value;
|
|
385
406
|
this.onTestBegin(testCase);
|
|
386
407
|
_context2.next = 9;
|
|
387
408
|
return this.onTestEnd(testCase, {
|
|
@@ -406,10 +427,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
406
427
|
case 13:
|
|
407
428
|
_context2.prev = 13;
|
|
408
429
|
_context2.t0 = _context2["catch"](2);
|
|
409
|
-
|
|
430
|
+
_iterator.e(_context2.t0);
|
|
410
431
|
case 16:
|
|
411
432
|
_context2.prev = 16;
|
|
412
|
-
|
|
433
|
+
_iterator.f();
|
|
413
434
|
return _context2.finish(16);
|
|
414
435
|
case 19:
|
|
415
436
|
case "end":
|
|
@@ -453,102 +474,104 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
453
474
|
}, {
|
|
454
475
|
key: "processAttachment",
|
|
455
476
|
value: function () {
|
|
456
|
-
var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(
|
|
457
|
-
var
|
|
477
|
+
var _processAttachment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(testUuid, attachmentStepUuid, attachment) {
|
|
478
|
+
var allureRuntimeMessage, message, parentUuid, pathWithoutEnd, actualBase64, expectedBase64, diffBase64, diffName;
|
|
458
479
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
459
480
|
while (1) switch (_context4.prev = _context4.next) {
|
|
460
481
|
case 0:
|
|
461
|
-
testUuid = this.allureResultsUuids.get(testId);
|
|
462
482
|
if (!(!attachment.body && !attachment.path)) {
|
|
463
|
-
_context4.next =
|
|
483
|
+
_context4.next = 2;
|
|
464
484
|
break;
|
|
465
485
|
}
|
|
466
486
|
return _context4.abrupt("return");
|
|
467
|
-
case
|
|
487
|
+
case 2:
|
|
468
488
|
allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
469
489
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
470
|
-
_context4.next =
|
|
490
|
+
_context4.next = 5;
|
|
471
491
|
break;
|
|
472
492
|
}
|
|
473
493
|
return _context4.abrupt("return");
|
|
474
|
-
case
|
|
494
|
+
case 5:
|
|
475
495
|
if (!allureRuntimeMessage) {
|
|
476
|
-
_context4.next =
|
|
496
|
+
_context4.next = 9;
|
|
477
497
|
break;
|
|
478
498
|
}
|
|
479
|
-
message = JSON.parse(attachment.body.toString()); // TODO
|
|
480
|
-
this.allureRuntime.applyRuntimeMessages([message]
|
|
481
|
-
testUuid: testUuid
|
|
482
|
-
});
|
|
499
|
+
message = JSON.parse(attachment.body.toString()); // TODO fix step metadata messages
|
|
500
|
+
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
483
501
|
return _context4.abrupt("return");
|
|
484
|
-
case
|
|
502
|
+
case 9:
|
|
503
|
+
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
504
|
+
name: attachment.name
|
|
505
|
+
}); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
|
|
506
|
+
// usually, missing test by uuid means we should completely skip result processing;
|
|
507
|
+
// the later operations are safe and will only produce console warnings
|
|
508
|
+
if (parentUuid) {
|
|
509
|
+
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
510
|
+
}
|
|
485
511
|
if (!attachment.body) {
|
|
486
|
-
_context4.next =
|
|
512
|
+
_context4.next = 15;
|
|
487
513
|
break;
|
|
488
514
|
}
|
|
489
|
-
this.allureRuntime.writeAttachment({
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}, testUuid);
|
|
494
|
-
_context4.next = 19;
|
|
515
|
+
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
516
|
+
contentType: attachment.contentType
|
|
517
|
+
});
|
|
518
|
+
_context4.next = 20;
|
|
495
519
|
break;
|
|
496
|
-
case
|
|
520
|
+
case 15:
|
|
497
521
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
498
|
-
_context4.next =
|
|
522
|
+
_context4.next = 19;
|
|
499
523
|
break;
|
|
500
524
|
}
|
|
501
525
|
return _context4.abrupt("return");
|
|
502
|
-
case 18:
|
|
503
|
-
this.allureRuntime.writeAttachmentFromPath(attachment.name, attachment.path, {
|
|
504
|
-
contentType: attachment.contentType
|
|
505
|
-
}, testUuid);
|
|
506
526
|
case 19:
|
|
527
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
528
|
+
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
529
|
+
contentType: attachment.contentType
|
|
530
|
+
});
|
|
531
|
+
case 20:
|
|
507
532
|
if (attachment.name.match(diffEndRegexp)) {
|
|
508
|
-
_context4.next =
|
|
533
|
+
_context4.next = 22;
|
|
509
534
|
break;
|
|
510
535
|
}
|
|
511
536
|
return _context4.abrupt("return");
|
|
512
|
-
case
|
|
537
|
+
case 22:
|
|
513
538
|
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
|
|
514
539
|
if (!this.processedDiffs.includes(pathWithoutEnd)) {
|
|
515
|
-
_context4.next =
|
|
540
|
+
_context4.next = 25;
|
|
516
541
|
break;
|
|
517
542
|
}
|
|
518
543
|
return _context4.abrupt("return");
|
|
519
|
-
case
|
|
520
|
-
_context4.next =
|
|
544
|
+
case 25:
|
|
545
|
+
_context4.next = 27;
|
|
521
546
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-actual.png"));
|
|
522
|
-
case
|
|
547
|
+
case 27:
|
|
523
548
|
actualBase64 = _context4.sent;
|
|
524
|
-
_context4.next =
|
|
549
|
+
_context4.next = 30;
|
|
525
550
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-expected.png"));
|
|
526
|
-
case
|
|
551
|
+
case 30:
|
|
527
552
|
expectedBase64 = _context4.sent;
|
|
528
|
-
_context4.next =
|
|
553
|
+
_context4.next = 33;
|
|
529
554
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-diff.png"));
|
|
530
|
-
case
|
|
555
|
+
case 33:
|
|
531
556
|
diffBase64 = _context4.sent;
|
|
532
557
|
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
533
|
-
this.allureRuntime.writeAttachment({
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
name: diffName
|
|
540
|
-
}),
|
|
558
|
+
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
559
|
+
expected: expectedBase64,
|
|
560
|
+
actual: actualBase64,
|
|
561
|
+
diff: diffBase64,
|
|
562
|
+
name: diffName
|
|
563
|
+
}), "utf-8"), {
|
|
541
564
|
contentType: _allureJsCommons.ContentType.IMAGEDIFF,
|
|
542
565
|
fileExtension: ".imagediff"
|
|
543
|
-
}
|
|
566
|
+
});
|
|
544
567
|
this.processedDiffs.push(pathWithoutEnd);
|
|
545
|
-
case
|
|
568
|
+
case 37:
|
|
546
569
|
case "end":
|
|
547
570
|
return _context4.stop();
|
|
548
571
|
}
|
|
549
572
|
}, _callee4, this);
|
|
550
573
|
}));
|
|
551
|
-
function processAttachment(_x3, _x4) {
|
|
574
|
+
function processAttachment(_x3, _x4, _x5) {
|
|
552
575
|
return _processAttachment.apply(this, arguments);
|
|
553
576
|
}
|
|
554
577
|
return processAttachment;
|