allure-playwright 3.0.9 → 3.2.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/dist/cjs/index.js +184 -42
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/runtime.js +102 -31
- package/dist/cjs/runtime.js.map +1 -1
- package/dist/cjs/utils.js +19 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/index.js +188 -46
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/runtime.js +102 -31
- package/dist/esm/runtime.js.map +1 -1
- package/dist/esm/utils.js +18 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/runtime.d.ts +4 -2
- package/dist/types/utils.d.ts +6 -0
- package/package.json +5 -4
package/dist/cjs/index.js
CHANGED
|
@@ -27,10 +27,10 @@ var _legacy = require("./legacy.js");
|
|
|
27
27
|
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
|
-
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; } } }; }
|
|
31
30
|
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 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); }
|
|
33
32
|
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); }); }; }
|
|
33
|
+
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; } } }; }
|
|
34
34
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
35
35
|
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."); }
|
|
36
36
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
@@ -67,6 +67,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
67
67
|
_defineProperty(this, "startedTestCasesTitlesCache", []);
|
|
68
68
|
_defineProperty(this, "allureResultsUuids", new Map());
|
|
69
69
|
_defineProperty(this, "attachmentSteps", new Map());
|
|
70
|
+
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
71
|
+
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
70
72
|
this.options = _objectSpread({
|
|
71
73
|
suiteTitle: true,
|
|
72
74
|
detail: true
|
|
@@ -167,8 +169,9 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
167
169
|
var result = {
|
|
168
170
|
name: titleMetadata.cleanTitle,
|
|
169
171
|
labels: [].concat(_toConsumableArray(titleMetadata.labels), _toConsumableArray((0, _reporter.getEnvironmentLabels)())),
|
|
170
|
-
links:
|
|
172
|
+
links: _toConsumableArray(titleMetadata.links),
|
|
171
173
|
parameters: [],
|
|
174
|
+
steps: [],
|
|
172
175
|
testCaseId: (0, _reporter.md5)(testCaseIdBase),
|
|
173
176
|
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column)
|
|
174
177
|
};
|
|
@@ -191,6 +194,56 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
191
194
|
});
|
|
192
195
|
(_ref = result.labels).push.apply(_ref, _toConsumableArray(tags));
|
|
193
196
|
}
|
|
197
|
+
if ("annotations" in test) {
|
|
198
|
+
var _iterator = _createForOfIteratorHelper(test.annotations),
|
|
199
|
+
_step;
|
|
200
|
+
try {
|
|
201
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
202
|
+
var annotation = _step.value;
|
|
203
|
+
if (annotation.type === "skip" || annotation.type === "fixme") {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (annotation.type === "issue") {
|
|
207
|
+
var _this$options$links;
|
|
208
|
+
result.links.push((0, _reporter.formatLink)((_this$options$links = this.options.links) !== null && _this$options$links !== void 0 ? _this$options$links : {}, {
|
|
209
|
+
type: _allureJsCommons.LinkType.ISSUE,
|
|
210
|
+
url: annotation.description
|
|
211
|
+
}));
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (annotation.type === "tms" || annotation.type === "test_key") {
|
|
215
|
+
var _this$options$links2;
|
|
216
|
+
result.links.push((0, _reporter.formatLink)((_this$options$links2 = this.options.links) !== null && _this$options$links2 !== void 0 ? _this$options$links2 : {}, {
|
|
217
|
+
type: _allureJsCommons.LinkType.TMS,
|
|
218
|
+
url: annotation.description
|
|
219
|
+
}));
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (annotation.type === "description") {
|
|
223
|
+
result.description = annotation.description;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
var annotationLabel = (0, _sdk.getMetadataLabel)(annotation.type, annotation.description);
|
|
227
|
+
if (annotationLabel) {
|
|
228
|
+
result.labels.push(annotationLabel);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
result.steps.push({
|
|
232
|
+
name: "".concat(annotation.type, ": ").concat(annotation.description),
|
|
233
|
+
status: _allureJsCommons.Status.PASSED,
|
|
234
|
+
stage: _allureJsCommons.Stage.FINISHED,
|
|
235
|
+
parameters: [],
|
|
236
|
+
steps: [],
|
|
237
|
+
attachments: [],
|
|
238
|
+
statusDetails: {}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
} catch (err) {
|
|
242
|
+
_iterator.e(err);
|
|
243
|
+
} finally {
|
|
244
|
+
_iterator.f();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
194
247
|
if (project !== null && project !== void 0 && project.name) {
|
|
195
248
|
result.parameters.push({
|
|
196
249
|
name: "Project",
|
|
@@ -220,10 +273,32 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
220
273
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
221
274
|
return;
|
|
222
275
|
}
|
|
223
|
-
|
|
276
|
+
var baseStep = _objectSpread(_objectSpread({}, (0, _reporter.createStepResult)()), {}, {
|
|
224
277
|
name: step.title,
|
|
225
|
-
start: step.startTime.getTime()
|
|
278
|
+
start: step.startTime.getTime(),
|
|
279
|
+
stage: _allureJsCommons.Stage.RUNNING
|
|
226
280
|
});
|
|
281
|
+
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
282
|
+
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
283
|
+
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
284
|
+
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
285
|
+
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
286
|
+
if (isBeforeHookDescendant || isAfterHookDescendant) {
|
|
287
|
+
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
288
|
+
stack.startStep(baseStep);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (isRootHook) {
|
|
292
|
+
var _stack = new _reporter.ShallowStepsStack();
|
|
293
|
+
_stack.startStep(baseStep);
|
|
294
|
+
if (isRootBeforeHook) {
|
|
295
|
+
this.beforeHooksStepsStack.set(test.id, _stack);
|
|
296
|
+
} else {
|
|
297
|
+
this.afterHooksStepsStack.set(test.id, _stack);
|
|
298
|
+
}
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
this.allureRuntime.startStep(testUuid, undefined, baseStep);
|
|
227
302
|
}
|
|
228
303
|
}, {
|
|
229
304
|
key: "onStepEnd",
|
|
@@ -237,12 +312,40 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
237
312
|
return;
|
|
238
313
|
}
|
|
239
314
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
315
|
+
var isRootBeforeHook = step.title === _utils.BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
316
|
+
var isRootAfterHook = step.title === _utils.AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
317
|
+
var isBeforeHookDescendant = (0, _utils.isBeforeHookStep)(step);
|
|
318
|
+
var isAfterHookDescendant = (0, _utils.isAfterHookStep)(step);
|
|
319
|
+
var isAfterHook = isRootAfterHook || isAfterHookDescendant;
|
|
320
|
+
var isHook = isRootBeforeHook || isRootAfterHook || isBeforeHookDescendant || isAfterHookDescendant;
|
|
321
|
+
if (isHook) {
|
|
322
|
+
var stack = isAfterHook ? this.afterHooksStepsStack.get(test.id) : this.beforeHooksStepsStack.get(test.id);
|
|
323
|
+
stack.updateStep(function (stepResult) {
|
|
324
|
+
var _getWorstTestStepResu;
|
|
325
|
+
var _ref2 = (_getWorstTestStepResu = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu !== void 0 ? _getWorstTestStepResu : {},
|
|
326
|
+
_ref2$status = _ref2.status,
|
|
327
|
+
status = _ref2$status === void 0 ? _allureJsCommons.Status.PASSED : _ref2$status;
|
|
328
|
+
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : status;
|
|
329
|
+
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
330
|
+
if (step.error) {
|
|
331
|
+
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
stack.stopStep({
|
|
335
|
+
duration: step.duration
|
|
336
|
+
});
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
240
339
|
var currentStep = this.allureRuntime.currentStep(testUuid);
|
|
241
340
|
if (!currentStep) {
|
|
242
341
|
return;
|
|
243
342
|
}
|
|
244
343
|
this.allureRuntime.updateStep(currentStep, function (stepResult) {
|
|
245
|
-
|
|
344
|
+
var _getWorstTestStepResu2;
|
|
345
|
+
var _ref3 = (_getWorstTestStepResu2 = (0, _reporter.getWorstTestStepResult)(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
|
|
346
|
+
_ref3$status = _ref3.status,
|
|
347
|
+
status = _ref3$status === void 0 ? _allureJsCommons.Status.PASSED : _ref3$status;
|
|
348
|
+
stepResult.status = step.error ? _allureJsCommons.Status.FAILED : status;
|
|
246
349
|
stepResult.stage = _allureJsCommons.Stage.FINISHED;
|
|
247
350
|
if (step.error) {
|
|
248
351
|
stepResult.statusDetails = _objectSpread({}, (0, _sdk.getMessageAndTraceFromError)(step.error));
|
|
@@ -258,7 +361,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
258
361
|
var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
|
|
259
362
|
var _this = this,
|
|
260
363
|
_this$attachmentSteps2;
|
|
261
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, attachmentSteps, i, attachment, attachmentStep;
|
|
364
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentSteps, i, attachment, attachmentStep;
|
|
262
365
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
263
366
|
while (1) switch (_context.prev = _context.next) {
|
|
264
367
|
case 0:
|
|
@@ -267,6 +370,8 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
267
370
|
thread = "pid-".concat(_nodeProcess["default"].pid, "-worker-").concat(threadId);
|
|
268
371
|
error = result.error; // only apply default suites if not set by user
|
|
269
372
|
_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);
|
|
373
|
+
beforeHooksStack = this.beforeHooksStepsStack.get(test.id);
|
|
374
|
+
afterHooksStack = this.afterHooksStepsStack.get(test.id);
|
|
270
375
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
271
376
|
testResult.labels.push((0, _reporter.getHostLabel)());
|
|
272
377
|
testResult.labels.push((0, _reporter.getThreadLabel)(thread));
|
|
@@ -306,20 +411,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
306
411
|
});
|
|
307
412
|
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
308
413
|
i = 0;
|
|
309
|
-
case
|
|
414
|
+
case 10:
|
|
310
415
|
if (!(i < result.attachments.length)) {
|
|
311
|
-
_context.next =
|
|
416
|
+
_context.next = 18;
|
|
312
417
|
break;
|
|
313
418
|
}
|
|
314
419
|
attachment = result.attachments[i];
|
|
315
420
|
attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
|
|
316
|
-
_context.next =
|
|
421
|
+
_context.next = 15;
|
|
317
422
|
return this.processAttachment(testUuid, attachmentStep, attachment);
|
|
318
|
-
case
|
|
423
|
+
case 15:
|
|
319
424
|
i++;
|
|
320
|
-
_context.next =
|
|
425
|
+
_context.next = 10;
|
|
321
426
|
break;
|
|
322
|
-
case
|
|
427
|
+
case 18:
|
|
323
428
|
if (result.stdout.length > 0) {
|
|
324
429
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from((0, _sdk.stripAnsi)(result.stdout.join("")), "utf-8"), {
|
|
325
430
|
contentType: _allureJsCommons.ContentType.TEXT
|
|
@@ -348,13 +453,23 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
348
453
|
}
|
|
349
454
|
return labelsGroup;
|
|
350
455
|
});
|
|
456
|
+
if (beforeHooksStack) {
|
|
457
|
+
var _testResult$steps;
|
|
458
|
+
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
|
|
459
|
+
_this.beforeHooksStepsStack["delete"](test.id);
|
|
460
|
+
}
|
|
461
|
+
if (afterHooksStack) {
|
|
462
|
+
var _testResult$steps2;
|
|
463
|
+
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
|
|
464
|
+
_this.afterHooksStepsStack["delete"](test.id);
|
|
465
|
+
}
|
|
351
466
|
testResult.labels = newLabels;
|
|
352
467
|
});
|
|
353
468
|
this.allureRuntime.stopTest(testUuid, {
|
|
354
469
|
duration: result.duration
|
|
355
470
|
});
|
|
356
471
|
this.allureRuntime.writeTest(testUuid);
|
|
357
|
-
case
|
|
472
|
+
case 23:
|
|
358
473
|
case "end":
|
|
359
474
|
return _context.stop();
|
|
360
475
|
}
|
|
@@ -370,24 +485,24 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
370
485
|
value: function () {
|
|
371
486
|
var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
372
487
|
var _this2 = this;
|
|
373
|
-
var unprocessedCases,
|
|
488
|
+
var unprocessedCases, _iterator2, _step2, testCase;
|
|
374
489
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
375
490
|
while (1) switch (_context2.prev = _context2.next) {
|
|
376
491
|
case 0:
|
|
377
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
378
|
-
var title =
|
|
492
|
+
unprocessedCases = this.suite.allTests().filter(function (_ref4) {
|
|
493
|
+
var title = _ref4.title;
|
|
379
494
|
var titleMetadata = (0, _sdk.extractMetadataFromString)(title);
|
|
380
495
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
381
496
|
});
|
|
382
|
-
|
|
497
|
+
_iterator2 = _createForOfIteratorHelper(unprocessedCases);
|
|
383
498
|
_context2.prev = 2;
|
|
384
|
-
|
|
499
|
+
_iterator2.s();
|
|
385
500
|
case 4:
|
|
386
|
-
if ((
|
|
501
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
387
502
|
_context2.next = 11;
|
|
388
503
|
break;
|
|
389
504
|
}
|
|
390
|
-
testCase =
|
|
505
|
+
testCase = _step2.value;
|
|
391
506
|
this.onTestBegin(testCase);
|
|
392
507
|
_context2.next = 9;
|
|
393
508
|
return this.onTestEnd(testCase, {
|
|
@@ -412,10 +527,10 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
412
527
|
case 13:
|
|
413
528
|
_context2.prev = 13;
|
|
414
529
|
_context2.t0 = _context2["catch"](2);
|
|
415
|
-
|
|
530
|
+
_iterator2.e(_context2.t0);
|
|
416
531
|
case 16:
|
|
417
532
|
_context2.prev = 16;
|
|
418
|
-
|
|
533
|
+
_iterator2.f();
|
|
419
534
|
return _context2.finish(16);
|
|
420
535
|
case 19:
|
|
421
536
|
case "end":
|
|
@@ -456,6 +571,21 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
456
571
|
value: function printsToStdio() {
|
|
457
572
|
return false;
|
|
458
573
|
}
|
|
574
|
+
}, {
|
|
575
|
+
key: "processStepMetadataMessage",
|
|
576
|
+
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
577
|
+
var _message$data = message.data,
|
|
578
|
+
name = _message$data.name,
|
|
579
|
+
_message$data$paramet = _message$data.parameters,
|
|
580
|
+
parameters = _message$data$paramet === void 0 ? [] : _message$data$paramet;
|
|
581
|
+
this.allureRuntime.updateStep(attachmentStepUuid, function (step) {
|
|
582
|
+
var _step$parameters;
|
|
583
|
+
if (name) {
|
|
584
|
+
step.name = name;
|
|
585
|
+
}
|
|
586
|
+
(_step$parameters = step.parameters).push.apply(_step$parameters, _toConsumableArray(parameters));
|
|
587
|
+
});
|
|
588
|
+
}
|
|
459
589
|
}, {
|
|
460
590
|
key: "processAttachment",
|
|
461
591
|
value: function () {
|
|
@@ -478,13 +608,20 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
478
608
|
return _context4.abrupt("return");
|
|
479
609
|
case 5:
|
|
480
610
|
if (!allureRuntimeMessage) {
|
|
481
|
-
_context4.next =
|
|
611
|
+
_context4.next = 12;
|
|
482
612
|
break;
|
|
483
613
|
}
|
|
484
|
-
message = JSON.parse(attachment.body.toString());
|
|
614
|
+
message = JSON.parse(attachment.body.toString());
|
|
615
|
+
if (!(message.type === "step_metadata")) {
|
|
616
|
+
_context4.next = 10;
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
this.processStepMetadataMessage(attachmentStepUuid, message);
|
|
620
|
+
return _context4.abrupt("return");
|
|
621
|
+
case 10:
|
|
485
622
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
486
623
|
return _context4.abrupt("return");
|
|
487
|
-
case
|
|
624
|
+
case 12:
|
|
488
625
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
489
626
|
name: attachment.name
|
|
490
627
|
}); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
|
|
@@ -494,50 +631,50 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
494
631
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
495
632
|
}
|
|
496
633
|
if (!attachment.body) {
|
|
497
|
-
_context4.next =
|
|
634
|
+
_context4.next = 18;
|
|
498
635
|
break;
|
|
499
636
|
}
|
|
500
637
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
501
638
|
contentType: attachment.contentType
|
|
502
639
|
});
|
|
503
|
-
_context4.next =
|
|
640
|
+
_context4.next = 23;
|
|
504
641
|
break;
|
|
505
|
-
case
|
|
642
|
+
case 18:
|
|
506
643
|
if ((0, _nodeFs.existsSync)(attachment.path)) {
|
|
507
|
-
_context4.next =
|
|
644
|
+
_context4.next = 22;
|
|
508
645
|
break;
|
|
509
646
|
}
|
|
510
647
|
return _context4.abrupt("return");
|
|
511
|
-
case
|
|
648
|
+
case 22:
|
|
512
649
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
513
650
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
514
651
|
contentType: attachment.contentType
|
|
515
652
|
});
|
|
516
|
-
case
|
|
653
|
+
case 23:
|
|
517
654
|
if (attachment.name.match(diffEndRegexp)) {
|
|
518
|
-
_context4.next =
|
|
655
|
+
_context4.next = 25;
|
|
519
656
|
break;
|
|
520
657
|
}
|
|
521
658
|
return _context4.abrupt("return");
|
|
522
|
-
case
|
|
659
|
+
case 25:
|
|
523
660
|
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
|
|
524
661
|
if (!this.processedDiffs.includes(pathWithoutEnd)) {
|
|
525
|
-
_context4.next =
|
|
662
|
+
_context4.next = 28;
|
|
526
663
|
break;
|
|
527
664
|
}
|
|
528
665
|
return _context4.abrupt("return");
|
|
529
|
-
case
|
|
530
|
-
_context4.next =
|
|
666
|
+
case 28:
|
|
667
|
+
_context4.next = 30;
|
|
531
668
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-actual.png"));
|
|
532
|
-
case
|
|
669
|
+
case 30:
|
|
533
670
|
actualBase64 = _context4.sent;
|
|
534
|
-
_context4.next =
|
|
671
|
+
_context4.next = 33;
|
|
535
672
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-expected.png"));
|
|
536
|
-
case
|
|
673
|
+
case 33:
|
|
537
674
|
expectedBase64 = _context4.sent;
|
|
538
|
-
_context4.next =
|
|
675
|
+
_context4.next = 36;
|
|
539
676
|
return (0, _reporter.readImageAsBase64)("".concat(pathWithoutEnd, "-diff.png"));
|
|
540
|
-
case
|
|
677
|
+
case 36:
|
|
541
678
|
diffBase64 = _context4.sent;
|
|
542
679
|
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
543
680
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
@@ -550,7 +687,7 @@ var AllureReporter = exports.AllureReporter = /*#__PURE__*/function () {
|
|
|
550
687
|
fileExtension: ".imagediff"
|
|
551
688
|
});
|
|
552
689
|
this.processedDiffs.push(pathWithoutEnd);
|
|
553
|
-
case
|
|
690
|
+
case 40:
|
|
554
691
|
case "end":
|
|
555
692
|
return _context4.stop();
|
|
556
693
|
}
|
|
@@ -580,6 +717,11 @@ function _shouldIgnoreStep(step) {
|
|
|
580
717
|
if (step.category === "pw:api" && step.title === "route.continue()") {
|
|
581
718
|
return true;
|
|
582
719
|
}
|
|
720
|
+
|
|
721
|
+
// playwright doesn't report this step
|
|
722
|
+
if (step.title === "Worker Cleanup" || (0, _utils.isDescendantOfStepWithTitle)(step, "Worker Cleanup")) {
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
583
725
|
return false;
|
|
584
726
|
}
|
|
585
727
|
var allure = exports.allure = _legacy.allurePlaywrightLegacyApi;
|