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/dist/esm/index.js CHANGED
@@ -1,18 +1,18 @@
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); }
1
2
  function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
2
3
  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."); }
3
4
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
4
- 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 }; })(); }
5
- 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); }
6
- 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); }
7
- 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); }); }; }
8
- 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; } } }; }
9
5
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
10
6
  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."); }
11
- 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; } }
12
7
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
8
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
9
+ 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 }; })(); }
10
+ 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); }
11
+ 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; } } }; }
12
+ 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; } }
14
13
  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; }
15
- 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); }
14
+ 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); }
15
+ 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); }); }; }
16
16
  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; }
17
17
  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; }
18
18
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -26,7 +26,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
26
26
  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"); }
27
27
  import { existsSync } from "node:fs";
28
28
  import { access } from "node:fs/promises";
29
- import { createRequire } from "node:module";
30
29
  import path from "node:path";
31
30
  import process from "node:process";
32
31
 
@@ -34,12 +33,9 @@ import process from "node:process";
34
33
 
35
34
  import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
36
35
  import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
37
- import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, escapeRegExp, formatLink, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
36
+ import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, formatLink, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
38
37
  import { allurePlaywrightLegacyApi } from "./legacy.js";
39
38
  import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, finalizeStepResult, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
40
- var localRequire = typeof require === "function" ? require : createRequire(import.meta.url);
41
- var testPlanFilterSymbol = Symbol["for"]("allure-playwright.testPlanFilter");
42
- var testPlanFilterPatchSymbol = Symbol["for"]("allure-playwright.testPlanFilterPatch");
43
39
  var _AllureReporter_brand = /*#__PURE__*/new WeakSet();
