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/utils.js
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.statusToAllureStats = void 0;
|
|
6
|
+
exports.statusToAllureStats = exports.isDescendantOfStepWithTitle = exports.isBeforeHookStep = exports.isAfterHookStep = exports.BEFORE_HOOKS_ROOT_STEP_TITLE = exports.AFTER_HOOKS_ROOT_STEP_TITLE = void 0;
|
|
7
7
|
var _allureJsCommons = require("allure-js-commons");
|
|
8
|
+
var AFTER_HOOKS_ROOT_STEP_TITLE = exports.AFTER_HOOKS_ROOT_STEP_TITLE = "After Hooks";
|
|
9
|
+
var BEFORE_HOOKS_ROOT_STEP_TITLE = exports.BEFORE_HOOKS_ROOT_STEP_TITLE = "Before Hooks";
|
|
8
10
|
var statusToAllureStats = exports.statusToAllureStats = function statusToAllureStats(status, expectedStatus) {
|
|
9
11
|
if (status === "skipped") {
|
|
10
12
|
return _allureJsCommons.Status.SKIPPED;
|
|
@@ -17,4 +19,20 @@ var statusToAllureStats = exports.statusToAllureStats = function statusToAllureS
|
|
|
17
19
|
}
|
|
18
20
|
return _allureJsCommons.Status.FAILED;
|
|
19
21
|
};
|
|
22
|
+
var isDescendantOfStepWithTitle = exports.isDescendantOfStepWithTitle = function isDescendantOfStepWithTitle(step, title) {
|
|
23
|
+
var parent = step.parent;
|
|
24
|
+
while (parent) {
|
|
25
|
+
if (parent.title === title) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
parent = parent.parent;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
};
|
|
32
|
+
var isAfterHookStep = exports.isAfterHookStep = function isAfterHookStep(step) {
|
|
33
|
+
return isDescendantOfStepWithTitle(step, AFTER_HOOKS_ROOT_STEP_TITLE);
|
|
34
|
+
};
|
|
35
|
+
var isBeforeHookStep = exports.isBeforeHookStep = function isBeforeHookStep(step) {
|
|
36
|
+
return isDescendantOfStepWithTitle(step, BEFORE_HOOKS_ROOT_STEP_TITLE);
|
|
37
|
+
};
|
|
20
38
|
//# sourceMappingURL=utils.js.map
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_allureJsCommons","require","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_allureJsCommons","require","AFTER_HOOKS_ROOT_STEP_TITLE","exports","BEFORE_HOOKS_ROOT_STEP_TITLE","statusToAllureStats","status","expectedStatus","Status","SKIPPED","BROKEN","PASSED","FAILED","isDescendantOfStepWithTitle","step","title","parent","isAfterHookStep","isBeforeHookStep"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { TestStatus } from \"@playwright/test\";\nimport type { TestStep } from \"@playwright/test/reporter\";\nimport { Status } from \"allure-js-commons\";\n\nexport const AFTER_HOOKS_ROOT_STEP_TITLE = \"After Hooks\";\n\nexport const BEFORE_HOOKS_ROOT_STEP_TITLE = \"Before Hooks\";\n\nexport const statusToAllureStats = (status: TestStatus, expectedStatus: TestStatus): Status => {\n if (status === \"skipped\") {\n return Status.SKIPPED;\n }\n\n if (status === \"timedOut\") {\n return Status.BROKEN;\n }\n\n if (status === expectedStatus) {\n return Status.PASSED;\n }\n\n return Status.FAILED;\n};\n\nexport const isDescendantOfStepWithTitle = (step: TestStep, title: string): boolean => {\n let parent = step.parent;\n\n while (parent) {\n if (parent.title === title) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n};\n\nexport const isAfterHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, AFTER_HOOKS_ROOT_STEP_TITLE);\n\nexport const isBeforeHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, BEFORE_HOOKS_ROOT_STEP_TITLE);\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AAEO,IAAMC,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,aAAa;AAEjD,IAAME,4BAA4B,GAAAD,OAAA,CAAAC,4BAAA,GAAG,cAAc;AAEnD,IAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAkB,EAAEC,cAA0B,EAAa;EAC7F,IAAID,MAAM,KAAK,SAAS,EAAE;IACxB,OAAOE,uBAAM,CAACC,OAAO;EACvB;EAEA,IAAIH,MAAM,KAAK,UAAU,EAAE;IACzB,OAAOE,uBAAM,CAACE,MAAM;EACtB;EAEA,IAAIJ,MAAM,KAAKC,cAAc,EAAE;IAC7B,OAAOC,uBAAM,CAACG,MAAM;EACtB;EAEA,OAAOH,uBAAM,CAACI,MAAM;AACtB,CAAC;AAEM,IAAMC,2BAA2B,GAAAV,OAAA,CAAAU,2BAAA,GAAG,SAA9BA,2BAA2BA,CAAIC,IAAc,EAAEC,KAAa,EAAc;EACrF,IAAIC,MAAM,GAAGF,IAAI,CAACE,MAAM;EAExB,OAAOA,MAAM,EAAE;IACb,IAAIA,MAAM,CAACD,KAAK,KAAKA,KAAK,EAAE;MAC1B,OAAO,IAAI;IACb;IAEAC,MAAM,GAAGA,MAAM,CAACA,MAAM;EACxB;EAEA,OAAO,KAAK;AACd,CAAC;AAEM,IAAMC,eAAe,GAAAd,OAAA,CAAAc,eAAA,GAAG,SAAlBA,eAAeA,CAAIH,IAAc;EAAA,OAAKD,2BAA2B,CAACC,IAAI,EAAEZ,2BAA2B,CAAC;AAAA;AAE1G,IAAMgB,gBAAgB,GAAAf,OAAA,CAAAe,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAIJ,IAAc;EAAA,OAAKD,2BAA2B,CAACC,IAAI,EAAEV,4BAA4B,CAAC;AAAA","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
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; } } }; }
|
|
3
2
|
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; }
|
|
4
3
|
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); }
|
|
5
4
|
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); }); }; }
|
|
5
|
+
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; } } }; }
|
|
6
6
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
7
7
|
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."); }
|
|
8
8
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
@@ -26,11 +26,11 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
|
|
|
26
26
|
import { existsSync } from "node:fs";
|
|
27
27
|
import path from "node:path";
|
|
28
28
|
import process from "node:process";
|
|
29
|
-
import { ContentType, LabelName, Stage, Status } from "allure-js-commons";
|
|
30
|
-
import { extractMetadataFromString, getMessageAndTraceFromError, hasLabel, stripAnsi } from "allure-js-commons/sdk";
|
|
31
|
-
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, createDefaultWriter, escapeRegExp, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getThreadLabel, md5, parseTestPlan, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
29
|
+
import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
|
|
30
|
+
import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
|
|
31
|
+
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getThreadLabel, getWorstTestStepResult, md5, parseTestPlan, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
|
|
32
32
|
import { allurePlaywrightLegacyApi } from "./legacy.js";
|
|
33
|
-
import { statusToAllureStats } from "./utils.js";
|
|
33
|
+
import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, statusToAllureStats } from "./utils.js";
|
|
34
34
|
|
|
35
35
|
// TODO: move to utils.ts
|
|
36
36
|
var diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/;
|
|
@@ -48,6 +48,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
48
48
|
_defineProperty(this, "startedTestCasesTitlesCache", []);
|
|
49
49
|
_defineProperty(this, "allureResultsUuids", new Map());
|
|
50
50
|
_defineProperty(this, "attachmentSteps", new Map());
|
|
51
|
+
_defineProperty(this, "beforeHooksStepsStack", new Map());
|
|
52
|
+
_defineProperty(this, "afterHooksStepsStack", new Map());
|
|
51
53
|
this.options = _objectSpread({
|
|
52
54
|
suiteTitle: true,
|
|
53
55
|
detail: true
|
|
@@ -148,8 +150,9 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
148
150
|
var result = {
|
|
149
151
|
name: titleMetadata.cleanTitle,
|
|
150
152
|
labels: [].concat(_toConsumableArray(titleMetadata.labels), _toConsumableArray(getEnvironmentLabels())),
|
|
151
|
-
links:
|
|
153
|
+
links: _toConsumableArray(titleMetadata.links),
|
|
152
154
|
parameters: [],
|
|
155
|
+
steps: [],
|
|
153
156
|
testCaseId: md5(testCaseIdBase),
|
|
154
157
|
fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column)
|
|
155
158
|
};
|
|
@@ -172,6 +175,56 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
172
175
|
});
|
|
173
176
|
(_ref = result.labels).push.apply(_ref, _toConsumableArray(tags));
|
|
174
177
|
}
|
|
178
|
+
if ("annotations" in test) {
|
|
179
|
+
var _iterator = _createForOfIteratorHelper(test.annotations),
|
|
180
|
+
_step;
|
|
181
|
+
try {
|
|
182
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
183
|
+
var annotation = _step.value;
|
|
184
|
+
if (annotation.type === "skip" || annotation.type === "fixme") {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (annotation.type === "issue") {
|
|
188
|
+
var _this$options$links;
|
|
189
|
+
result.links.push(formatLink((_this$options$links = this.options.links) !== null && _this$options$links !== void 0 ? _this$options$links : {}, {
|
|
190
|
+
type: LinkType.ISSUE,
|
|
191
|
+
url: annotation.description
|
|
192
|
+
}));
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (annotation.type === "tms" || annotation.type === "test_key") {
|
|
196
|
+
var _this$options$links2;
|
|
197
|
+
result.links.push(formatLink((_this$options$links2 = this.options.links) !== null && _this$options$links2 !== void 0 ? _this$options$links2 : {}, {
|
|
198
|
+
type: LinkType.TMS,
|
|
199
|
+
url: annotation.description
|
|
200
|
+
}));
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (annotation.type === "description") {
|
|
204
|
+
result.description = annotation.description;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
var annotationLabel = getMetadataLabel(annotation.type, annotation.description);
|
|
208
|
+
if (annotationLabel) {
|
|
209
|
+
result.labels.push(annotationLabel);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
result.steps.push({
|
|
213
|
+
name: "".concat(annotation.type, ": ").concat(annotation.description),
|
|
214
|
+
status: Status.PASSED,
|
|
215
|
+
stage: Stage.FINISHED,
|
|
216
|
+
parameters: [],
|
|
217
|
+
steps: [],
|
|
218
|
+
attachments: [],
|
|
219
|
+
statusDetails: {}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
} catch (err) {
|
|
223
|
+
_iterator.e(err);
|
|
224
|
+
} finally {
|
|
225
|
+
_iterator.f();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
175
228
|
if (project !== null && project !== void 0 && project.name) {
|
|
176
229
|
result.parameters.push({
|
|
177
230
|
name: "Project",
|
|
@@ -201,10 +254,32 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
201
254
|
if (_assertClassBrand(_AllureReporter_brand, this, _shouldIgnoreStep).call(this, step)) {
|
|
202
255
|
return;
|
|
203
256
|
}
|
|
204
|
-
|
|
257
|
+
var baseStep = _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
205
258
|
name: step.title,
|
|
206
|
-
start: step.startTime.getTime()
|
|
259
|
+
start: step.startTime.getTime(),
|
|
260
|
+
stage: Stage.RUNNING
|
|
207
261
|
});
|
|
262
|
+
var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
263
|
+
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
264
|
+
var isRootHook = isRootBeforeHook || isRootAfterHook;
|
|
265
|
+
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
266
|
+
var isAfterHookDescendant = isAfterHookStep(step);
|
|
267
|
+
if (isBeforeHookDescendant || isAfterHookDescendant) {
|
|
268
|
+
var stack = isBeforeHookDescendant ? this.beforeHooksStepsStack.get(test.id) : this.afterHooksStepsStack.get(test.id);
|
|
269
|
+
stack.startStep(baseStep);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (isRootHook) {
|
|
273
|
+
var _stack = new ShallowStepsStack();
|
|
274
|
+
_stack.startStep(baseStep);
|
|
275
|
+
if (isRootBeforeHook) {
|
|
276
|
+
this.beforeHooksStepsStack.set(test.id, _stack);
|
|
277
|
+
} else {
|
|
278
|
+
this.afterHooksStepsStack.set(test.id, _stack);
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
this.allureRuntime.startStep(testUuid, undefined, baseStep);
|
|
208
283
|
}
|
|
209
284
|
}, {
|
|
210
285
|
key: "onStepEnd",
|
|
@@ -218,12 +293,40 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
218
293
|
return;
|
|
219
294
|
}
|
|
220
295
|
var testUuid = this.allureResultsUuids.get(test.id);
|
|
296
|
+
var isRootBeforeHook = step.title === BEFORE_HOOKS_ROOT_STEP_TITLE;
|
|
297
|
+
var isRootAfterHook = step.title === AFTER_HOOKS_ROOT_STEP_TITLE;
|
|
298
|
+
var isBeforeHookDescendant = isBeforeHookStep(step);
|
|
299
|
+
var isAfterHookDescendant = isAfterHookStep(step);
|
|
300
|
+
var isAfterHook = isRootAfterHook || isAfterHookDescendant;
|
|
301
|
+
var isHook = isRootBeforeHook || isRootAfterHook || isBeforeHookDescendant || isAfterHookDescendant;
|
|
302
|
+
if (isHook) {
|
|
303
|
+
var stack = isAfterHook ? this.afterHooksStepsStack.get(test.id) : this.beforeHooksStepsStack.get(test.id);
|
|
304
|
+
stack.updateStep(function (stepResult) {
|
|
305
|
+
var _getWorstTestStepResu;
|
|
306
|
+
var _ref2 = (_getWorstTestStepResu = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu !== void 0 ? _getWorstTestStepResu : {},
|
|
307
|
+
_ref2$status = _ref2.status,
|
|
308
|
+
status = _ref2$status === void 0 ? Status.PASSED : _ref2$status;
|
|
309
|
+
stepResult.status = step.error ? Status.FAILED : status;
|
|
310
|
+
stepResult.stage = Stage.FINISHED;
|
|
311
|
+
if (step.error) {
|
|
312
|
+
stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
stack.stopStep({
|
|
316
|
+
duration: step.duration
|
|
317
|
+
});
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
221
320
|
var currentStep = this.allureRuntime.currentStep(testUuid);
|
|
222
321
|
if (!currentStep) {
|
|
223
322
|
return;
|
|
224
323
|
}
|
|
225
324
|
this.allureRuntime.updateStep(currentStep, function (stepResult) {
|
|
226
|
-
|
|
325
|
+
var _getWorstTestStepResu2;
|
|
326
|
+
var _ref3 = (_getWorstTestStepResu2 = getWorstTestStepResult(stepResult.steps)) !== null && _getWorstTestStepResu2 !== void 0 ? _getWorstTestStepResu2 : {},
|
|
327
|
+
_ref3$status = _ref3.status,
|
|
328
|
+
status = _ref3$status === void 0 ? Status.PASSED : _ref3$status;
|
|
329
|
+
stepResult.status = step.error ? Status.FAILED : status;
|
|
227
330
|
stepResult.stage = Stage.FINISHED;
|
|
228
331
|
if (step.error) {
|
|
229
332
|
stepResult.statusDetails = _objectSpread({}, getMessageAndTraceFromError(step.error));
|
|
@@ -239,7 +342,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
239
342
|
var _onTestEnd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(test, result) {
|
|
240
343
|
var _this = this,
|
|
241
344
|
_this$attachmentSteps2;
|
|
242
|
-
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, attachmentSteps, i, attachment, attachmentStep;
|
|
345
|
+
var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, attachmentSteps, i, attachment, attachmentStep;
|
|
243
346
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
244
347
|
while (1) switch (_context.prev = _context.next) {
|
|
245
348
|
case 0:
|
|
@@ -248,6 +351,8 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
248
351
|
thread = "pid-".concat(process.pid, "-worker-").concat(threadId);
|
|
249
352
|
error = result.error; // only apply default suites if not set by user
|
|
250
353
|
_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);
|
|
354
|
+
beforeHooksStack = this.beforeHooksStepsStack.get(test.id);
|
|
355
|
+
afterHooksStack = this.afterHooksStepsStack.get(test.id);
|
|
251
356
|
this.allureRuntime.updateTest(testUuid, function (testResult) {
|
|
252
357
|
testResult.labels.push(getHostLabel());
|
|
253
358
|
testResult.labels.push(getThreadLabel(thread));
|
|
@@ -287,20 +392,20 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
287
392
|
});
|
|
288
393
|
attachmentSteps = (_this$attachmentSteps2 = this.attachmentSteps.get(testUuid)) !== null && _this$attachmentSteps2 !== void 0 ? _this$attachmentSteps2 : [];
|
|
289
394
|
i = 0;
|
|
290
|
-
case
|
|
395
|
+
case 10:
|
|
291
396
|
if (!(i < result.attachments.length)) {
|
|
292
|
-
_context.next =
|
|
397
|
+
_context.next = 18;
|
|
293
398
|
break;
|
|
294
399
|
}
|
|
295
400
|
attachment = result.attachments[i];
|
|
296
401
|
attachmentStep = attachmentSteps.length > i ? attachmentSteps[i] : undefined;
|
|
297
|
-
_context.next =
|
|
402
|
+
_context.next = 15;
|
|
298
403
|
return this.processAttachment(testUuid, attachmentStep, attachment);
|
|
299
|
-
case
|
|
404
|
+
case 15:
|
|
300
405
|
i++;
|
|
301
|
-
_context.next =
|
|
406
|
+
_context.next = 10;
|
|
302
407
|
break;
|
|
303
|
-
case
|
|
408
|
+
case 18:
|
|
304
409
|
if (result.stdout.length > 0) {
|
|
305
410
|
this.allureRuntime.writeAttachment(testUuid, undefined, "stdout", Buffer.from(stripAnsi(result.stdout.join("")), "utf-8"), {
|
|
306
411
|
contentType: ContentType.TEXT
|
|
@@ -329,13 +434,23 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
329
434
|
}
|
|
330
435
|
return labelsGroup;
|
|
331
436
|
});
|
|
437
|
+
if (beforeHooksStack) {
|
|
438
|
+
var _testResult$steps;
|
|
439
|
+
(_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(beforeHooksStack.steps));
|
|
440
|
+
_this.beforeHooksStepsStack["delete"](test.id);
|
|
441
|
+
}
|
|
442
|
+
if (afterHooksStack) {
|
|
443
|
+
var _testResult$steps2;
|
|
444
|
+
(_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(afterHooksStack.steps));
|
|
445
|
+
_this.afterHooksStepsStack["delete"](test.id);
|
|
446
|
+
}
|
|
332
447
|
testResult.labels = newLabels;
|
|
333
448
|
});
|
|
334
449
|
this.allureRuntime.stopTest(testUuid, {
|
|
335
450
|
duration: result.duration
|
|
336
451
|
});
|
|
337
452
|
this.allureRuntime.writeTest(testUuid);
|
|
338
|
-
case
|
|
453
|
+
case 23:
|
|
339
454
|
case "end":
|
|
340
455
|
return _context.stop();
|
|
341
456
|
}
|
|
@@ -351,24 +466,24 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
351
466
|
value: function () {
|
|
352
467
|
var _addSkippedResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
353
468
|
var _this2 = this;
|
|
354
|
-
var unprocessedCases,
|
|
469
|
+
var unprocessedCases, _iterator2, _step2, testCase;
|
|
355
470
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
356
471
|
while (1) switch (_context2.prev = _context2.next) {
|
|
357
472
|
case 0:
|
|
358
|
-
unprocessedCases = this.suite.allTests().filter(function (
|
|
359
|
-
var title =
|
|
473
|
+
unprocessedCases = this.suite.allTests().filter(function (_ref4) {
|
|
474
|
+
var title = _ref4.title;
|
|
360
475
|
var titleMetadata = extractMetadataFromString(title);
|
|
361
476
|
return !_this2.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
|
|
362
477
|
});
|
|
363
|
-
|
|
478
|
+
_iterator2 = _createForOfIteratorHelper(unprocessedCases);
|
|
364
479
|
_context2.prev = 2;
|
|
365
|
-
|
|
480
|
+
_iterator2.s();
|
|
366
481
|
case 4:
|
|
367
|
-
if ((
|
|
482
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
368
483
|
_context2.next = 11;
|
|
369
484
|
break;
|
|
370
485
|
}
|
|
371
|
-
testCase =
|
|
486
|
+
testCase = _step2.value;
|
|
372
487
|
this.onTestBegin(testCase);
|
|
373
488
|
_context2.next = 9;
|
|
374
489
|
return this.onTestEnd(testCase, {
|
|
@@ -393,10 +508,10 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
393
508
|
case 13:
|
|
394
509
|
_context2.prev = 13;
|
|
395
510
|
_context2.t0 = _context2["catch"](2);
|
|
396
|
-
|
|
511
|
+
_iterator2.e(_context2.t0);
|
|
397
512
|
case 16:
|
|
398
513
|
_context2.prev = 16;
|
|
399
|
-
|
|
514
|
+
_iterator2.f();
|
|
400
515
|
return _context2.finish(16);
|
|
401
516
|
case 19:
|
|
402
517
|
case "end":
|
|
@@ -437,6 +552,21 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
437
552
|
value: function printsToStdio() {
|
|
438
553
|
return false;
|
|
439
554
|
}
|
|
555
|
+
}, {
|
|
556
|
+
key: "processStepMetadataMessage",
|
|
557
|
+
value: function processStepMetadataMessage(attachmentStepUuid, message) {
|
|
558
|
+
var _message$data = message.data,
|
|
559
|
+
name = _message$data.name,
|
|
560
|
+
_message$data$paramet = _message$data.parameters,
|
|
561
|
+
parameters = _message$data$paramet === void 0 ? [] : _message$data$paramet;
|
|
562
|
+
this.allureRuntime.updateStep(attachmentStepUuid, function (step) {
|
|
563
|
+
var _step$parameters;
|
|
564
|
+
if (name) {
|
|
565
|
+
step.name = name;
|
|
566
|
+
}
|
|
567
|
+
(_step$parameters = step.parameters).push.apply(_step$parameters, _toConsumableArray(parameters));
|
|
568
|
+
});
|
|
569
|
+
}
|
|
440
570
|
}, {
|
|
441
571
|
key: "processAttachment",
|
|
442
572
|
value: function () {
|
|
@@ -459,13 +589,20 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
459
589
|
return _context4.abrupt("return");
|
|
460
590
|
case 5:
|
|
461
591
|
if (!allureRuntimeMessage) {
|
|
462
|
-
_context4.next =
|
|
592
|
+
_context4.next = 12;
|
|
463
593
|
break;
|
|
464
594
|
}
|
|
465
|
-
message = JSON.parse(attachment.body.toString());
|
|
595
|
+
message = JSON.parse(attachment.body.toString());
|
|
596
|
+
if (!(message.type === "step_metadata")) {
|
|
597
|
+
_context4.next = 10;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
this.processStepMetadataMessage(attachmentStepUuid, message);
|
|
601
|
+
return _context4.abrupt("return");
|
|
602
|
+
case 10:
|
|
466
603
|
this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
|
|
467
604
|
return _context4.abrupt("return");
|
|
468
|
-
case
|
|
605
|
+
case 12:
|
|
469
606
|
parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
|
|
470
607
|
name: attachment.name
|
|
471
608
|
}); // only stop if step is created. Step may not be created only if test with specified uuid doesn't exists.
|
|
@@ -475,50 +612,50 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
475
612
|
this.allureRuntime.stopStep(parentUuid, undefined);
|
|
476
613
|
}
|
|
477
614
|
if (!attachment.body) {
|
|
478
|
-
_context4.next =
|
|
615
|
+
_context4.next = 18;
|
|
479
616
|
break;
|
|
480
617
|
}
|
|
481
618
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
|
|
482
619
|
contentType: attachment.contentType
|
|
483
620
|
});
|
|
484
|
-
_context4.next =
|
|
621
|
+
_context4.next = 23;
|
|
485
622
|
break;
|
|
486
|
-
case
|
|
623
|
+
case 18:
|
|
487
624
|
if (existsSync(attachment.path)) {
|
|
488
|
-
_context4.next =
|
|
625
|
+
_context4.next = 22;
|
|
489
626
|
break;
|
|
490
627
|
}
|
|
491
628
|
return _context4.abrupt("return");
|
|
492
|
-
case
|
|
629
|
+
case 22:
|
|
493
630
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
494
631
|
this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
|
|
495
632
|
contentType: attachment.contentType
|
|
496
633
|
});
|
|
497
|
-
case
|
|
634
|
+
case 23:
|
|
498
635
|
if (attachment.name.match(diffEndRegexp)) {
|
|
499
|
-
_context4.next =
|
|
636
|
+
_context4.next = 25;
|
|
500
637
|
break;
|
|
501
638
|
}
|
|
502
639
|
return _context4.abrupt("return");
|
|
503
|
-
case
|
|
640
|
+
case 25:
|
|
504
641
|
pathWithoutEnd = attachment.path.replace(diffEndRegexp, "");
|
|
505
642
|
if (!this.processedDiffs.includes(pathWithoutEnd)) {
|
|
506
|
-
_context4.next =
|
|
643
|
+
_context4.next = 28;
|
|
507
644
|
break;
|
|
508
645
|
}
|
|
509
646
|
return _context4.abrupt("return");
|
|
510
|
-
case
|
|
511
|
-
_context4.next =
|
|
647
|
+
case 28:
|
|
648
|
+
_context4.next = 30;
|
|
512
649
|
return readImageAsBase64("".concat(pathWithoutEnd, "-actual.png"));
|
|
513
|
-
case
|
|
650
|
+
case 30:
|
|
514
651
|
actualBase64 = _context4.sent;
|
|
515
|
-
_context4.next =
|
|
652
|
+
_context4.next = 33;
|
|
516
653
|
return readImageAsBase64("".concat(pathWithoutEnd, "-expected.png"));
|
|
517
|
-
case
|
|
654
|
+
case 33:
|
|
518
655
|
expectedBase64 = _context4.sent;
|
|
519
|
-
_context4.next =
|
|
656
|
+
_context4.next = 36;
|
|
520
657
|
return readImageAsBase64("".concat(pathWithoutEnd, "-diff.png"));
|
|
521
|
-
case
|
|
658
|
+
case 36:
|
|
522
659
|
diffBase64 = _context4.sent;
|
|
523
660
|
diffName = attachment.name.replace(diffEndRegexp, "");
|
|
524
661
|
this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
|
|
@@ -531,7 +668,7 @@ export var AllureReporter = /*#__PURE__*/function () {
|
|
|
531
668
|
fileExtension: ".imagediff"
|
|
532
669
|
});
|
|
533
670
|
this.processedDiffs.push(pathWithoutEnd);
|
|
534
|
-
case
|
|
671
|
+
case 40:
|
|
535
672
|
case "end":
|
|
536
673
|
return _context4.stop();
|
|
537
674
|
}
|
|
@@ -562,6 +699,11 @@ function _shouldIgnoreStep(step) {
|
|
|
562
699
|
if (step.category === "pw:api" && step.title === "route.continue()") {
|
|
563
700
|
return true;
|
|
564
701
|
}
|
|
702
|
+
|
|
703
|
+
// playwright doesn't report this step
|
|
704
|
+
if (step.title === "Worker Cleanup" || isDescendantOfStepWithTitle(step, "Worker Cleanup")) {
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
565
707
|
return false;
|
|
566
708
|
}
|
|
567
709
|
export var allure = allurePlaywrightLegacyApi;
|