allure-playwright 3.11.1 → 3.12.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 +2 -1
- package/dist/cjs/index.js +304 -317
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/esm/index.js +305 -318
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/model.d.ts +3 -1
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -18,7 +19,6 @@ Object.defineProperty(exports, "test", {
|
|
|
18
19
|
});
|
|
19
20
|
var _nodeFs = require("node:fs");
|
|
20
21
|
var _promises = require("node:fs/promises");
|
|
21
|
-
var _nodeModule = require("node:module");
|
|
22
22
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
23
23
|
var _nodeProcess = _interopRequireDefault(require("node:process"));
|
|
24
24
|
var _allureJsCommons = require("allure-js-commons");
|
|
@@ -31,18 +31,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
31
31
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
32
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."); }
|
|
33
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
|
-
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
|
-
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
|
-
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; } } }; }
|
|
39
34
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
40
35
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
42
36
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
43
37
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
38
|
+
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 }; })(); }
|
|
39
|
+
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); }
|
|
40
|
+
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; } } }; }
|
|
41
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
44
42
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
45
|
-
function
|
|
43
|
+
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); }
|
|
44
|
+
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); }); }; }
|
|
46
45
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
47
46
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
48
47
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -54,9 +53,6 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
54
53
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
55
54
|
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); }
|
|
56
55
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /* eslint max-lines: off */
|
|
57
|
-
var localRequire = typeof require === "function" ? require : (0, _nodeModule.createRequire)(require('url').pathToFileURL(__filename).toString());
|
|
58
|
-
var testPlanFilterSymbol = Symbol["for"]("allure-playwright.testPlanFilter");
|
|
59
|
-
var testPlanFilterPatchSymbol = Symbol["for"]("allure-playwright.testPlanFilterPatch");
|
|
60
56
|
var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
|
|
61
57
|
var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
62
58
|
function AllureReporter(config) {
|
|
@@ -78,6 +74,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
78
74
|
_defineProperty(this, "pendingAttachmentTasks", new Map());
|
|
79
75
|
_defineProperty(this, "attachmentTargetByStep", new WeakMap());
|
|
80
76
|
_defineProperty(this, "pwStepUuid", new WeakMap());
|
|
77
|
+
_defineProperty(this, "testFullNames", new WeakMap());
|
|
81
78
|
_defineProperty(this, "emittedHookGlobalErrorKeys", new Set());
|
|
82
79
|
_defineProperty(this, "testPlan", (0, _reporter.parseTestPlan)());
|
|
83
80
|
this.options = _objectSpread({
|
|
@@ -86,74 +83,116 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
86
83
|
}, config);
|
|
87
84
|
}
|
|
88
85
|
return _createClass(AllureReporter, [{
|
|
86
|
+
key: "preprocess",
|
|
87
|
+
value: function () {
|
|
88
|
+
var _preprocess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
89
|
+
var suite, testRun, readonlyProjectNames, _iterator, _step, projectSuite, project, _iterator2, _step2, _projectSuite, _project, readonlyProject, _iterator3, _step3, test, metadata, _t, _t2;
|
|
90
|
+
return _regenerator().w(function (_context) {
|
|
91
|
+
while (1) switch (_context.n) {
|
|
92
|
+
case 0:
|
|
93
|
+
suite = _ref.suite, testRun = _ref.testRun;
|
|
94
|
+
if (this.testPlan) {
|
|
95
|
+
_context.n = 1;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
return _context.a(2);
|
|
99
|
+
case 1:
|
|
100
|
+
readonlyProjectNames = new Set();
|
|
101
|
+
_iterator = _createForOfIteratorHelper(suite.suites);
|
|
102
|
+
try {
|
|
103
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
104
|
+
projectSuite = _step.value;
|
|
105
|
+
project = projectSuite.project();
|
|
106
|
+
project === null || project === void 0 || project.dependencies.forEach(function (dependency) {
|
|
107
|
+
return readonlyProjectNames.add(dependency);
|
|
108
|
+
});
|
|
109
|
+
if (project !== null && project !== void 0 && project.teardown) {
|
|
110
|
+
readonlyProjectNames.add(project.teardown);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} catch (err) {
|
|
114
|
+
_iterator.e(err);
|
|
115
|
+
} finally {
|
|
116
|
+
_iterator.f();
|
|
117
|
+
}
|
|
118
|
+
_iterator2 = _createForOfIteratorHelper(suite.suites);
|
|
119
|
+
_context.p = 2;
|
|
120
|
+
_iterator2.s();
|
|
121
|
+
case 3:
|
|
122
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
123
|
+
_context.n = 13;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
_projectSuite = _step2.value;
|
|
127
|
+
_project = _projectSuite.project();
|
|
128
|
+
readonlyProject = _project ? readonlyProjectNames.has(_project.name) : false;
|
|
129
|
+
if (!readonlyProject) {
|
|
130
|
+
_context.n = 4;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return _context.a(3, 12);
|
|
134
|
+
case 4:
|
|
135
|
+
_iterator3 = _createForOfIteratorHelper(_projectSuite.allTests());
|
|
136
|
+
_context.p = 5;
|
|
137
|
+
_iterator3.s();
|
|
138
|
+
case 6:
|
|
139
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
140
|
+
_context.n = 9;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
test = _step3.value;
|
|
144
|
+
metadata = this.getStaticTestMetadata(test);
|
|
145
|
+
if (!this.isInTestPlan(test, metadata)) {
|
|
146
|
+
_context.n = 7;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
return _context.a(3, 8);
|
|
150
|
+
case 7:
|
|
151
|
+
testRun.exclude(test);
|
|
152
|
+
case 8:
|
|
153
|
+
_context.n = 6;
|
|
154
|
+
break;
|
|
155
|
+
case 9:
|
|
156
|
+
_context.n = 11;
|
|
157
|
+
break;
|
|
158
|
+
case 10:
|
|
159
|
+
_context.p = 10;
|
|
160
|
+
_t = _context.v;
|
|
161
|
+
_iterator3.e(_t);
|
|
162
|
+
case 11:
|
|
163
|
+
_context.p = 11;
|
|
164
|
+
_iterator3.f();
|
|
165
|
+
return _context.f(11);
|
|
166
|
+
case 12:
|
|
167
|
+
_context.n = 3;
|
|
168
|
+
break;
|
|
169
|
+
case 13:
|
|
170
|
+
_context.n = 15;
|
|
171
|
+
break;
|
|
172
|
+
case 14:
|
|
173
|
+
_context.p = 14;
|
|
174
|
+
_t2 = _context.v;
|
|
175
|
+
_iterator2.e(_t2);
|
|
176
|
+
case 15:
|
|
177
|
+
_context.p = 15;
|
|
178
|
+
_iterator2.f();
|
|
179
|
+
return _context.f(15);
|
|
180
|
+
case 16:
|
|
181
|
+
return _context.a(2);
|
|
182
|
+
}
|
|
183
|
+
}, _callee, this, [[5, 10, 11, 12], [2, 14, 15, 16]]);
|
|
184
|
+
}));
|
|
185
|
+
function preprocess(_x) {
|
|
186
|
+
return _preprocess.apply(this, arguments);
|
|
187
|
+
}
|
|
188
|
+
return preprocess;
|
|
189
|
+
}()
|
|
190
|
+
}, {
|
|
89
191
|
key: "onConfigure",
|
|
90
192
|
value: function onConfigure(config) {
|
|
91
|
-
var _configElement$preOnl,
|
|
92
|
-
_this = this;
|
|
93
193
|
this.config = config;
|
|
94
194
|
this.outputDir = config.projects[0].outputDir;
|
|
95
195
|
this.snapshotDir = config.projects[0].snapshotDir;
|
|
96
|
-
var testPlan = this.testPlan;
|
|
97
|
-
if (!testPlan) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this.installTestPlanExecutionFilter();
|
|
101
|
-
var configElement = Object.getOwnPropertySymbols(config).map(function (symbol) {
|
|
102
|
-
return config[symbol];
|
|
103
|
-
}).find(function (value) {
|
|
104
|
-
return _typeof(value) === "object" && value !== null && ("preOnlyTestFilters" in value || "cliArgs" in value);
|
|
105
|
-
});
|
|
106
|
-
configElement === null || configElement === void 0 || (_configElement$preOnl = configElement.preOnlyTestFilters) === null || _configElement$preOnl === void 0 || _configElement$preOnl.push(function (test) {
|
|
107
|
-
return _this.isInTestPlan(test);
|
|
108
|
-
});
|
|
109
|
-
if (testPlan.tests.some(function (test) {
|
|
110
|
-
return test.id !== undefined;
|
|
111
|
-
})) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
var testsWithSelectors = testPlan.tests.filter(function (test) {
|
|
115
|
-
return test.selector;
|
|
116
|
-
});
|
|
117
|
-
var v1ReporterTests = [];
|
|
118
|
-
var v2ReporterTests = [];
|
|
119
|
-
var cliArgs = [];
|
|
120
|
-
testsWithSelectors.forEach(function (test) {
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
122
|
-
if (!/#/.test(test.selector)) {
|
|
123
|
-
v2ReporterTests.push(test);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
v1ReporterTests.push(test);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// The path needs to be specific to the current OS. Otherwise, it may not match against the test file.
|
|
130
|
-
var selectorToGrepPattern = function selectorToGrepPattern(selector) {
|
|
131
|
-
return (0, _reporter.escapeRegExp)(_nodePath["default"].normalize("/".concat(selector)));
|
|
132
|
-
};
|
|
133
|
-
if (v2ReporterTests.length) {
|
|
134
|
-
// we need to cut off column because playwright works only with line number
|
|
135
|
-
var v2SelectorsArgs = v2ReporterTests
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
137
|
-
.map(function (test) {
|
|
138
|
-
return test.selector.replace(/:\d+$/, "");
|
|
139
|
-
}).map(selectorToGrepPattern);
|
|
140
|
-
cliArgs.push.apply(cliArgs, _toConsumableArray(v2SelectorsArgs));
|
|
141
|
-
}
|
|
142
|
-
if (v1ReporterTests.length) {
|
|
143
|
-
var v1SelectorsArgs = v1ReporterTests
|
|
144
|
-
// we can filter tests only by absolute path, so we need to cut off test name
|
|
145
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
146
|
-
.map(function (test) {
|
|
147
|
-
return test.selector.split("#")[0];
|
|
148
|
-
}).map(selectorToGrepPattern);
|
|
149
|
-
cliArgs.push.apply(cliArgs, _toConsumableArray(v1SelectorsArgs));
|
|
150
|
-
}
|
|
151
|
-
if (!cliArgs.length) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
if (configElement) {
|
|
155
|
-
configElement.cliArgs = cliArgs;
|
|
156
|
-
}
|
|
157
196
|
}
|
|
158
197
|
}, {
|
|
159
198
|
key: "onError",
|
|
@@ -205,21 +244,21 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
205
244
|
|
|
206
245
|
// support for earlier playwright versions
|
|
207
246
|
if ("tags" in test) {
|
|
208
|
-
var
|
|
247
|
+
var _ref2;
|
|
209
248
|
var tags = test.tags.map(function (tag) {
|
|
210
249
|
return {
|
|
211
250
|
name: _allureJsCommons.LabelName.TAG,
|
|
212
251
|
value: tag.startsWith("@") ? tag.substring(1) : tag
|
|
213
252
|
};
|
|
214
253
|
});
|
|
215
|
-
(
|
|
254
|
+
(_ref2 = result.labels).push.apply(_ref2, _toConsumableArray(tags));
|
|
216
255
|
}
|
|
217
256
|
if ("annotations" in test) {
|
|
218
|
-
var
|
|
219
|
-
|
|
257
|
+
var _iterator4 = _createForOfIteratorHelper(test.annotations),
|
|
258
|
+
_step4;
|
|
220
259
|
try {
|
|
221
|
-
for (
|
|
222
|
-
var annotation =
|
|
260
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
261
|
+
var annotation = _step4.value;
|
|
223
262
|
if (annotation.type === "skip" || annotation.type === "fixme") {
|
|
224
263
|
continue;
|
|
225
264
|
}
|
|
@@ -259,9 +298,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
259
298
|
});
|
|
260
299
|
}
|
|
261
300
|
} catch (err) {
|
|
262
|
-
|
|
301
|
+
_iterator4.e(err);
|
|
263
302
|
} finally {
|
|
264
|
-
|
|
303
|
+
_iterator4.f();
|
|
265
304
|
}
|
|
266
305
|
}
|
|
267
306
|
if ((_metadata$project = metadata.project) !== null && _metadata$project !== void 0 && _metadata$project.name) {
|
|
@@ -291,26 +330,26 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
291
330
|
}, {
|
|
292
331
|
key: "flushAttachmentTasks",
|
|
293
332
|
value: function () {
|
|
294
|
-
var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
333
|
+
var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(testId) {
|
|
295
334
|
var _this$pendingAttachme2;
|
|
296
335
|
var tasks;
|
|
297
|
-
return _regenerator().w(function (
|
|
298
|
-
while (1) switch (
|
|
336
|
+
return _regenerator().w(function (_context2) {
|
|
337
|
+
while (1) switch (_context2.n) {
|
|
299
338
|
case 0:
|
|
300
339
|
tasks = (_this$pendingAttachme2 = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme2 !== void 0 ? _this$pendingAttachme2 : [];
|
|
301
340
|
this.pendingAttachmentTasks["delete"](testId);
|
|
302
341
|
if (!(tasks.length > 0)) {
|
|
303
|
-
|
|
342
|
+
_context2.n = 1;
|
|
304
343
|
break;
|
|
305
344
|
}
|
|
306
|
-
|
|
345
|
+
_context2.n = 1;
|
|
307
346
|
return Promise.all(tasks);
|
|
308
347
|
case 1:
|
|
309
|
-
return
|
|
348
|
+
return _context2.a(2);
|
|
310
349
|
}
|
|
311
|
-
},
|
|
350
|
+
}, _callee2, this);
|
|
312
351
|
}));
|
|
313
|
-
function flushAttachmentTasks(
|
|
352
|
+
function flushAttachmentTasks(_x2) {
|
|
314
353
|
return _flushAttachmentTasks.apply(this, arguments);
|
|
315
354
|
}
|
|
316
355
|
return flushAttachmentTasks;
|
|
@@ -338,19 +377,19 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
338
377
|
steps.splice(index, 1);
|
|
339
378
|
return true;
|
|
340
379
|
}
|
|
341
|
-
var
|
|
342
|
-
|
|
380
|
+
var _iterator5 = _createForOfIteratorHelper(steps),
|
|
381
|
+
_step5;
|
|
343
382
|
try {
|
|
344
|
-
for (
|
|
345
|
-
var step =
|
|
383
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
384
|
+
var step = _step5.value;
|
|
346
385
|
if (this.removeHookAttachmentPlaceholder(step.steps, stepUuid)) {
|
|
347
386
|
return true;
|
|
348
387
|
}
|
|
349
388
|
}
|
|
350
389
|
} catch (err) {
|
|
351
|
-
|
|
390
|
+
_iterator5.e(err);
|
|
352
391
|
} finally {
|
|
353
|
-
|
|
392
|
+
_iterator5.f();
|
|
354
393
|
}
|
|
355
394
|
return false;
|
|
356
395
|
}
|
|
@@ -375,13 +414,13 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
375
414
|
}, {
|
|
376
415
|
key: "addRuntimeAttachmentToHookStack",
|
|
377
416
|
value: function addRuntimeAttachmentToHookStack(targetStack, attachment, options) {
|
|
378
|
-
var
|
|
417
|
+
var _this = this;
|
|
379
418
|
var currentStep = targetStack.currentStep();
|
|
380
419
|
if (!currentStep) {
|
|
381
420
|
return;
|
|
382
421
|
}
|
|
383
422
|
var addAttachment = function addAttachment(stepResult) {
|
|
384
|
-
var fileName = targetStack.addAttachment(attachment,
|
|
423
|
+
var fileName = targetStack.addAttachment(attachment, _this.allureRuntime.writer);
|
|
385
424
|
stepResult.attachments.push({
|
|
386
425
|
name: attachment.name,
|
|
387
426
|
type: attachment.contentType,
|
|
@@ -499,12 +538,12 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
499
538
|
}
|
|
500
539
|
return;
|
|
501
540
|
}
|
|
502
|
-
var
|
|
503
|
-
|
|
541
|
+
var _iterator6 = _createForOfIteratorHelper(stepAttachments),
|
|
542
|
+
_step6;
|
|
504
543
|
try {
|
|
505
|
-
for (
|
|
544
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
506
545
|
var _stepInfo$hookStep$uu, _stepInfo$hookStep;
|
|
507
|
-
var attachment =
|
|
546
|
+
var attachment = _step6.value;
|
|
508
547
|
var isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
509
548
|
var attachmentTarget = _objectSpread(_objectSpread({}, stepInfo), {}, {
|
|
510
549
|
name: attachment.name
|
|
@@ -528,9 +567,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
528
567
|
this.queueAttachmentTask(test.id, this.processAttachment(testUuid, attachmentStepUuid, attachment));
|
|
529
568
|
}
|
|
530
569
|
} catch (err) {
|
|
531
|
-
|
|
570
|
+
_iterator6.e(err);
|
|
532
571
|
} finally {
|
|
533
|
-
|
|
572
|
+
_iterator6.f();
|
|
534
573
|
}
|
|
535
574
|
}
|
|
536
575
|
}, {
|
|
@@ -688,21 +727,21 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
688
727
|
}, {
|
|
689
728
|
key: "onTestEnd",
|
|
690
729
|
value: function () {
|
|
691
|
-
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
692
|
-
var
|
|
730
|
+
var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(test, result) {
|
|
731
|
+
var _this2 = this,
|
|
693
732
|
_this$attachmentTarge2;
|
|
694
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName,
|
|
695
|
-
return _regenerator().w(function (
|
|
696
|
-
while (1) switch (
|
|
733
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator7, _step7, _targetsByName$get, t, q, takeByName, _iterator8, _step8, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu2, _stepInfo$hookStep2, message, targetStack, _targetStack, stepUuid, _targetStack2, stepResult, fileName, _t3;
|
|
734
|
+
return _regenerator().w(function (_context3) {
|
|
735
|
+
while (1) switch (_context3.n) {
|
|
697
736
|
case 0:
|
|
698
737
|
testUuid = this.allureResultsUuids.get(test.id);
|
|
699
738
|
if (testUuid) {
|
|
700
|
-
|
|
739
|
+
_context3.n = 1;
|
|
701
740
|
break;
|
|
702
741
|
}
|
|
703
742
|
// eslint-disable-next-line no-console
|
|
704
743
|
console.warn("[allure-playwright] Ignoring onTestEnd for \"".concat(test.title, "\" because no Allure test result has been started."));
|
|
705
|
-
return
|
|
744
|
+
return _context3.a(2);
|
|
706
745
|
case 1:
|
|
707
746
|
// We need to check parallelIndex first because pw introduced this field only in v1.30.0
|
|
708
747
|
threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
|
|
@@ -720,7 +759,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
720
759
|
value: projectSuiteTitle
|
|
721
760
|
});
|
|
722
761
|
}
|
|
723
|
-
if (
|
|
762
|
+
if (_this2.options.suiteTitle && fileSuiteTitle && !(0, _sdk.hasLabel)(testResult, _allureJsCommons.LabelName.SUITE)) {
|
|
724
763
|
testResult.labels.push({
|
|
725
764
|
name: _allureJsCommons.LabelName.SUITE,
|
|
726
765
|
value: fileSuiteTitle
|
|
@@ -769,18 +808,18 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
769
808
|
// FIFO
|
|
770
809
|
targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
|
|
771
810
|
targetsByName = new Map();
|
|
772
|
-
|
|
811
|
+
_iterator7 = _createForOfIteratorHelper(targets);
|
|
773
812
|
try {
|
|
774
|
-
for (
|
|
775
|
-
t =
|
|
813
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
814
|
+
t = _step7.value;
|
|
776
815
|
q = (_targetsByName$get = targetsByName.get(t.name)) !== null && _targetsByName$get !== void 0 ? _targetsByName$get : [];
|
|
777
816
|
q.push(t);
|
|
778
817
|
targetsByName.set(t.name, q);
|
|
779
818
|
}
|
|
780
819
|
} catch (err) {
|
|
781
|
-
|
|
820
|
+
_iterator7.e(err);
|
|
782
821
|
} finally {
|
|
783
|
-
|
|
822
|
+
_iterator7.f();
|
|
784
823
|
}
|
|
785
824
|
takeByName = function takeByName(name) {
|
|
786
825
|
var target = targetsByName.get(name);
|
|
@@ -789,25 +828,25 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
789
828
|
}
|
|
790
829
|
return target.shift();
|
|
791
830
|
};
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
831
|
+
_iterator8 = _createForOfIteratorHelper(result.attachments);
|
|
832
|
+
_context3.p = 2;
|
|
833
|
+
_iterator8.s();
|
|
795
834
|
case 3:
|
|
796
|
-
if ((
|
|
797
|
-
|
|
835
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
836
|
+
_context3.n = 12;
|
|
798
837
|
break;
|
|
799
838
|
}
|
|
800
|
-
attachment =
|
|
839
|
+
attachment = _step8.value;
|
|
801
840
|
isRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
802
841
|
stepInfo = takeByName(attachment.name);
|
|
803
842
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
|
|
804
|
-
|
|
843
|
+
_context3.n = 4;
|
|
805
844
|
break;
|
|
806
845
|
}
|
|
807
|
-
return
|
|
846
|
+
return _context3.a(3, 11);
|
|
808
847
|
case 4:
|
|
809
848
|
if (!isRuntimeMessage) {
|
|
810
|
-
|
|
849
|
+
_context3.n = 7;
|
|
811
850
|
break;
|
|
812
851
|
}
|
|
813
852
|
message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
|
|
@@ -816,7 +855,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
816
855
|
this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
|
|
817
856
|
}
|
|
818
857
|
if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
819
|
-
|
|
858
|
+
_context3.n = 5;
|
|
820
859
|
break;
|
|
821
860
|
}
|
|
822
861
|
if (stepInfo.hookStep) {
|
|
@@ -825,16 +864,16 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
825
864
|
} else {
|
|
826
865
|
this.processStepMetadataMessage(stepInfo.stepUuid, message);
|
|
827
866
|
}
|
|
828
|
-
return
|
|
867
|
+
return _context3.a(3, 11);
|
|
829
868
|
case 5:
|
|
830
869
|
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;
|
|
831
|
-
|
|
870
|
+
_context3.n = 6;
|
|
832
871
|
return this.processAttachment(testUuid, stepUuid, attachment);
|
|
833
872
|
case 6:
|
|
834
|
-
return
|
|
873
|
+
return _context3.a(3, 11);
|
|
835
874
|
case 7:
|
|
836
875
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
|
|
837
|
-
|
|
876
|
+
_context3.n = 8;
|
|
838
877
|
break;
|
|
839
878
|
}
|
|
840
879
|
_targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
|
|
@@ -849,35 +888,35 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
849
888
|
});
|
|
850
889
|
}
|
|
851
890
|
}
|
|
852
|
-
return
|
|
891
|
+
return _context3.a(3, 11);
|
|
853
892
|
case 8:
|
|
854
893
|
if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
|
|
855
|
-
|
|
894
|
+
_context3.n = 10;
|
|
856
895
|
break;
|
|
857
896
|
}
|
|
858
|
-
|
|
897
|
+
_context3.n = 9;
|
|
859
898
|
return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
|
|
860
899
|
case 9:
|
|
861
|
-
return
|
|
900
|
+
return _context3.a(3, 11);
|
|
862
901
|
case 10:
|
|
863
|
-
|
|
902
|
+
_context3.n = 11;
|
|
864
903
|
return this.processAttachment(testUuid, undefined, attachment);
|
|
865
904
|
case 11:
|
|
866
|
-
|
|
905
|
+
_context3.n = 3;
|
|
867
906
|
break;
|
|
868
907
|
case 12:
|
|
869
|
-
|
|
908
|
+
_context3.n = 14;
|
|
870
909
|
break;
|
|
871
910
|
case 13:
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
911
|
+
_context3.p = 13;
|
|
912
|
+
_t3 = _context3.v;
|
|
913
|
+
_iterator8.e(_t3);
|
|
875
914
|
case 14:
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
return
|
|
915
|
+
_context3.p = 14;
|
|
916
|
+
_iterator8.f();
|
|
917
|
+
return _context3.f(14);
|
|
879
918
|
case 15:
|
|
880
|
-
|
|
919
|
+
_context3.n = 16;
|
|
881
920
|
return this.flushAttachmentTasks(test.id);
|
|
882
921
|
case 16:
|
|
883
922
|
// FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
|
|
@@ -899,14 +938,14 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
899
938
|
});
|
|
900
939
|
if (beforeHooksStack) {
|
|
901
940
|
var _testResult$steps;
|
|
902
|
-
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(
|
|
941
|
+
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this2.pruneEmptyHookRoots(beforeHooksStack.steps)));
|
|
903
942
|
}
|
|
904
|
-
|
|
943
|
+
_this2.beforeHooksStepsStack["delete"](test.id);
|
|
905
944
|
if (afterHooksStack) {
|
|
906
945
|
var _testResult$steps2;
|
|
907
|
-
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(
|
|
946
|
+
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this2.pruneEmptyHookRoots(afterHooksStack.steps)));
|
|
908
947
|
}
|
|
909
|
-
|
|
948
|
+
_this2.afterHooksStepsStack["delete"](test.id);
|
|
910
949
|
testResult.labels = newLabels;
|
|
911
950
|
});
|
|
912
951
|
this.allureRuntime.stopTest(testUuid, {
|
|
@@ -916,11 +955,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
916
955
|
this.attachmentTargets["delete"](test.id);
|
|
917
956
|
this.pendingAttachmentTasks["delete"](test.id);
|
|
918
957
|
case 17:
|
|
919
|
-
return
|
|
958
|
+
return _context3.a(2);
|
|
920
959
|
}
|
|
921
|
-
},
|
|
960
|
+
}, _callee3, this, [[2, 13, 14, 15]]);
|
|
922
961
|
}));
|
|
923
|
-
function onTestEnd(
|
|
962
|
+
function onTestEnd(_x3, _x4) {
|
|
924
963
|
return _onTestEnd.apply(this, arguments);
|
|
925
964
|
}
|
|
926
965
|
return onTestEnd;
|
|
@@ -943,28 +982,28 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
943
982
|
}, {
|
|
944
983
|
key: "addSkippedResults",
|
|
945
984
|
value: function () {
|
|
946
|
-
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
947
|
-
var
|
|
948
|
-
var unprocessedCases,
|
|
949
|
-
return _regenerator().w(function (
|
|
950
|
-
while (1) switch (
|
|
985
|
+
var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
986
|
+
var _this3 = this;
|
|
987
|
+
var unprocessedCases, _iterator9, _step9, testCase, _t4;
|
|
988
|
+
return _regenerator().w(function (_context4) {
|
|
989
|
+
while (1) switch (_context4.n) {
|
|
951
990
|
case 0:
|
|
952
991
|
unprocessedCases = this.suite.allTests().filter(function (testCase) {
|
|
953
992
|
var title = testCase.title;
|
|
954
993
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
955
|
-
return !
|
|
994
|
+
return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
956
995
|
});
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
996
|
+
_iterator9 = _createForOfIteratorHelper(unprocessedCases);
|
|
997
|
+
_context4.p = 1;
|
|
998
|
+
_iterator9.s();
|
|
960
999
|
case 2:
|
|
961
|
-
if ((
|
|
962
|
-
|
|
1000
|
+
if ((_step9 = _iterator9.n()).done) {
|
|
1001
|
+
_context4.n = 4;
|
|
963
1002
|
break;
|
|
964
1003
|
}
|
|
965
|
-
testCase =
|
|
1004
|
+
testCase = _step9.value;
|
|
966
1005
|
this.onTestBegin(testCase);
|
|
967
|
-
|
|
1006
|
+
_context4.n = 3;
|
|
968
1007
|
return this.onTestEnd(testCase, {
|
|
969
1008
|
status: _allureJsCommons.Status.SKIPPED,
|
|
970
1009
|
attachments: [],
|
|
@@ -980,23 +1019,23 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
980
1019
|
annotations: []
|
|
981
1020
|
});
|
|
982
1021
|
case 3:
|
|
983
|
-
|
|
1022
|
+
_context4.n = 2;
|
|
984
1023
|
break;
|
|
985
1024
|
case 4:
|
|
986
|
-
|
|
1025
|
+
_context4.n = 6;
|
|
987
1026
|
break;
|
|
988
1027
|
case 5:
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1028
|
+
_context4.p = 5;
|
|
1029
|
+
_t4 = _context4.v;
|
|
1030
|
+
_iterator9.e(_t4);
|
|
992
1031
|
case 6:
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
return
|
|
1032
|
+
_context4.p = 6;
|
|
1033
|
+
_iterator9.f();
|
|
1034
|
+
return _context4.f(6);
|
|
996
1035
|
case 7:
|
|
997
|
-
return
|
|
1036
|
+
return _context4.a(2);
|
|
998
1037
|
}
|
|
999
|
-
},
|
|
1038
|
+
}, _callee4, this, [[1, 5, 6, 7]]);
|
|
1000
1039
|
}));
|
|
1001
1040
|
function addSkippedResults() {
|
|
1002
1041
|
return _addSkippedResults.apply(this, arguments);
|
|
@@ -1006,19 +1045,19 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1006
1045
|
}, {
|
|
1007
1046
|
key: "onEnd",
|
|
1008
1047
|
value: function () {
|
|
1009
|
-
var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1010
|
-
return _regenerator().w(function (
|
|
1011
|
-
while (1) switch (
|
|
1048
|
+
var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
1049
|
+
return _regenerator().w(function (_context5) {
|
|
1050
|
+
while (1) switch (_context5.n) {
|
|
1012
1051
|
case 0:
|
|
1013
|
-
|
|
1052
|
+
_context5.n = 1;
|
|
1014
1053
|
return this.addSkippedResults();
|
|
1015
1054
|
case 1:
|
|
1016
1055
|
this.allureRuntime.writeEnvironmentInfo();
|
|
1017
1056
|
this.allureRuntime.writeCategoriesDefinitions();
|
|
1018
1057
|
case 2:
|
|
1019
|
-
return
|
|
1058
|
+
return _context5.a(2);
|
|
1020
1059
|
}
|
|
1021
|
-
},
|
|
1060
|
+
}, _callee5, this);
|
|
1022
1061
|
}));
|
|
1023
1062
|
function onEnd() {
|
|
1024
1063
|
return _onEnd.apply(this, arguments);
|
|
@@ -1041,19 +1080,19 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1041
1080
|
}, {
|
|
1042
1081
|
key: "pruneEmptyHookRoots",
|
|
1043
1082
|
value: function pruneEmptyHookRoots(steps) {
|
|
1044
|
-
var
|
|
1083
|
+
var _this4 = this;
|
|
1045
1084
|
return steps.map(function (step) {
|
|
1046
1085
|
return _objectSpread(_objectSpread({}, step), {}, {
|
|
1047
|
-
steps:
|
|
1086
|
+
steps: _this4.pruneEmptyHookRoots(step.steps)
|
|
1048
1087
|
});
|
|
1049
1088
|
}).filter(function (step) {
|
|
1050
|
-
return !
|
|
1089
|
+
return !_this4.isEmptyPassedHookRoot(step);
|
|
1051
1090
|
});
|
|
1052
1091
|
}
|
|
1053
1092
|
}, {
|
|
1054
1093
|
key: "removeStepFromHookStack",
|
|
1055
1094
|
value: function removeStepFromHookStack(stack, stepUuid) {
|
|
1056
|
-
var
|
|
1095
|
+
var _this5 = this;
|
|
1057
1096
|
if (!stack) {
|
|
1058
1097
|
return;
|
|
1059
1098
|
}
|
|
@@ -1065,49 +1104,46 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1065
1104
|
steps: _removeRecursively(step.steps)
|
|
1066
1105
|
});
|
|
1067
1106
|
}).filter(function (step) {
|
|
1068
|
-
return !
|
|
1107
|
+
return !_this5.isEmptyPassedHookRoot(step);
|
|
1069
1108
|
});
|
|
1070
1109
|
};
|
|
1071
1110
|
stack.steps = _removeRecursively(stack.steps);
|
|
1072
1111
|
}
|
|
1073
1112
|
}, {
|
|
1074
1113
|
key: "getStaticTestMetadata",
|
|
1075
|
-
value: function getStaticTestMetadata(test
|
|
1076
|
-
var
|
|
1114
|
+
value: function getStaticTestMetadata(test) {
|
|
1115
|
+
var _ref3, _test$parent$project, _titleMetadata$labels;
|
|
1077
1116
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(test.title);
|
|
1078
|
-
var
|
|
1079
|
-
var project = (_ref2 = (_testParent$project = testParent === null || testParent === void 0 ? void 0 : testParent.project()) !== null && _testParent$project !== void 0 ? _testParent$project : this.config.projects.find(function (candidate) {
|
|
1117
|
+
var project = (_ref3 = (_test$parent$project = test.parent.project()) !== null && _test$parent$project !== void 0 ? _test$parent$project : this.config.projects.find(function (candidate) {
|
|
1080
1118
|
return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(_nodePath["default"].sep));
|
|
1081
|
-
})) !== null &&
|
|
1119
|
+
})) !== null && _ref3 !== void 0 ? _ref3 : this.config.projects[0];
|
|
1082
1120
|
var testFilePath = _nodePath["default"].relative(project.testDir, test.location.file);
|
|
1083
1121
|
var relativeFileParts = testFilePath.split(_nodePath["default"].sep);
|
|
1084
1122
|
var relativeFile = relativeFileParts.join("/");
|
|
1085
|
-
var
|
|
1086
|
-
var normalizedRelativeFile = _nodePath["default"].normalize(testFilePath);
|
|
1087
|
-
var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
|
|
1088
|
-
var suiteTitles = (_testParent$titlePath = testParent === null || testParent === void 0 ? void 0 : testParent.titlePath().filter(Boolean)) !== null && _testParent$titlePath !== void 0 ? _testParent$titlePath : [];
|
|
1089
|
-
if (project.name && suiteTitles[0] === project.name) {
|
|
1090
|
-
suiteTitles = suiteTitles.slice(1);
|
|
1091
|
-
}
|
|
1092
|
-
if (suiteTitles.length > 0 && fileTitleCandidates.has(_nodePath["default"].normalize(suiteTitles[0]))) {
|
|
1093
|
-
suiteTitles = suiteTitles.slice(1);
|
|
1094
|
-
}
|
|
1123
|
+
var suiteTitles = test.titlePath().slice(3, -1);
|
|
1095
1124
|
var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
|
|
1096
1125
|
var projectRootSearchFrom = _nodePath["default"].dirname(test.location.file);
|
|
1097
1126
|
var projectName = (0, _reporter.getProjectName)(projectRootSearchFrom);
|
|
1098
1127
|
var testCaseIdBase = "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title);
|
|
1099
1128
|
var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
|
|
1129
|
+
var locationFullName = "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column);
|
|
1130
|
+
var fullName = this.testFullNames.get(test);
|
|
1100
1131
|
var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
|
|
1101
1132
|
return label.name === _allureJsCommons.LabelName.ALLURE_ID;
|
|
1102
1133
|
})) === null || _titleMetadata$labels === void 0 ? void 0 : _titleMetadata$labels.value;
|
|
1134
|
+
if (!fullName) {
|
|
1135
|
+
var testFile = _nodePath["default"].relative(this.config.rootDir, test.location.file).split(_nodePath["default"].sep).join("/");
|
|
1136
|
+
fullName = [testFile].concat(_toConsumableArray(test.titlePath().slice(3))).join(" › ");
|
|
1137
|
+
this.testFullNames.set(test, fullName);
|
|
1138
|
+
}
|
|
1103
1139
|
|
|
1104
1140
|
// Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
|
|
1105
1141
|
if (!staticAllureId && "annotations" in test) {
|
|
1106
|
-
var
|
|
1107
|
-
|
|
1142
|
+
var _iterator0 = _createForOfIteratorHelper(test.annotations),
|
|
1143
|
+
_step0;
|
|
1108
1144
|
try {
|
|
1109
|
-
for (
|
|
1110
|
-
var annotation =
|
|
1145
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
1146
|
+
var annotation = _step0.value;
|
|
1111
1147
|
var label = (0, _sdk.getMetadataLabel)(annotation.type, annotation.description);
|
|
1112
1148
|
if ((label === null || label === void 0 ? void 0 : label.name) === _allureJsCommons.LabelName.ALLURE_ID) {
|
|
1113
1149
|
staticAllureId = label.value;
|
|
@@ -1115,9 +1151,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1115
1151
|
}
|
|
1116
1152
|
}
|
|
1117
1153
|
} catch (err) {
|
|
1118
|
-
|
|
1154
|
+
_iterator0.e(err);
|
|
1119
1155
|
} finally {
|
|
1120
|
-
|
|
1156
|
+
_iterator0.f();
|
|
1121
1157
|
}
|
|
1122
1158
|
}
|
|
1123
1159
|
return {
|
|
@@ -1130,81 +1166,32 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1130
1166
|
testCaseIdBase: projectName ? "".concat(projectName, ":").concat(testCaseIdBase) : testCaseIdBase,
|
|
1131
1167
|
legacyTestCaseIdBase: testCaseIdBase,
|
|
1132
1168
|
titleMetadata: titleMetadata,
|
|
1133
|
-
fullName:
|
|
1169
|
+
fullName: fullName,
|
|
1170
|
+
locationFullName: locationFullName,
|
|
1134
1171
|
legacyFullName: legacyFullName,
|
|
1135
1172
|
staticAllureId: staticAllureId
|
|
1136
1173
|
};
|
|
1137
1174
|
}
|
|
1138
1175
|
}, {
|
|
1139
1176
|
key: "isInTestPlan",
|
|
1140
|
-
value: function isInTestPlan(test
|
|
1177
|
+
value: function isInTestPlan(test) {
|
|
1178
|
+
var metadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getStaticTestMetadata(test);
|
|
1141
1179
|
if (!this.testPlan) {
|
|
1142
1180
|
return true;
|
|
1143
1181
|
}
|
|
1144
|
-
var
|
|
1145
|
-
|
|
1146
|
-
legacyFullName =
|
|
1147
|
-
staticAllureId =
|
|
1182
|
+
var fullName = metadata.fullName,
|
|
1183
|
+
locationFullName = metadata.locationFullName,
|
|
1184
|
+
legacyFullName = metadata.legacyFullName,
|
|
1185
|
+
staticAllureId = metadata.staticAllureId;
|
|
1148
1186
|
return (0, _reporter.includedInTestPlan)(this.testPlan, {
|
|
1149
|
-
fullName:
|
|
1187
|
+
fullName: locationFullName,
|
|
1188
|
+
nativeSelector: fullName,
|
|
1150
1189
|
id: staticAllureId
|
|
1151
1190
|
}) || (0, _reporter.includedInTestPlan)(this.testPlan, {
|
|
1152
1191
|
fullName: legacyFullName,
|
|
1153
1192
|
id: staticAllureId
|
|
1154
1193
|
});
|
|
1155
1194
|
}
|
|
1156
|
-
}, {
|
|
1157
|
-
key: "installTestPlanExecutionFilter",
|
|
1158
|
-
value: function installTestPlanExecutionFilter() {
|
|
1159
|
-
var _this7 = this;
|
|
1160
|
-
var suitePrototype = this.getPlaywrightSuitePrototype();
|
|
1161
|
-
if (!(suitePrototype !== null && suitePrototype !== void 0 && suitePrototype._addTest)) {
|
|
1162
|
-
// eslint-disable-next-line no-console
|
|
1163
|
-
console.warn("[allure-playwright] Could not install the test plan execution filter because Playwright " + "Suite.prototype._addTest was not found. Tests outside ALLURE_TESTPLAN_PATH may still run. " + "Please report this compatibility issue to https://github.com/allure-framework/allure-js/issues.");
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
var patchedSuitePrototype = suitePrototype;
|
|
1167
|
-
patchedSuitePrototype[testPlanFilterSymbol] = function (test, parentSuite) {
|
|
1168
|
-
return _this7.isInTestPlan(test, parentSuite);
|
|
1169
|
-
};
|
|
1170
|
-
if (patchedSuitePrototype[testPlanFilterPatchSymbol]) {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
var addTest = suitePrototype._addTest;
|
|
1174
|
-
|
|
1175
|
-
// Dear Pavel: break us all day long you may; find the way back, my Codex and I always will.
|
|
1176
|
-
suitePrototype._addTest = function (test) {
|
|
1177
|
-
var testPlanFilter = patchedSuitePrototype[testPlanFilterSymbol];
|
|
1178
|
-
if (testPlanFilter && !testPlanFilter(test, this)) {
|
|
1179
|
-
return;
|
|
1180
|
-
}
|
|
1181
|
-
return addTest.call(this, test);
|
|
1182
|
-
};
|
|
1183
|
-
patchedSuitePrototype[testPlanFilterPatchSymbol] = true;
|
|
1184
|
-
}
|
|
1185
|
-
}, {
|
|
1186
|
-
key: "getPlaywrightSuitePrototype",
|
|
1187
|
-
value: function getPlaywrightSuitePrototype() {
|
|
1188
|
-
var playwrightTestRequire = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _nodeModule.createRequire)(localRequire.resolve("@playwright/test"));
|
|
1189
|
-
try {
|
|
1190
|
-
var _playwrightCommon$tes;
|
|
1191
|
-
var playwrightCommon = playwrightTestRequire("playwright/lib/common");
|
|
1192
|
-
var suitePrototype = (_playwrightCommon$tes = playwrightCommon.test) === null || _playwrightCommon$tes === void 0 || (_playwrightCommon$tes = _playwrightCommon$tes.Suite) === null || _playwrightCommon$tes === void 0 ? void 0 : _playwrightCommon$tes.prototype;
|
|
1193
|
-
if (suitePrototype) {
|
|
1194
|
-
return suitePrototype;
|
|
1195
|
-
}
|
|
1196
|
-
} catch (_unused) {
|
|
1197
|
-
// Playwright 1.53-1.59 didn't export playwright/lib/common, but the Suite lived in lib/common/test.js.
|
|
1198
|
-
}
|
|
1199
|
-
try {
|
|
1200
|
-
var _playwrightCommonTest;
|
|
1201
|
-
var playwrightPackagePath = playwrightTestRequire.resolve("playwright/package.json");
|
|
1202
|
-
var playwrightCommonTest = playwrightTestRequire(_nodePath["default"].join(_nodePath["default"].dirname(playwrightPackagePath), "lib/common/test.js"));
|
|
1203
|
-
return (_playwrightCommonTest = playwrightCommonTest.Suite) === null || _playwrightCommonTest === void 0 ? void 0 : _playwrightCommonTest.prototype;
|
|
1204
|
-
} catch (_unused2) {
|
|
1205
|
-
return undefined;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
1195
|
}, {
|
|
1209
1196
|
key: "processStepMetadataMessage",
|
|
1210
1197
|
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
@@ -1240,32 +1227,32 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1240
1227
|
}, {
|
|
1241
1228
|
key: "processAttachment",
|
|
1242
1229
|
value: function () {
|
|
1243
|
-
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1230
|
+
var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(testUuid, attachmentStepUuid, attachment) {
|
|
1244
1231
|
var _replace;
|
|
1245
1232
|
var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
|
|
1246
|
-
return _regenerator().w(function (
|
|
1247
|
-
while (1) switch (
|
|
1233
|
+
return _regenerator().w(function (_context8) {
|
|
1234
|
+
while (1) switch (_context8.n) {
|
|
1248
1235
|
case 0:
|
|
1249
1236
|
if (!(!attachment.body && !attachment.path)) {
|
|
1250
|
-
|
|
1237
|
+
_context8.n = 1;
|
|
1251
1238
|
break;
|
|
1252
1239
|
}
|
|
1253
|
-
return
|
|
1240
|
+
return _context8.a(2);
|
|
1254
1241
|
case 1:
|
|
1255
1242
|
allureRuntimeMessage = attachment.contentType === _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
|
|
1256
1243
|
if (!(allureRuntimeMessage && !attachment.body)) {
|
|
1257
|
-
|
|
1244
|
+
_context8.n = 2;
|
|
1258
1245
|
break;
|
|
1259
1246
|
}
|
|
1260
|
-
return
|
|
1247
|
+
return _context8.a(2);
|
|
1261
1248
|
case 2:
|
|
1262
1249
|
if (!allureRuntimeMessage) {
|
|
1263
|
-
|
|
1250
|
+
_context8.n = 3;
|
|
1264
1251
|
break;
|
|
1265
1252
|
}
|
|
1266
1253
|
message = JSON.parse(attachment.body.toString());
|
|
1267
1254
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
1268
|
-
return
|
|
1255
|
+
return _context8.a(2);
|
|
1269
1256
|
case 3:
|
|
1270
1257
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
1271
1258
|
name: attachment.name
|
|
@@ -1276,20 +1263,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1276
1263
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
1277
1264
|
}
|
|
1278
1265
|
if (!attachment.body) {
|
|
1279
|
-
|
|
1266
|
+
_context8.n = 4;
|
|
1280
1267
|
break;
|
|
1281
1268
|
}
|
|
1282
1269
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
1283
1270
|
contentType: attachment.contentType
|
|
1284
1271
|
});
|
|
1285
|
-
|
|
1272
|
+
_context8.n = 6;
|
|
1286
1273
|
break;
|
|
1287
1274
|
case 4:
|
|
1288
1275
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
1289
|
-
|
|
1276
|
+
_context8.n = 5;
|
|
1290
1277
|
break;
|
|
1291
1278
|
}
|
|
1292
|
-
return
|
|
1279
|
+
return _context8.a(2);
|
|
1293
1280
|
case 5:
|
|
1294
1281
|
contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? _allureJsCommons.ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
|
|
1295
1282
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
@@ -1297,91 +1284,91 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1297
1284
|
});
|
|
1298
1285
|
case 6:
|
|
1299
1286
|
if (attachment.name.match(_utils.diffEndRegexp)) {
|
|
1300
|
-
|
|
1287
|
+
_context8.n = 7;
|
|
1301
1288
|
break;
|
|
1302
1289
|
}
|
|
1303
|
-
return
|
|
1290
|
+
return _context8.a(2);
|
|
1304
1291
|
case 7:
|
|
1305
1292
|
pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
1306
1293
|
pathWithoutEnd = attachment.path.replace(_utils.diffEndRegexp, "").replace(/\.png/, "");
|
|
1307
1294
|
if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
|
|
1308
|
-
|
|
1295
|
+
_context8.n = 8;
|
|
1309
1296
|
break;
|
|
1310
1297
|
}
|
|
1311
|
-
return
|
|
1298
|
+
return _context8.a(2);
|
|
1312
1299
|
case 8:
|
|
1313
1300
|
fileExists = /*#__PURE__*/function () {
|
|
1314
|
-
var
|
|
1315
|
-
return _regenerator().w(function (
|
|
1316
|
-
while (1) switch (
|
|
1301
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(filePath) {
|
|
1302
|
+
return _regenerator().w(function (_context6) {
|
|
1303
|
+
while (1) switch (_context6.n) {
|
|
1317
1304
|
case 0:
|
|
1318
|
-
|
|
1305
|
+
_context6.n = 1;
|
|
1319
1306
|
return (0, _promises.access)(filePath).then(function () {
|
|
1320
1307
|
return true;
|
|
1321
1308
|
})["catch"](function () {
|
|
1322
1309
|
return false;
|
|
1323
1310
|
});
|
|
1324
1311
|
case 1:
|
|
1325
|
-
return
|
|
1312
|
+
return _context6.a(2, _context6.v);
|
|
1326
1313
|
}
|
|
1327
|
-
},
|
|
1314
|
+
}, _callee6);
|
|
1328
1315
|
}));
|
|
1329
|
-
return function fileExists(
|
|
1330
|
-
return
|
|
1316
|
+
return function fileExists(_x8) {
|
|
1317
|
+
return _ref4.apply(this, arguments);
|
|
1331
1318
|
};
|
|
1332
1319
|
}();
|
|
1333
1320
|
readImageFromDirs = /*#__PURE__*/function () {
|
|
1334
|
-
var
|
|
1321
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(modifier) {
|
|
1335
1322
|
var defaultPath, snapshotPath;
|
|
1336
|
-
return _regenerator().w(function (
|
|
1337
|
-
while (1) switch (
|
|
1323
|
+
return _regenerator().w(function (_context7) {
|
|
1324
|
+
while (1) switch (_context7.n) {
|
|
1338
1325
|
case 0:
|
|
1339
1326
|
defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
|
|
1340
1327
|
snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
|
|
1341
|
-
|
|
1328
|
+
_context7.n = 1;
|
|
1342
1329
|
return fileExists(defaultPath);
|
|
1343
1330
|
case 1:
|
|
1344
|
-
if (!
|
|
1345
|
-
|
|
1331
|
+
if (!_context7.v) {
|
|
1332
|
+
_context7.n = 3;
|
|
1346
1333
|
break;
|
|
1347
1334
|
}
|
|
1348
|
-
|
|
1335
|
+
_context7.n = 2;
|
|
1349
1336
|
return (0, _reporter.readImageAsBase64)(defaultPath);
|
|
1350
1337
|
case 2:
|
|
1351
|
-
return
|
|
1338
|
+
return _context7.a(2, _context7.v);
|
|
1352
1339
|
case 3:
|
|
1353
|
-
|
|
1340
|
+
_context7.n = 4;
|
|
1354
1341
|
return fileExists(snapshotPath);
|
|
1355
1342
|
case 4:
|
|
1356
|
-
if (!
|
|
1357
|
-
|
|
1343
|
+
if (!_context7.v) {
|
|
1344
|
+
_context7.n = 6;
|
|
1358
1345
|
break;
|
|
1359
1346
|
}
|
|
1360
|
-
|
|
1347
|
+
_context7.n = 5;
|
|
1361
1348
|
return (0, _reporter.readImageAsBase64)(snapshotPath);
|
|
1362
1349
|
case 5:
|
|
1363
|
-
return
|
|
1350
|
+
return _context7.a(2, _context7.v);
|
|
1364
1351
|
case 6:
|
|
1365
|
-
return
|
|
1352
|
+
return _context7.a(2, undefined);
|
|
1366
1353
|
}
|
|
1367
|
-
},
|
|
1354
|
+
}, _callee7);
|
|
1368
1355
|
}));
|
|
1369
|
-
return function readImageFromDirs(
|
|
1370
|
-
return
|
|
1356
|
+
return function readImageFromDirs(_x9) {
|
|
1357
|
+
return _ref5.apply(this, arguments);
|
|
1371
1358
|
};
|
|
1372
1359
|
}();
|
|
1373
|
-
|
|
1360
|
+
_context8.n = 9;
|
|
1374
1361
|
return readImageFromDirs("actual");
|
|
1375
1362
|
case 9:
|
|
1376
|
-
actualBase64 =
|
|
1377
|
-
|
|
1363
|
+
actualBase64 = _context8.v;
|
|
1364
|
+
_context8.n = 10;
|
|
1378
1365
|
return readImageFromDirs("expected");
|
|
1379
1366
|
case 10:
|
|
1380
|
-
expectedBase64 =
|
|
1381
|
-
|
|
1367
|
+
expectedBase64 = _context8.v;
|
|
1368
|
+
_context8.n = 11;
|
|
1382
1369
|
return readImageFromDirs("diff");
|
|
1383
1370
|
case 11:
|
|
1384
|
-
diffBase64 =
|
|
1371
|
+
diffBase64 = _context8.v;
|
|
1385
1372
|
diffName = attachment.name.replace(_utils.diffEndRegexp, "");
|
|
1386
1373
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
1387
1374
|
expected: expectedBase64,
|
|
@@ -1394,11 +1381,11 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
1394
1381
|
});
|
|
1395
1382
|
this.processedDiffs.push(pathWithoutEnd);
|
|
1396
1383
|
case 12:
|
|
1397
|
-
return
|
|
1384
|
+
return _context8.a(2);
|
|
1398
1385
|
}
|
|
1399
|
-
},
|
|
1386
|
+
}, _callee8, this);
|
|
1400
1387
|
}));
|
|
1401
|
-
function processAttachment(
|
|
1388
|
+
function processAttachment(_x5, _x6, _x7) {
|
|
1402
1389
|
return _processAttachment.apply(this, arguments);
|
|
1403
1390
|
}
|
|
1404
1391
|
return processAttachment;
|