44
40
  export var AllureReporter = /*#__PURE__*/function () {
45
41
  function AllureReporter(config) {
@@ -61,6 +57,7 @@ export var AllureReporter = /*#__PURE__*/function () {
61
57
  _defineProperty(this, "pendingAttachmentTasks", new Map());
62
58
  _defineProperty(this, "attachmentTargetByStep", new WeakMap());
63
59
  _defineProperty(this, "pwStepUuid", new WeakMap());
60
+ _defineProperty(this, "testFullNames", new WeakMap());
64
61
  _defineProperty(this, "emittedHookGlobalErrorKeys", new Set());
65
62
  _defineProperty(this, "testPlan", parseTestPlan());
66
63
  this.options = _objectSpread({
@@ -69,74 +66,116 @@ export var AllureReporter = /*#__PURE__*/function () {
69
66
  }, config);
70
67
  }
71
68
  return _createClass(AllureReporter, [{
69
+ key: "preprocess",
70
+ value: function () {
71
+ var _preprocess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
72
+ var suite, testRun, readonlyProjectNames, _iterator, _step, projectSuite, project, _iterator2, _step2, _projectSuite, _project, readonlyProject, _iterator3, _step3, test, metadata, _t, _t2;
73
+ return _regenerator().w(function (_context) {
74
+ while (1) switch (_context.n) {
75
+ case 0:
76
+ suite = _ref.suite, testRun = _ref.testRun;
77
+ if (this.testPlan) {
78
+ _context.n = 1;
79
+ break;
80
+ }
81
+ return _context.a(2);
82
+ case 1:
83
+ readonlyProjectNames = new Set();
84
+ _iterator = _createForOfIteratorHelper(suite.suites);
85
+ try {
86
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
87
+ projectSuite = _step.value;
88
+ project = projectSuite.project();
89
+ project === null || project === void 0 || project.dependencies.forEach(function (dependency) {
90
+ return readonlyProjectNames.add(dependency);
91
+ });
92
+ if (project !== null && project !== void 0 && project.teardown) {
93
+ readonlyProjectNames.add(project.teardown);
94
+ }
95
+ }
96
+ } catch (err) {
97
+ _iterator.e(err);
98
+ } finally {
99
+ _iterator.f();
100
+ }
101
+ _iterator2 = _createForOfIteratorHelper(suite.suites);
102
+ _context.p = 2;
103
+ _iterator2.s();
104
+ case 3:
105
+ if ((_step2 = _iterator2.n()).done) {
106
+ _context.n = 13;
107
+ break;
108
+ }
109
+ _projectSuite = _step2.value;
110
+ _project = _projectSuite.project();
111
+ readonlyProject = _project ? readonlyProjectNames.has(_project.name) : false;
112
+ if (!readonlyProject) {
113
+ _context.n = 4;
114
+ break;
115
+ }
116
+ return _context.a(3, 12);
117
+ case 4:
118
+ _iterator3 = _createForOfIteratorHelper(_projectSuite.allTests());
119
+ _context.p = 5;
120
+ _iterator3.s();
121
+ case 6:
122
+ if ((_step3 = _iterator3.n()).done) {
123
+ _context.n = 9;
124
+ break;
125
+ }
126
+ test = _step3.value;
127
+ metadata = this.getStaticTestMetadata(test);
128
+ if (!this.isInTestPlan(test, metadata)) {
129
+ _context.n = 7;
130
+ break;
131
+ }
132
+ return _context.a(3, 8);
133
+ case 7:
134
+ testRun.exclude(test);
135
+ case 8:
136
+ _context.n = 6;
137
+ break;
138
+ case 9:
139
+ _context.n = 11;
140
+ break;
141
+ case 10:
142
+ _context.p = 10;
143
+ _t = _context.v;
144
+ _iterator3.e(_t);
145
+ case 11:
146
+ _context.p = 11;
147
+ _iterator3.f();
148
+ return _context.f(11);
149
+ case 12:
150
+ _context.n = 3;
151
+ break;
152
+ case 13:
153
+ _context.n = 15;
154
+ break;
155
+ case 14:
156
+ _context.p = 14;
157
+ _t2 = _context.v;
158
+ _iterator2.e(_t2);
159
+ case 15:
160
+ _context.p = 15;
161
+ _iterator2.f();
162
+ return _context.f(15);
163
+ case 16:
164
+ return _context.a(2);
165
+ }
166
+ }, _callee, this, [[5, 10, 11, 12], [2, 14, 15, 16]]);
167
+ }));
168
+ function preprocess(_x) {
169
+ return _preprocess.apply(this, arguments);
170
+ }
171
+ return preprocess;
172
+ }()
173
+ }, {
72
174
  key: "onConfigure",
73
175
  value: function onConfigure(config) {
74
- var _configElement$preOnl,
75
- _this = this;
76
176
  this.config = config;
77
177
  this.outputDir = config.projects[0].outputDir;
78
178
  this.snapshotDir = config.projects[0].snapshotDir;
79
- var testPlan = this.testPlan;
80
- if (!testPlan) {
81
- return;
82
- }
83
- this.installTestPlanExecutionFilter();
84
- var configElement = Object.getOwnPropertySymbols(config).map(function (symbol) {
85
- return config[symbol];
86
- }).find(function (value) {
87
- return _typeof(value) === "object" && value !== null && ("preOnlyTestFilters" in value || "cliArgs" in value);
88
- });
89
- configElement === null || configElement === void 0 || (_configElement$preOnl = configElement.preOnlyTestFilters) === null || _configElement$preOnl === void 0 || _configElement$preOnl.push(function (test) {
90
- return _this.isInTestPlan(test);
91
- });
92
- if (testPlan.tests.some(function (test) {
93
- return test.id !== undefined;
94
- })) {
95
- return;
96
- }
97
- var testsWithSelectors = testPlan.tests.filter(function (test) {
98
- return test.selector;
99
- });
100
- var v1ReporterTests = [];
101
- var v2ReporterTests = [];
102
- var cliArgs = [];
103
- testsWithSelectors.forEach(function (test) {
104
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
105
- if (!/#/.test(test.selector)) {
106
- v2ReporterTests.push(test);
107
- return;
108
- }
109
- v1ReporterTests.push(test);
110
- });
111
-
112
- // The path needs to be specific to the current OS. Otherwise, it may not match against the test file.
113
- var selectorToGrepPattern = function selectorToGrepPattern(selector) {
114
- return escapeRegExp(path.normalize("/".concat(selector)));
115
- };
116
- if (v2ReporterTests.length) {
117
- // we need to cut off column because playwright works only with line number
118
- var v2SelectorsArgs = v2ReporterTests
119
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
120
- .map(function (test) {
121
- return test.selector.replace(/:\d+$/, "");
122
- }).map(selectorToGrepPattern);
123
- cliArgs.push.apply(cliArgs, _toConsumableArray(v2SelectorsArgs));
124
- }
125
- if (v1ReporterTests.length) {
126
- var v1SelectorsArgs = v1ReporterTests
127
- // we can filter tests only by absolute path, so we need to cut off test name
128
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
129
- .map(function (test) {
130
- return test.selector.split("#")[0];
131
- }).map(selectorToGrepPattern);
132
- cliArgs.push.apply(cliArgs, _toConsumableArray(v1SelectorsArgs));
133
- }
134
- if (!cliArgs.length) {
135
- return;
136
- }
137
- if (configElement) {
138
- configElement.cliArgs = cliArgs;
139
- }
140
179
  }
141
180
  }, {
142
181
  key: "onError",
@@ -188,21 +227,21 @@ export var AllureReporter = /*#__PURE__*/function () {
188
227
 
189
228
  // support for earlier playwright versions
190
229
  if ("tags" in test) {
191
- var _ref;
230
+ var _ref2;
192
231
  var tags = test.tags.map(function (tag) {
193
232
  return {
194
233
  name: LabelName.TAG,
195
234
  value: tag.startsWith("@") ? tag.substring(1) : tag
196
235
  };
197
236
  });
198
- (_ref = result.labels).push.apply(_ref, _toConsumableArray(tags));
237
+ (_ref2 = result.labels).push.apply(_ref2, _toConsumableArray(tags));
199
238
  }
200
239
  if ("annotations" in test) {
201
- var _iterator = _createForOfIteratorHelper(test.annotations),
202
- _step;
240
+ var _iterator4 = _createForOfIteratorHelper(test.annotations),
241
+ _step4;
203
242
  try {
204
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
205
- var annotation = _step.value;
243
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
244
+ var annotation = _step4.value;
206
245
  if (annotation.type === "skip" || annotation.type === "fixme") {
207
246
  continue;
208
247
  }
@@ -242,9 +281,9 @@ export var AllureReporter = /*#__PURE__*/function () {
242
281
  });
243
282
  }
244
283
  } catch (err) {
245
- _iterator.e(err);
284
+ _iterator4.e(err);
246
285
  } finally {
247
- _iterator.f();
286
+ _iterator4.f();
248
287
  }
249
288
  }
250
289
  if ((_metadata$project = metadata.project) !== null && _metadata$project !== void 0 && _metadata$project.name) {
@@ -274,26 +313,26 @@ export var AllureReporter = /*#__PURE__*/function () {
274
313
  }, {
275
314
  key: "flushAttachmentTasks",
276
315
  value: function () {
277
- var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(testId) {
316
+ var _flushAttachmentTasks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(testId) {
278
317
  var _this$pendingAttachme2;
279
318
  var tasks;
280
- return _regenerator().w(function (_context) {
281
- while (1) switch (_context.n) {
319
+ return _regenerator().w(function (_context2) {
320
+ while (1) switch (_context2.n) {
282
321
  case 0:
283
322
  tasks = (_this$pendingAttachme2 = this.pendingAttachmentTasks.get(testId)) !== null && _this$pendingAttachme2 !== void 0 ? _this$pendingAttachme2 : [];
284
323
  this.pendingAttachmentTasks["delete"](testId);
285
324
  if (!(tasks.length > 0)) {
286
- _context.n = 1;
325
+ _context2.n = 1;
287
326
  break;
288
327
  }
289
- _context.n = 1;
328
+ _context2.n = 1;
290
329
  return Promise.all(tasks);
291
330
  case 1:
292
- return _context.a(2);
331
+ return _context2.a(2);
293
332
  }
294
- }, _callee, this);
333
+ }, _callee2, this);
295
334
  }));
296
- function flushAttachmentTasks(_x) {
335
+ function flushAttachmentTasks(_x2) {
297
336
  return _flushAttachmentTasks.apply(this, arguments);
298
337
  }
299
338
  return flushAttachmentTasks;
@@ -321,19 +360,19 @@ export var AllureReporter = /*#__PURE__*/function () {
321
360
  steps.splice(index, 1);
322
361
  return true;
323
362
  }
324
- var _iterator2 = _createForOfIteratorHelper(steps),
325
- _step2;
363
+ var _iterator5 = _createForOfIteratorHelper(steps),
364
+ _step5;
326
365
  try {
327
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
328
- var step = _step2.value;
366
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
367
+ var step = _step5.value;
329
368
  if (this.removeHookAttachmentPlaceholder(step.steps, stepUuid)) {
330
369
  return true;
331
370
  }
332
371
  }
333
372
  } catch (err) {
334
- _iterator2.e(err);
373
+ _iterator5.e(err);
335
374
  } finally {
336
- _iterator2.f();
375
+ _iterator5.f();
337
376
  }
338
377
  return false;
339
378
  }
@@ -358,13 +397,13 @@ export var AllureReporter = /*#__PURE__*/function () {
358
397
  }, {
359
398
  key: "addRuntimeAttachmentToHookStack",
360
399
  value: function addRuntimeAttachmentToHookStack(targetStack, attachment, options) {
361
- var _this2 = this;
400
+ var _this = this;
362
401
  var currentStep = targetStack.currentStep();
363
402
  if (!currentStep) {
364
403
  return;
365
404
  }
366
405
  var addAttachment = function addAttachment(stepResult) {
367
- var fileName = targetStack.addAttachment(attachment, _this2.allureRuntime.writer);
406
+ var fileName = targetStack.addAttachment(attachment, _this.allureRuntime.writer);
368
407
  stepResult.attachments.push({
369
408
  name: attachment.name,
370
409
  type: attachment.contentType,
@@ -482,12 +521,12 @@ export var AllureReporter = /*#__PURE__*/function () {
482
521
  }
483
522
  return;
484
523
  }
485
- var _iterator3 = _createForOfIteratorHelper(stepAttachments),
486
- _step3;
524
+ var _iterator6 = _createForOfIteratorHelper(stepAttachments),
525
+ _step6;
487
526
  try {
488
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
527
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
489
528
  var _stepInfo$hookStep$uu, _stepInfo$hookStep;
490
- var attachment = _step3.value;
529
+ var attachment = _step6.value;
491
530
  var isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
492
531
  var attachmentTarget = _objectSpread(_objectSpread({}, stepInfo), {}, {
493
532
  name: attachment.name
@@ -511,9 +550,9 @@ export var AllureReporter = /*#__PURE__*/function () {
511
550
  this.queueAttachmentTask(test.id, this.processAttachment(testUuid, attachmentStepUuid, attachment));
512
551
  }
513
552
  } catch (err) {
514
- _iterator3.e(err);
553
+ _iterator6.e(err);
515
554
  } finally {
516
- _iterator3.f();
555
+ _iterator6.f();
517
556
  }
518
557
  }
519
558
  }, {
@@ -671,21 +710,21 @@ export var AllureReporter = /*#__PURE__*/function () {
671
710
  }, {
672
711
  key: "onTestEnd",
673
712
  value: function () {
674
- var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(test, result) {
675
- var _this3 = this,
713
+ var _onTestEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(test, result) {
714
+ var _this2 = this,
676
715
  _this$attachmentTarge2;
677
- var testUuid, threadId, thread, error, _test$parent$titlePat, _test$parent$titlePat2, projectSuiteTitle, fileSuiteTitle, suiteTitles, beforeHooksStack, afterHooksStack, targets, targetsByName, _iterator4, _step4, _targetsByName$get, t, q, takeByName, _iterator5, _step5, attachment, isRuntimeMessage, stepInfo, _stepInfo$hookStep$uu2, _stepInfo$hookStep2, message, targetStack, _targetStack, stepUuid, _targetStack2, stepResult, fileName, _t;
678
- return _regenerator().w(function (_context2) {
679
- while (1) switch (_context2.n) {
716
+ 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;
717
+ return _regenerator().w(function (_context3) {
718
+ while (1) switch (_context3.n) {
680
719
  case 0:
681
720
  testUuid = this.allureResultsUuids.get(test.id);
682
721
  if (testUuid) {
683
- _context2.n = 1;
722
+ _context3.n = 1;
684
723
  break;
685
724
  }
686
725
  // eslint-disable-next-line no-console
687
726
  console.warn("[allure-playwright] Ignoring onTestEnd for \"".concat(test.title, "\" because no Allure test result has been started."));
688
- return _context2.a(2);
727
+ return _context3.a(2);
689
728
  case 1:
690
729
  // We need to check parallelIndex first because pw introduced this field only in v1.30.0
691
730
  threadId = result.parallelIndex !== undefined ? result.parallelIndex : result.workerIndex;
@@ -703,7 +742,7 @@ export var AllureReporter = /*#__PURE__*/function () {
703
742
  value: projectSuiteTitle
704
743
  });
705
744
  }
706
- if (_this3.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
745
+ if (_this2.options.suiteTitle && fileSuiteTitle && !hasLabel(testResult, LabelName.SUITE)) {
707
746
  testResult.labels.push({
708
747
  name: LabelName.SUITE,
709
748
  value: fileSuiteTitle
@@ -752,18 +791,18 @@ export var AllureReporter = /*#__PURE__*/function () {
752
791
  // FIFO
753
792
  targets = (_this$attachmentTarge2 = this.attachmentTargets.get(test.id)) !== null && _this$attachmentTarge2 !== void 0 ? _this$attachmentTarge2 : [];
754
793
  targetsByName = new Map();
755
- _iterator4 = _createForOfIteratorHelper(targets);
794
+ _iterator7 = _createForOfIteratorHelper(targets);
756
795
  try {
757
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
758
- t = _step4.value;
796
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
797
+ t = _step7.value;
759
798
  q = (_targetsByName$get = targetsByName.get(t.name)) !== null && _targetsByName$get !== void 0 ? _targetsByName$get : [];
760
799
  q.push(t);
761
800
  targetsByName.set(t.name, q);
762
801
  }
763
802
  } catch (err) {
764
- _iterator4.e(err);
803
+ _iterator7.e(err);
765
804
  } finally {
766
- _iterator4.f();
805
+ _iterator7.f();
767
806
  }
768
807
  takeByName = function takeByName(name) {
769
808
  var target = targetsByName.get(name);
@@ -772,25 +811,25 @@ export var AllureReporter = /*#__PURE__*/function () {
772
811
  }
773
812
  return target.shift();
774
813
  };
775
- _iterator5 = _createForOfIteratorHelper(result.attachments);
776
- _context2.p = 2;
777
- _iterator5.s();
814
+ _iterator8 = _createForOfIteratorHelper(result.attachments);
815
+ _context3.p = 2;
816
+ _iterator8.s();
778
817
  case 3:
779
- if ((_step5 = _iterator5.n()).done) {
780
- _context2.n = 12;
818
+ if ((_step8 = _iterator8.n()).done) {
819
+ _context3.n = 12;
781
820
  break;
782
821
  }
783
- attachment = _step5.value;
822
+ attachment = _step8.value;
784
823
  isRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
785
824
  stepInfo = takeByName(attachment.name);
786
825
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.processedAtStepEnd)) {
787
- _context2.n = 4;
826
+ _context3.n = 4;
788
827
  break;
789
828
  }
790
- return _context2.a(3, 11);
829
+ return _context3.a(3, 11);
791
830
  case 4:
792
831
  if (!isRuntimeMessage) {
793
- _context2.n = 7;
832
+ _context3.n = 7;
794
833
  break;
795
834
  }
796
835
  message = attachment.body ? JSON.parse(attachment.body.toString()) : undefined;
@@ -799,7 +838,7 @@ export var AllureReporter = /*#__PURE__*/function () {
799
838
  this.removeStepFromHookStack(targetStack, stepInfo.hookStep.uuid);
800
839
  }
801
840
  if (!((message === null || message === void 0 ? void 0 : message.type) === "step_metadata" && stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
802
- _context2.n = 5;
841
+ _context3.n = 5;
803
842
  break;
804
843
  }
805
844
  if (stepInfo.hookStep) {
@@ -808,16 +847,16 @@ export var AllureReporter = /*#__PURE__*/function () {
808
847
  } else {
809
848
  this.processStepMetadataMessage(stepInfo.stepUuid, message);
810
849
  }
811
- return _context2.a(3, 11);
850
+ return _context3.a(3, 11);
812
851
  case 5:
813
852
  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;
814
- _context2.n = 6;
853
+ _context3.n = 6;
815
854
  return this.processAttachment(testUuid, stepUuid, attachment);
816
855
  case 6:
817
- return _context2.a(3, 11);
856
+ return _context3.a(3, 11);
818
857
  case 7:
819
858
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.hookStep)) {
820
- _context2.n = 8;
859
+ _context3.n = 8;
821
860
  break;
822
861
  }
823
862
  _targetStack2 = this.getHookStepsStack(test.id, stepInfo.hookStep);
@@ -832,35 +871,35 @@ export var AllureReporter = /*#__PURE__*/function () {
832
871
  });
833
872
  }
834
873
  }
835
- return _context2.a(3, 11);
874
+ return _context3.a(3, 11);
836
875
  case 8:
837
876
  if (!(stepInfo !== null && stepInfo !== void 0 && stepInfo.stepUuid)) {
838
- _context2.n = 10;
877
+ _context3.n = 10;
839
878
  break;
840
879
  }
841
- _context2.n = 9;
880
+ _context3.n = 9;
842
881
  return this.processAttachment(testUuid, stepInfo.stepUuid, attachment);
843
882
  case 9:
844
- return _context2.a(3, 11);
883
+ return _context3.a(3, 11);
845
884
  case 10:
846
- _context2.n = 11;
885
+ _context3.n = 11;
847
886
  return this.processAttachment(testUuid, undefined, attachment);
848
887
  case 11:
849
- _context2.n = 3;
888
+ _context3.n = 3;
850
889
  break;
851
890
  case 12:
852
- _context2.n = 14;
891
+ _context3.n = 14;
853
892
  break;
854
893
  case 13:
855
- _context2.p = 13;
856
- _t = _context2.v;
857
- _iterator5.e(_t);
894
+ _context3.p = 13;
895
+ _t3 = _context3.v;
896
+ _iterator8.e(_t3);
858
897
  case 14:
859
- _context2.p = 14;
860
- _iterator5.f();
861
- return _context2.f(14);
898
+ _context3.p = 14;
899
+ _iterator8.f();
900
+ return _context3.f(14);
862
901
  case 15:
863
- _context2.n = 16;
902
+ _context3.n = 16;
864
903
  return this.flushAttachmentTasks(test.id);
865
904
  case 16:
866
905
  // FIXME: temp logic for labels override, we need it here to keep the reporter compatible with v2 API
@@ -882,14 +921,14 @@ export var AllureReporter = /*#__PURE__*/function () {
882
921
  });
883
922
  if (beforeHooksStack) {
884
923
  var _testResult$steps;
885
- (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this3.pruneEmptyHookRoots(beforeHooksStack.steps)));
924
+ (_testResult$steps = testResult.steps).unshift.apply(_testResult$steps, _toConsumableArray(_this2.pruneEmptyHookRoots(beforeHooksStack.steps)));
886
925
  }
887
- _this3.beforeHooksStepsStack["delete"](test.id);
926
+ _this2.beforeHooksStepsStack["delete"](test.id);
888
927
  if (afterHooksStack) {
889
928
  var _testResult$steps2;
890
- (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this3.pruneEmptyHookRoots(afterHooksStack.steps)));
929
+ (_testResult$steps2 = testResult.steps).push.apply(_testResult$steps2, _toConsumableArray(_this2.pruneEmptyHookRoots(afterHooksStack.steps)));
891
930
  }
892
- _this3.afterHooksStepsStack["delete"](test.id);
931
+ _this2.afterHooksStepsStack["delete"](test.id);
893
932
  testResult.labels = newLabels;
894
933
  });
895
934
  this.allureRuntime.stopTest(testUuid, {
@@ -899,11 +938,11 @@ export var AllureReporter = /*#__PURE__*/function () {
899
938
  this.attachmentTargets["delete"](test.id);
900
939
  this.pendingAttachmentTasks["delete"](test.id);
901
940
  case 17:
902
- return _context2.a(2);
941
+ return _context3.a(2);
903
942
  }
904
- }, _callee2, this, [[2, 13, 14, 15]]);
943
+ }, _callee3, this, [[2, 13, 14, 15]]);
905
944
  }));
906
- function onTestEnd(_x2, _x3) {
945
+ function onTestEnd(_x3, _x4) {
907
946
  return _onTestEnd.apply(this, arguments);
908
947
  }
909
948
  return onTestEnd;
@@ -926,28 +965,28 @@ export var AllureReporter = /*#__PURE__*/function () {
926
965
  }, {
927
966
  key: "addSkippedResults",
928
967
  value: function () {
929
- var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
930
- var _this4 = this;
931
- var unprocessedCases, _iterator6, _step6, testCase, _t2;
932
- return _regenerator().w(function (_context3) {
933
- while (1) switch (_context3.n) {
968
+ var _addSkippedResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
969
+ var _this3 = this;
970
+ var unprocessedCases, _iterator9, _step9, testCase, _t4;
971
+ return _regenerator().w(function (_context4) {
972
+ while (1) switch (_context4.n) {
934
973
  case 0:
935
974
  unprocessedCases = this.suite.allTests().filter(function (testCase) {
936
975
  var title = testCase.title;
937
976
  var titleMetadata = extractMetadataFromString(title);
938
- return !_this4.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
977
+ return !_this3.startedTestCasesTitlesCache.includes(titleMetadata.cleanTitle);
939
978
  });
940
- _iterator6 = _createForOfIteratorHelper(unprocessedCases);
941
- _context3.p = 1;
942
- _iterator6.s();
979
+ _iterator9 = _createForOfIteratorHelper(unprocessedCases);
980
+ _context4.p = 1;
981
+ _iterator9.s();
943
982
  case 2:
944
- if ((_step6 = _iterator6.n()).done) {
945
- _context3.n = 4;
983
+ if ((_step9 = _iterator9.n()).done) {
984
+ _context4.n = 4;
946
985
  break;
947
986
  }
948
- testCase = _step6.value;
987
+ testCase = _step9.value;
949
988
  this.onTestBegin(testCase);
950
- _context3.n = 3;
989
+ _context4.n = 3;
951
990
  return this.onTestEnd(testCase, {
952
991
  status: Status.SKIPPED,
953
992
  attachments: [],
@@ -963,23 +1002,23 @@ export var AllureReporter = /*#__PURE__*/function () {
963
1002
  annotations: []
964
1003
  });
965
1004
  case 3:
966
- _context3.n = 2;
1005
+ _context4.n = 2;
967
1006
  break;
968
1007
  case 4:
969
- _context3.n = 6;
1008
+ _context4.n = 6;
970
1009
  break;
971
1010
  case 5:
972
- _context3.p = 5;
973
- _t2 = _context3.v;
974
- _iterator6.e(_t2);
1011
+ _context4.p = 5;
1012
+ _t4 = _context4.v;
1013
+ _iterator9.e(_t4);
975
1014
  case 6:
976
- _context3.p = 6;
977
- _iterator6.f();
978
- return _context3.f(6);
1015
+ _context4.p = 6;
1016
+ _iterator9.f();
1017
+ return _context4.f(6);
979
1018
  case 7:
980
- return _context3.a(2);
1019
+ return _context4.a(2);
981
1020
  }
982
- }, _callee3, this, [[1, 5, 6, 7]]);
1021
+ }, _callee4, this, [[1, 5, 6, 7]]);
983
1022
  }));
984
1023
  function addSkippedResults() {
985
1024
  return _addSkippedResults.apply(this, arguments);
@@ -989,19 +1028,19 @@ export var AllureReporter = /*#__PURE__*/function () {
989
1028
  }, {
990
1029
  key: "onEnd",
991
1030
  value: function () {
992
- var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
993
- return _regenerator().w(function (_context4) {
994
- while (1) switch (_context4.n) {
1031
+ var _onEnd = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1032
+ return _regenerator().w(function (_context5) {
1033
+ while (1) switch (_context5.n) {
995
1034
  case 0:
996
- _context4.n = 1;
1035
+ _context5.n = 1;
997
1036
  return this.addSkippedResults();
998
1037
  case 1:
999
1038
  this.allureRuntime.writeEnvironmentInfo();
1000
1039
  this.allureRuntime.writeCategoriesDefinitions();
1001
1040
  case 2:
1002
- return _context4.a(2);
1041
+ return _context5.a(2);
1003
1042
  }
1004
- }, _callee4, this);
1043
+ }, _callee5, this);
1005
1044
  }));
1006
1045
  function onEnd() {
1007
1046
  return _onEnd.apply(this, arguments);
@@ -1024,19 +1063,19 @@ export var AllureReporter = /*#__PURE__*/function () {
1024
1063
  }, {
1025
1064
  key: "pruneEmptyHookRoots",
1026
1065
  value: function pruneEmptyHookRoots(steps) {
1027
- var _this5 = this;
1066
+ var _this4 = this;
1028
1067
  return steps.map(function (step) {
1029
1068
  return _objectSpread(_objectSpread({}, step), {}, {
1030
- steps: _this5.pruneEmptyHookRoots(step.steps)
1069
+ steps: _this4.pruneEmptyHookRoots(step.steps)
1031
1070
  });
1032
1071
  }).filter(function (step) {
1033
- return !_this5.isEmptyPassedHookRoot(step);
1072
+ return !_this4.isEmptyPassedHookRoot(step);
1034
1073
  });
1035
1074
  }
1036
1075
  }, {
1037
1076
  key: "removeStepFromHookStack",
1038
1077
  value: function removeStepFromHookStack(stack, stepUuid) {
1039
- var _this6 = this;
1078
+ var _this5 = this;
1040
1079
  if (!stack) {
1041
1080
  return;
1042
1081
  }
@@ -1048,49 +1087,46 @@ export var AllureReporter = /*#__PURE__*/function () {
1048
1087
  steps: _removeRecursively(step.steps)
1049
1088
  });
1050
1089
  }).filter(function (step) {
1051
- return !_this6.isEmptyPassedHookRoot(step);
1090
+ return !_this5.isEmptyPassedHookRoot(step);
1052
1091
  });
1053
1092
  };
1054
1093
  stack.steps = _removeRecursively(stack.steps);
1055
1094
  }
1056
1095
  }, {
1057
1096
  key: "getStaticTestMetadata",
1058
- value: function getStaticTestMetadata(test, parentSuite) {
1059
- var _ref2, _testParent$project, _testParent$titlePath, _titleMetadata$labels;
1097
+ value: function getStaticTestMetadata(test) {
1098
+ var _ref3, _test$parent$project, _titleMetadata$labels;
1060
1099
  var titleMetadata = extractMetadataFromString(test.title);
1061
- var testParent = parentSuite !== null && parentSuite !== void 0 ? parentSuite : test.parent;
1062
- 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) {
1100
+ var project = (_ref3 = (_test$parent$project = test.parent.project()) !== null && _test$parent$project !== void 0 ? _test$parent$project : this.config.projects.find(function (candidate) {
1063
1101
  return test.location.file === candidate.testDir || test.location.file.startsWith("".concat(candidate.testDir).concat(path.sep));
1064
- })) !== null && _ref2 !== void 0 ? _ref2 : this.config.projects[0];
1102
+ })) !== null && _ref3 !== void 0 ? _ref3 : this.config.projects[0];
1065
1103
  var testFilePath = path.relative(project.testDir, test.location.file);
1066
1104
  var relativeFileParts = testFilePath.split(path.sep);
1067
1105
  var relativeFile = relativeFileParts.join("/");
1068
- var normalizedAbsoluteFile = path.normalize(test.location.file);
1069
- var normalizedRelativeFile = path.normalize(testFilePath);
1070
- var fileTitleCandidates = new Set([normalizedAbsoluteFile, normalizedRelativeFile, relativeFile]);
1071
- var suiteTitles = (_testParent$titlePath = testParent === null || testParent === void 0 ? void 0 : testParent.titlePath().filter(Boolean)) !== null && _testParent$titlePath !== void 0 ? _testParent$titlePath : [];
1072
- if (project.name && suiteTitles[0] === project.name) {
1073
- suiteTitles = suiteTitles.slice(1);
1074
- }
1075
- if (suiteTitles.length > 0 && fileTitleCandidates.has(path.normalize(suiteTitles[0]))) {
1076
- suiteTitles = suiteTitles.slice(1);
1077
- }
1106
+ var suiteTitles = test.titlePath().slice(3, -1);
1078
1107
  var suitePrefix = suiteTitles.length > 0 ? "".concat(suiteTitles.join(" "), " ") : "";
1079
1108
  var projectRootSearchFrom = path.dirname(test.location.file);
1080
1109
  var projectName = getProjectName(projectRootSearchFrom);
1081
1110
  var testCaseIdBase = "".concat(relativeFile, "#").concat(suitePrefix).concat(test.title);
1082
1111
  var legacyFullName = "".concat(relativeFile, "#").concat(suitePrefix).concat(titleMetadata.cleanTitle);
1112
+ var locationFullName = "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column);
1113
+ var fullName = this.testFullNames.get(test);
1083
1114
  var staticAllureId = (_titleMetadata$labels = titleMetadata.labels.find(function (label) {
1084
1115
  return label.name === LabelName.ALLURE_ID;
1085
1116
  })) === null || _titleMetadata$labels === void 0 ? void 0 : _titleMetadata$labels.value;
1117
+ if (!fullName) {
1118
+ var testFile = path.relative(this.config.rootDir, test.location.file).split(path.sep).join("/");
1119
+ fullName = [testFile].concat(_toConsumableArray(test.titlePath().slice(3))).join(" › ");
1120
+ this.testFullNames.set(test, fullName);
1121
+ }
1086
1122
 
1087
1123
  // Test-plan matching happens during discovery, so runtime API labels are intentionally excluded here.
1088
1124
  if (!staticAllureId && "annotations" in test) {
1089
- var _iterator7 = _createForOfIteratorHelper(test.annotations),
1090
- _step7;
1125
+ var _iterator0 = _createForOfIteratorHelper(test.annotations),
1126
+ _step0;
1091
1127
  try {
1092
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1093
- var annotation = _step7.value;
1128
+ for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
1129
+ var annotation = _step0.value;
1094
1130
  var label = getMetadataLabel(annotation.type, annotation.description);
1095
1131
  if ((label === null || label === void 0 ? void 0 : label.name) === LabelName.ALLURE_ID) {
1096
1132
  staticAllureId = label.value;
@@ -1098,9 +1134,9 @@ export var AllureReporter = /*#__PURE__*/function () {
1098
1134
  }
1099
1135
  }
1100
1136
  } catch (err) {
1101
- _iterator7.e(err);
1137
+ _iterator0.e(err);
1102
1138
  } finally {
1103
- _iterator7.f();
1139
+ _iterator0.f();
1104
1140
  }
1105
1141
  }
1106
1142
  return {
@@ -1113,81 +1149,32 @@ export var AllureReporter = /*#__PURE__*/function () {
1113
1149
  testCaseIdBase: projectName ? "".concat(projectName, ":").concat(testCaseIdBase) : testCaseIdBase,
1114
1150
  legacyTestCaseIdBase: testCaseIdBase,
1115
1151
  titleMetadata: titleMetadata,
1116
- fullName: "".concat(relativeFile, ":").concat(test.location.line, ":").concat(test.location.column),
1152
+ fullName: fullName,
1153
+ locationFullName: locationFullName,
1117
1154
  legacyFullName: legacyFullName,
1118
1155
  staticAllureId: staticAllureId
1119
1156
  };
1120
1157
  }
1121
1158
  }, {
1122
1159
  key: "isInTestPlan",
1123
- value: function isInTestPlan(test, parentSuite) {
1160
+ value: function isInTestPlan(test) {
1161
+ var metadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getStaticTestMetadata(test);
1124
1162
  if (!this.testPlan) {
1125
1163
  return true;
1126
1164
  }
1127
- var _this$getStaticTestMe = this.getStaticTestMetadata(test, parentSuite),
1128
- fullName = _this$getStaticTestMe.fullName,
1129
- legacyFullName = _this$getStaticTestMe.legacyFullName,
1130
- staticAllureId = _this$getStaticTestMe.staticAllureId;
1165
+ var fullName = metadata.fullName,
1166
+ locationFullName = metadata.locationFullName,
1167
+ legacyFullName = metadata.legacyFullName,
1168
+ staticAllureId = metadata.staticAllureId;
1131
1169
  return includedInTestPlan(this.testPlan, {
1132
- fullName: fullName,
1170
+ fullName: locationFullName,
1171
+ nativeSelector: fullName,
1133
1172
  id: staticAllureId
1134
1173
  }) || includedInTestPlan(this.testPlan, {
1135
1174
  fullName: legacyFullName,
1136
1175
  id: staticAllureId
1137
1176
  });
1138
1177
  }
1139
- }, {
1140
- key: "installTestPlanExecutionFilter",
1141
- value: function installTestPlanExecutionFilter() {
1142
- var _this7 = this;
1143
- var suitePrototype = this.getPlaywrightSuitePrototype();
1144
- if (!(suitePrototype !== null && suitePrototype !== void 0 && suitePrototype._addTest)) {
1145
- // eslint-disable-next-line no-console
1146
- 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.");
1147
- return;
1148
- }
1149
- var patchedSuitePrototype = suitePrototype;
1150
- patchedSuitePrototype[testPlanFilterSymbol] = function (test, parentSuite) {
1151
- return _this7.isInTestPlan(test, parentSuite);
1152
- };
1153
- if (patchedSuitePrototype[testPlanFilterPatchSymbol]) {
1154
- return;
1155
- }
1156
- var addTest = suitePrototype._addTest;
1157
-
1158
- // Dear Pavel: break us all day long you may; find the way back, my Codex and I always will.
1159
- suitePrototype._addTest = function (test) {
1160
- var testPlanFilter = patchedSuitePrototype[testPlanFilterSymbol];
1161
- if (testPlanFilter && !testPlanFilter(test, this)) {
1162
- return;
1163
- }
1164
- return addTest.call(this, test);
1165
- };
1166
- patchedSuitePrototype[testPlanFilterPatchSymbol] = true;
1167
- }
1168
- }, {
1169
- key: "getPlaywrightSuitePrototype",
1170
- value: function getPlaywrightSuitePrototype() {
1171
- var playwrightTestRequire = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createRequire(localRequire.resolve("@playwright/test"));
1172
- try {
1173
- var _playwrightCommon$tes;
1174
- var playwrightCommon = playwrightTestRequire("playwright/lib/common");
1175
- 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;
1176
- if (suitePrototype) {
1177
- return suitePrototype;
1178
- }
1179
- } catch (_unused) {
1180
- // Playwright 1.53-1.59 didn't export playwright/lib/common, but the Suite lived in lib/common/test.js.
1181
- }
1182
- try {
1183
- var _playwrightCommonTest;
1184
- var playwrightPackagePath = playwrightTestRequire.resolve("playwright/package.json");
1185
- var playwrightCommonTest = playwrightTestRequire(path.join(path.dirname(playwrightPackagePath), "lib/common/test.js"));
1186
- return (_playwrightCommonTest = playwrightCommonTest.Suite) === null || _playwrightCommonTest === void 0 ? void 0 : _playwrightCommonTest.prototype;
1187
- } catch (_unused2) {
1188
- return undefined;
1189
- }
1190
- }
1191
1178
  }, {
1192
1179
  key: "processStepMetadataMessage",
1193
1180
  value: function processStepMetadataMessage(attachmentStepUuid, message) {
@@ -1223,32 +1210,32 @@ export var AllureReporter = /*#__PURE__*/function () {
1223
1210
  }, {
1224
1211
  key: "processAttachment",
1225
1212
  value: function () {
1226
- var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(testUuid, attachmentStepUuid, attachment) {
1213
+ var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(testUuid, attachmentStepUuid, attachment) {
1227
1214
  var _replace;
1228
1215
  var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
1229
- return _regenerator().w(function (_context7) {
1230
- while (1) switch (_context7.n) {
1216
+ return _regenerator().w(function (_context8) {
1217
+ while (1) switch (_context8.n) {
1231
1218
  case 0:
1232
1219
  if (!(!attachment.body && !attachment.path)) {
1233
- _context7.n = 1;
1220
+ _context8.n = 1;
1234
1221
  break;
1235
1222
  }
1236
- return _context7.a(2);
1223
+ return _context8.a(2);
1237
1224
  case 1:
1238
1225
  allureRuntimeMessage = attachment.contentType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE;
1239
1226
  if (!(allureRuntimeMessage && !attachment.body)) {
1240
- _context7.n = 2;
1227
+ _context8.n = 2;
1241
1228
  break;
1242
1229
  }
1243
- return _context7.a(2);
1230
+ return _context8.a(2);
1244
1231
  case 2:
1245
1232
  if (!allureRuntimeMessage) {
1246
- _context7.n = 3;
1233
+ _context8.n = 3;
1247
1234
  break;
1248
1235
  }
1249
1236
  message = JSON.parse(attachment.body.toString());
1250
1237
  this.allureRuntime.applyRuntimeMessages(testUuid, [message]);
1251
- return _context7.a(2);
1238
+ return _context8.a(2);
1252
1239
  case 3:
1253
1240
  parentUuid = this.allureRuntime.startStep(testUuid, attachmentStepUuid, {
1254
1241
  name: attachment.name
@@ -1259,20 +1246,20 @@ export var AllureReporter = /*#__PURE__*/function () {
1259
1246
  this.allureRuntime.stopStep(parentUuid, undefined);
1260
1247
  }
1261
1248
  if (!attachment.body) {
1262
- _context7.n = 4;
1249
+ _context8.n = 4;
1263
1250
  break;
1264
1251
  }
1265
1252
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.body, {
1266
1253
  contentType: attachment.contentType
1267
1254
  });
1268
- _context7.n = 6;
1255
+ _context8.n = 6;
1269
1256
  break;
1270
1257
  case 4:
1271
1258
  if (existsSync(attachment.path)) {
1272
- _context7.n = 5;
1259
+ _context8.n = 5;
1273
1260
  break;
1274
1261
  }
1275
- return _context7.a(2);
1262
+ return _context8.a(2);
1276
1263
  case 5:
1277
1264
  contentType = attachment.name === "trace" && attachment.contentType === "application/zip" ? ContentType.PLAYWRIGHT_TRACE : attachment.contentType;
1278
1265
  this.allureRuntime.writeAttachment(testUuid, parentUuid, attachment.name, attachment.path, {
@@ -1280,91 +1267,91 @@ export var AllureReporter = /*#__PURE__*/function () {
1280
1267
  });
1281
1268
  case 6:
1282
1269
  if (attachment.name.match(diffEndRegexp)) {
1283
- _context7.n = 7;
1270
+ _context8.n = 7;
1284
1271
  break;
1285
1272
  }
1286
- return _context7.a(2);
1273
+ return _context8.a(2);
1287
1274
  case 7:
1288
1275
  pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
1289
1276
  pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
1290
1277
  if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
1291
- _context7.n = 8;
1278
+ _context8.n = 8;
1292
1279
  break;
1293
1280
  }
1294
- return _context7.a(2);
1281
+ return _context8.a(2);
1295
1282
  case 8:
1296
1283
  fileExists = /*#__PURE__*/function () {
1297
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filePath) {
1298
- return _regenerator().w(function (_context5) {
1299
- while (1) switch (_context5.n) {
1284
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(filePath) {
1285
+ return _regenerator().w(function (_context6) {
1286
+ while (1) switch (_context6.n) {
1300
1287
  case 0:
1301
- _context5.n = 1;
1288
+ _context6.n = 1;
1302
1289
  return access(filePath).then(function () {
1303
1290
  return true;
1304
1291
  })["catch"](function () {
1305
1292
  return false;
1306
1293
  });
1307
1294
  case 1:
1308
- return _context5.a(2, _context5.v);
1295
+ return _context6.a(2, _context6.v);
1309
1296
  }
1310
- }, _callee5);
1297
+ }, _callee6);
1311
1298
  }));
1312
- return function fileExists(_x7) {
1313
- return _ref3.apply(this, arguments);
1299
+ return function fileExists(_x8) {
1300
+ return _ref4.apply(this, arguments);
1314
1301
  };
1315
1302
  }();
1316
1303
  readImageFromDirs = /*#__PURE__*/function () {
1317
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modifier) {
1304
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(modifier) {
1318
1305
  var defaultPath, snapshotPath;
1319
- return _regenerator().w(function (_context6) {
1320
- while (1) switch (_context6.n) {
1306
+ return _regenerator().w(function (_context7) {
1307
+ while (1) switch (_context7.n) {
1321
1308
  case 0:
1322
1309
  defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
1323
1310
  snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
1324
- _context6.n = 1;
1311
+ _context7.n = 1;
1325
1312
  return fileExists(defaultPath);
1326
1313
  case 1:
1327
- if (!_context6.v) {
1328
- _context6.n = 3;
1314
+ if (!_context7.v) {
1315
+ _context7.n = 3;
1329
1316
  break;
1330
1317
  }
1331
- _context6.n = 2;
1318
+ _context7.n = 2;
1332
1319
  return readImageAsBase64(defaultPath);
1333
1320
  case 2:
1334
- return _context6.a(2, _context6.v);
1321
+ return _context7.a(2, _context7.v);
1335
1322
  case 3:
1336
- _context6.n = 4;
1323
+ _context7.n = 4;
1337
1324
  return fileExists(snapshotPath);
1338
1325
  case 4:
1339
- if (!_context6.v) {
1340
- _context6.n = 6;
1326
+ if (!_context7.v) {
1327
+ _context7.n = 6;
1341
1328
  break;
1342
1329
  }
1343
- _context6.n = 5;
1330
+ _context7.n = 5;
1344
1331
  return readImageAsBase64(snapshotPath);
1345
1332
  case 5:
1346
- return _context6.a(2, _context6.v);
1333
+ return _context7.a(2, _context7.v);
1347
1334
  case 6:
1348
- return _context6.a(2, undefined);
1335
+ return _context7.a(2, undefined);
1349
1336
  }
1350
- }, _callee6);
1337
+ }, _callee7);
1351
1338
  }));
1352
- return function readImageFromDirs(_x8) {
1353
- return _ref4.apply(this, arguments);
1339
+ return function readImageFromDirs(_x9) {
1340
+ return _ref5.apply(this, arguments);
1354
1341
  };
1355
1342
  }();
1356
- _context7.n = 9;
1343
+ _context8.n = 9;
1357
1344
  return readImageFromDirs("actual");
1358
1345
  case 9:
1359
- actualBase64 = _context7.v;
1360
- _context7.n = 10;
1346
+ actualBase64 = _context8.v;
1347
+ _context8.n = 10;
1361
1348
  return readImageFromDirs("expected");
1362
1349
  case 10:
1363
- expectedBase64 = _context7.v;
1364
- _context7.n = 11;
1350
+ expectedBase64 = _context8.v;
1351
+ _context8.n = 11;
1365
1352
  return readImageFromDirs("diff");
1366
1353
  case 11:
1367
- diffBase64 = _context7.v;
1354
+ diffBase64 = _context8.v;
1368
1355
  diffName = attachment.name.replace(diffEndRegexp, "");
1369
1356
  this.allureRuntime.writeAttachment(testUuid, undefined, diffName, Buffer.from(JSON.stringify({
1370
1357
  expected: expectedBase64,
@@ -1377,11 +1364,11 @@ export var AllureReporter = /*#__PURE__*/function () {
1377
1364
  });
1378
1365
  this.processedDiffs.push(pathWithoutEnd);
1379
1366
  case 12:
1380
- return _context7.a(2);
1367
+ return _context8.a(2);
1381
1368
  }
1382
- }, _callee7, this);
1369
+ }, _callee8, this);
1383
1370
  }));
1384
- function processAttachment(_x4, _x5, _x6) {
1371
+ function processAttachment(_x5, _x6, _x7) {
1385
1372
  return _processAttachment.apply(this, arguments);
1386
1373
  }
1387
1374
  return processAttachment;