allure-cypress 3.14.0 → 3.16.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.
Files changed (49) hide show
  1. package/README.md +18 -4
  2. package/dist/cjs/browser/commandLog.js +44 -57
  3. package/dist/cjs/browser/commandLog.js.map +1 -1
  4. package/dist/cjs/browser/events/cypress.js +20 -9
  5. package/dist/cjs/browser/events/cypress.js.map +1 -1
  6. package/dist/cjs/browser/lifecycle.js +4 -1
  7. package/dist/cjs/browser/lifecycle.js.map +1 -1
  8. package/dist/cjs/browser/patching.js +16 -9
  9. package/dist/cjs/browser/patching.js.map +1 -1
  10. package/dist/cjs/browser/runtime.js +86 -10
  11. package/dist/cjs/browser/runtime.js.map +1 -1
  12. package/dist/cjs/browser/serialize.js +19 -23
  13. package/dist/cjs/browser/serialize.js.map +1 -1
  14. package/dist/cjs/browser/steps.js +15 -7
  15. package/dist/cjs/browser/steps.js.map +1 -1
  16. package/dist/cjs/browser/testplan.js +13 -11
  17. package/dist/cjs/browser/testplan.js.map +1 -1
  18. package/dist/cjs/browser/utils.js +9 -9
  19. package/dist/cjs/browser/utils.js.map +1 -1
  20. package/dist/cjs/index.js +2 -1
  21. package/dist/cjs/index.js.map +4 -4
  22. package/dist/cjs/reporter.js +123 -123
  23. package/dist/cjs/reporter.js.map +1 -1
  24. package/dist/esm/browser/commandLog.js +44 -57
  25. package/dist/esm/browser/commandLog.js.map +1 -1
  26. package/dist/esm/browser/events/cypress.js +20 -9
  27. package/dist/esm/browser/events/cypress.js.map +1 -1
  28. package/dist/esm/browser/lifecycle.js +3 -1
  29. package/dist/esm/browser/lifecycle.js.map +1 -1
  30. package/dist/esm/browser/patching.js +16 -9
  31. package/dist/esm/browser/patching.js.map +1 -1
  32. package/dist/esm/browser/runtime.js +85 -10
  33. package/dist/esm/browser/runtime.js.map +1 -1
  34. package/dist/esm/browser/serialize.js +19 -23
  35. package/dist/esm/browser/serialize.js.map +1 -1
  36. package/dist/esm/browser/steps.js +14 -7
  37. package/dist/esm/browser/steps.js.map +1 -1
  38. package/dist/esm/browser/testplan.js +13 -11
  39. package/dist/esm/browser/testplan.js.map +1 -1
  40. package/dist/esm/browser/utils.js +8 -9
  41. package/dist/esm/browser/utils.js.map +1 -1
  42. package/dist/esm/index.js +2 -1
  43. package/dist/esm/index.js.map +4 -4
  44. package/dist/esm/reporter.js +124 -124
  45. package/dist/esm/reporter.js.map +1 -1
  46. package/dist/types/browser/lifecycle.d.ts +1 -1
  47. package/dist/types/browser/runtime.d.ts +6 -2
  48. package/dist/types/reporter.d.ts +5 -0
  49. package/package.json +13 -12
package/README.md CHANGED
@@ -32,22 +32,22 @@ npm install -D allure-cypress
32
32
 
33
33
  Install Allure Report separately when you want to render the generated `allure-results`:
34
34
 
35
- - follow the [Allure Report 2 installation guide](https://allurereport.org/docs/install/) to use the `allure` CLI
35
+ - follow the [Allure Report 2 installation guide](https://allurereport.org/docs/v2/install/) to use the `allure` CLI
36
36
  - or install Allure Report 3 with `npm install -D allure` to use `npx allure`
37
37
 
38
38
  ## Supported versions and platforms
39
39
 
40
40
  - `cypress >= 12.17.4`
41
41
  - Linux, macOS, and Windows wherever Cypress supports Node.js
42
- - this repository is validated in CI on Node.js 20 and 22
42
+ - this repository is validated in CI on Node.js 24 and 26
43
43
 
44
44
  ## Usage
45
45
 
46
46
  Call `allureCypress` to initialize the plugin from the `setupNodeEvents` function in `cypress.config.js`:
47
47
 
48
48
  ```javascript
49
- import { defineConfig } from "cypress";
50
49
  import { allureCypress } from "allure-cypress/reporter";
50
+ import { defineConfig } from "cypress";
51
51
 
52
52
  export default defineConfig({
53
53
  e2e: {
@@ -139,6 +139,14 @@ describe("signing in with a password", () => {
139
139
 
140
140
  More details about the API are available at [https://allurereport.org/docs/cypress-reference/](https://allurereport.org/docs/cypress-reference/).
141
141
 
142
+ ### Assertion comparison values
143
+
144
+ Assertion and step errors use DOM-aware formatting for `actual` and `expected` values. These values share the `stepsFromCommands.maxArgumentDepth` and `maxArgumentLength` limits with command parameters.
145
+
146
+ These limits affect reported comparison values, not assertion execution or the original error message and stack trace. Set a limit to `0` to disable it for both command parameters and comparison values.
147
+
148
+ `globalError()` does not apply DOM formatting or the limits above. For global errors with DOM subjects, pass plain status details with `message`, `trace`, and already formatted string values for `actual` and `expected` instead of raw DOM values.
149
+
142
150
  ### Sync API
143
151
 
144
152
  When your test code uses synchronous helpers or matcher integrations, you can use the sync facade from `allure-js-commons/sync`.
@@ -227,6 +235,7 @@ Cypress can't compose multiple Node events, which are set in `setupNodeEvents`.
227
235
 
228
236
  Allure Cypress requires access to the following events:
229
237
 
238
+ - `after:screenshot`
230
239
  - `after:spec`
231
240
  - `after:run`
232
241
 
@@ -235,14 +244,19 @@ Otherwise, it may not work as expected.
235
244
  If you need to define your own handlers of those events, make sure to call the corresponding functions of the `allureCypress`s' return value:
236
245
 
237
246
  ```javascript
238
- import { defineConfig } from "cypress";
239
247
  import { allureCypress } from "allure-cypress/reporter";
248
+ import { defineConfig } from "cypress";
240
249
 
241
250
  export default defineConfig({
242
251
  e2e: {
243
252
  setupNodeEvents: (on, config) => {
244
253
  const allurePlugin = allureCypress(on, config);
245
254
 
255
+ on("after:screenshot", (details) => {
256
+ // Apply any screenshot changes first, then pass the final path to Allure.
257
+ allurePlugin.onAfterScreenshot(details);
258
+ });
259
+
246
260
  on("after:spec", (spec, results) => {
247
261
  allurePlugin.onAfterSpec(spec, results);
248
262
 
@@ -11,15 +11,20 @@ var _state = require("./state.js");
11
11
  var _steps = require("./steps.js");
12
12
  var _utils2 = require("./utils.js");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
15
+ 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."); }
16
+ 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; } }
17
+ 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; }
18
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
20
  var shouldCreateStepFromCommandLogEntry = entry => {
15
21
  if (!(0, _state.getConfig)().stepsFromCommands.enabled) {
16
22
  // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.
17
23
  return false;
18
24
  }
19
- var {
20
- event,
21
- instrument
22
- } = entry.attributes;
25
+ var _entry$attributes = entry.attributes,
26
+ event = _entry$attributes.event,
27
+ instrument = _entry$attributes.instrument;
23
28
  if (instrument !== "command") {
24
29
  // We are interested in the "TEST BODY" panel only for now.
25
30
  // Other instruments are logged in separate panels.
@@ -49,12 +54,9 @@ exports.shouldCreateStepFromCommandLogEntry = shouldCreateStepFromCommandLogEntr
49
54
  var setupScreenshotAttachmentStep = (originalName, name) => {
50
55
  var step = (0, _state.getCurrentStep)();
51
56
  if (step && (0, _steps.isLogStep)(step)) {
52
- var {
53
- name: commandName,
54
- props: {
55
- name: nameFromProps
56
- }
57
- } = (0, _utils2.resolveConsoleProps)(step.log);
57
+ var _resolveConsoleProps = (0, _utils2.resolveConsoleProps)(step.log),
58
+ commandName = _resolveConsoleProps.name,
59
+ nameFromProps = _resolveConsoleProps.props.name;
58
60
  if (commandName === "screenshot" && nameFromProps === originalName) {
59
61
  step.attachmentName = name;
60
62
  }
@@ -72,9 +74,7 @@ var startCommandLogStep = entry => {
72
74
  };
73
75
  exports.startCommandLogStep = startCommandLogStep;
74
76
  var stopCommandLogStep = entryId => (0, _steps.findAndStopStepWithSubsteps)(_ref => {
75
- var {
76
- id
77
- } = _ref;
77
+ var id = _ref.id;
78
78
  return id === entryId;
79
79
  });
80
80
  exports.stopCommandLogStep = stopCommandLogStep;
@@ -99,11 +99,10 @@ var pushLogEntry = entry => {
99
99
  });
100
100
  };
101
101
  var scheduleCommandLogStepStop = entry => {
102
- var {
103
- groupStart,
104
- end,
105
- id
106
- } = entry.attributes;
102
+ var _entry$attributes2 = entry.attributes,
103
+ groupStart = _entry$attributes2.groupStart,
104
+ end = _entry$attributes2.end,
105
+ id = _entry$attributes2.id;
107
106
  if (end) {
108
107
  // Some entries are already completed (this is similar to the idea behind allure.logStep).
109
108
  // Cypress won't call entry.end() in such a case, so we need to stop such a step now.
@@ -129,25 +128,24 @@ var scheduleCommandLogStepStop = entry => {
129
128
  }
130
129
  };
131
130
  var isApiStepErrorLogEntry = entry => {
132
- var {
133
- name
134
- } = entry.attributes;
131
+ var name = entry.attributes.name;
135
132
  return name === "then" && Object.is((0, _utils2.resolveConsoleProps)(entry).props["Applied To"], _steps.ALLURE_STEP_CMD_SUBJECT);
136
133
  };
137
134
  var getCommandLogStepName = entry => {
138
135
  var _ref2, _ref3, _maybeGetAssertionLog;
139
- var {
140
- name,
141
- message,
142
- displayName
143
- } = entry.attributes;
136
+ var _entry$attributes3 = entry.attributes,
137
+ name = _entry$attributes3.name,
138
+ message = _entry$attributes3.message,
139
+ displayName = _entry$attributes3.displayName;
144
140
  var resolvedName = (displayName !== null && displayName !== void 0 ? displayName : name).trim();
145
141
  var resolvedMessage = ((_ref2 = (_ref3 = (_maybeGetAssertionLog = maybeGetAssertionLogMessage(entry)) !== null && _maybeGetAssertionLog !== void 0 ? _maybeGetAssertionLog : maybeGetCucumberLogMessage(entry)) !== null && _ref3 !== void 0 ? _ref3 : (0, _utils2.resolveRenderProps)(entry).message) !== null && _ref2 !== void 0 ? _ref2 : message).trim();
146
142
  var stepName = [resolvedName, resolvedMessage].filter(Boolean).join(" ");
147
143
  return stepName;
148
144
  };
149
145
  var getCommandLogStepParameters = entry => getLogProps(entry).map(_ref4 => {
150
- var [k, v] = _ref4;
146
+ var _ref5 = _slicedToArray(_ref4, 2),
147
+ k = _ref5[0],
148
+ v = _ref5[1];
151
149
  return {
152
150
  name: k.toString(),
153
151
  value: (0, _serialize.default)(v)
@@ -155,22 +153,18 @@ var getCommandLogStepParameters = entry => getLogProps(entry).map(_ref4 => {
155
153
  }).filter(getPropValueSetFilter(entry));
156
154
  var WELL_KNOWN_CUCUMBER_LOG_NAMES = ["Given", "When", "Then", "And"];
157
155
  var maybeGetCucumberLogMessage = entry => {
158
- var {
159
- attributes: {
160
- name,
161
- message
162
- }
163
- } = entry;
156
+ var _entry$attributes4 = entry.attributes,
157
+ name = _entry$attributes4.name,
158
+ message = _entry$attributes4.message;
164
159
  if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith("**") && message.endsWith("**")) {
165
160
  return message.substring(2, message.length - 2);
166
161
  }
167
162
  };
168
163
  var getLogProps = entry => {
169
164
  var isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);
170
- var {
171
- props,
172
- name
173
- } = (0, _utils2.resolveConsoleProps)(entry);
165
+ var _resolveConsoleProps2 = (0, _utils2.resolveConsoleProps)(entry),
166
+ props = _resolveConsoleProps2.props,
167
+ name = _resolveConsoleProps2.name;
174
168
 
175
169
  // accessing LocalStorage after the page reload can stick the test runner
176
170
  // to avoid the issue, we just need to log the command manually
@@ -184,8 +178,10 @@ var getLogProps = entry => {
184
178
  // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,
185
179
  // directly into the step's name.
186
180
  // No need to keep the exact same information in the step's parameters.
187
- return Object.entries(props).filter(_ref5 => {
188
- var [k, v] = _ref5;
181
+ return Object.entries(props).filter(_ref6 => {
182
+ var _ref7 = _slicedToArray(_ref6, 2),
183
+ k = _ref7[0],
184
+ v = _ref7[1];
189
185
  return (0, _utils.isDefined)(v) && !(isAssertionWithMessage && k === "Message");
190
186
  });
191
187
  };
@@ -197,30 +193,21 @@ var maybeGetAssertionLogMessage = entry => {
197
193
  }
198
194
  }
199
195
  };
200
- var isAssertLog = _ref6 => {
201
- var {
202
- attributes: {
203
- name
204
- }
205
- } = _ref6;
196
+ var isAssertLog = _ref8 => {
197
+ var name = _ref8.attributes.name;
206
198
  return name === "assert";
207
199
  };
208
200
  var getCurrentLogEntry = () => (0, _state.getStepStack)().findLast(_steps.isLogStep);
209
201
  var shouldStopCurrentLogStep = (currentLogEntry, newLogEntry) => {
210
- var {
211
- groupStart: currentEntryIsGroup,
212
- type: currentEntryType
213
- } = currentLogEntry.attributes;
214
- var {
215
- type: newEntryType
216
- } = newLogEntry.attributes;
202
+ var _currentLogEntry$attr = currentLogEntry.attributes,
203
+ currentEntryIsGroup = _currentLogEntry$attr.groupStart,
204
+ currentEntryType = _currentLogEntry$attr.type;
205
+ var newEntryType = newLogEntry.attributes.type;
217
206
  return !currentEntryIsGroup && (currentEntryType === "child" || newEntryType !== "child");
218
207
  };
219
- var getPropValueSetFilter = entry => entry.attributes.name === "wrap" ? () => true : _ref7 => {
220
- var {
221
- name,
222
- value
223
- } = _ref7;
208
+ var getPropValueSetFilter = entry => entry.attributes.name === "wrap" ? () => true : _ref9 => {
209
+ var name = _ref9.name,
210
+ value = _ref9.value;
224
211
  return name !== "Yielded" || value !== "{}";
225
212
  };
226
213
  //# sourceMappingURL=commandLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","_utils2","e","__esModule","default","shouldCreateStepFromCommandLogEntry","entry","getConfig","stepsFromCommands","enabled","event","instrument","attributes","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","name","step","getCurrentStep","isLogStep","commandName","props","nameFromProps","resolveConsoleProps","log","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","Object","is","ALLURE_STEP_CMD_SUBJECT","_ref2","_ref3","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","resolveRenderProps","stepName","filter","Boolean","join","getLogProps","map","_ref4","k","v","toString","value","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref5","isDefined","isAssertLog","Message","_ref6","getStepStack","findLast","newLogEntry","currentEntryIsGroup","currentEntryType","newEntryType","_ref7"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\n\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getConfig, getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\nimport { resolveConsoleProps, resolveRenderProps } from \"./utils.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\n if (!getConfig().stepsFromCommands.enabled) {\n // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.\n return false;\n }\n\n const { event, instrument } = entry.attributes;\n if (instrument !== \"command\") {\n // We are interested in the \"TEST BODY\" panel only for now.\n // Other instruments are logged in separate panels.\n return false;\n }\n\n if (event) {\n // Events are tricky to report as they may span across commands and even leave the test's scope.\n // We ignore them for now.\n return false;\n }\n\n if (isApiStepErrorLogEntry(entry)) {\n // Cypress don't create a log message for 'cy.then' except when it throws an error.\n // This is in particularly happens when the function passed to 'allure.step' throws. In such a case however,\n // creating an extra step from the log entry is redundant because the error is already included in the report as\n // a part of the step.\n return false;\n }\n\n return true;\n};\n\n/**\n * Checks if the current step represents a cy.screenshot command log entry. If this is the case, associates the name\n * of the screenshot with the step. Later, that will allow converting the step with the attachment into the attachment\n * step.\n */\nexport const setupScreenshotAttachmentStep = (originalName: string | undefined, name: string) => {\n const step = getCurrentStep();\n if (step && isLogStep(step)) {\n const {\n name: commandName,\n props: { name: nameFromProps },\n } = resolveConsoleProps(step.log);\n if (commandName === \"screenshot\" && nameFromProps === originalName) {\n step.attachmentName = name;\n }\n }\n};\n\nexport const startCommandLogStep = (entry: CypressLogEntry) => {\n const currentLogEntry = getCurrentLogEntry();\n\n if (typeof currentLogEntry !== \"undefined\" && shouldStopCurrentLogStep(currentLogEntry.log, entry)) {\n stopCommandLogStep(currentLogEntry.log.attributes.id);\n }\n\n pushLogEntry(entry);\n reportStepStart(entry.attributes.id, getCommandLogStepName(entry));\n scheduleCommandLogStepStop(entry);\n};\n\nexport const stopCommandLogStep = (entryId: string) => findAndStopStepWithSubsteps(({ id }) => id === entryId);\n\nconst pushLogEntry = (entry: CypressLogEntry) => {\n const id = entry.attributes.id;\n const stepDescriptor: LogStepDescriptor = { id, type: \"log\", log: entry };\n\n pushStep(stepDescriptor);\n\n // Some properties of some Command Log entries are undefined at the time the entry is stopped. An example is the\n // Yielded property of some queries. We defer converting them to Allure step parameters until the test/hook ends.\n setupStepFinalization(stepDescriptor, (data) => {\n data.parameters = getCommandLogStepParameters(entry);\n\n if (stepDescriptor.attachmentName) {\n // Rename the step to match the attachment name. Once the names are the same, Allure will render the\n // attachment in the place of the step.\n data.name = stepDescriptor.attachmentName;\n }\n });\n};\n\nconst scheduleCommandLogStepStop = (entry: CypressLogEntry) => {\n const { groupStart, end, id } = entry.attributes;\n if (end) {\n // Some entries are already completed (this is similar to the idea behind allure.logStep).\n // Cypress won't call entry.end() in such a case, so we need to stop such a step now.\n // Example: cy.log\n stopCommandLogStep(id);\n } else if (groupStart) {\n // A logging group must be stopped be the user via the Cypress.Log.endGroup() call.\n // If the call is missing, the corresponding step will be stopped either at the test's (the hook's) end.\n const originalEndGroup = entry.endGroup;\n entry.endGroup = function () {\n stopCommandLogStep(id);\n return originalEndGroup.call(this);\n };\n } else {\n // Regular log entries are finalized by Cypress via the Cypress.Log.end() call. We're hooking into this function\n // to complete the step at the same time.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalEnd = entry.end;\n entry.end = function () {\n stopCommandLogStep(id);\n return originalEnd.call(this);\n };\n }\n};\n\nconst isApiStepErrorLogEntry = (entry: CypressLogEntry) => {\n const { name } = entry.attributes;\n return name === \"then\" && Object.is(resolveConsoleProps(entry).props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\n};\n\nconst getCommandLogStepName = (entry: CypressLogEntry) => {\n const { name, message, displayName } = entry.attributes;\n const resolvedName = (displayName ?? name).trim();\n const resolvedMessage = (\n maybeGetAssertionLogMessage(entry) ??\n maybeGetCucumberLogMessage(entry) ??\n resolveRenderProps(entry).message ??\n message\n ).trim();\n const stepName = [resolvedName, resolvedMessage].filter(Boolean).join(\" \");\n return stepName;\n};\n\nconst getCommandLogStepParameters = (entry: CypressLogEntry) =>\n getLogProps(entry)\n .map(([k, v]) => ({\n name: k.toString(),\n value: serializePropValue(v),\n }))\n .filter(getPropValueSetFilter(entry));\n\nconst WELL_KNOWN_CUCUMBER_LOG_NAMES = [\"Given\", \"When\", \"Then\", \"And\"];\n\nconst maybeGetCucumberLogMessage = (entry: CypressLogEntry) => {\n const {\n attributes: { name, message },\n } = entry;\n if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith(\"**\") && message.endsWith(\"**\")) {\n return message.substring(2, message.length - 2);\n }\n};\n\nconst getLogProps = (entry: CypressLogEntry) => {\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\n const { props, name } = resolveConsoleProps(entry);\n\n // accessing LocalStorage after the page reload can stick the test runner\n // to avoid the issue, we just need to log the command manually\n // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`\n // but probably, we don't need to silent them all at this moment\n // the context: https://github.com/allure-framework/allure-js/issues/1222\n if ([\"clearLocalStorage\"].includes(name)) {\n return [] as [string, unknown][];\n }\n\n // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,\n // directly into the step's name.\n // No need to keep the exact same information in the step's parameters.\n return Object.entries(props).filter(([k, v]) => isDefined(v) && !(isAssertionWithMessage && k === \"Message\"));\n};\n\nconst maybeGetAssertionLogMessage = (entry: CypressLogEntry) => {\n if (isAssertLog(entry)) {\n const message = resolveConsoleProps(entry).props.Message;\n\n if (message && typeof message === \"string\") {\n return message;\n }\n }\n};\n\nconst isAssertLog = ({ attributes: { name } }: CypressLogEntry) => name === \"assert\";\n\nconst getCurrentLogEntry = () => getStepStack().findLast(isLogStep);\n\nconst shouldStopCurrentLogStep = (currentLogEntry: CypressLogEntry, newLogEntry: CypressLogEntry) => {\n const { groupStart: currentEntryIsGroup, type: currentEntryType } = currentLogEntry.attributes;\n const { type: newEntryType } = newLogEntry.attributes;\n\n return !currentEntryIsGroup && (currentEntryType === \"child\" || newEntryType !== \"child\");\n};\n\nconst getPropValueSetFilter = (entry: CypressLogEntry) =>\n entry.attributes.name === \"wrap\" ? () => true : ({ name, value }: Parameter) => name !== \"Yielded\" || value !== \"{}\";\n"],"mappings":";;;;;;AAG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AM,IAAAgE,mBAAY,EAAC,CAAC,CAACC,QAAQ,CAAC1E,gBAAS,CAAC;AAEnE,IAAMU,wBAAwB,GAAGA,CAACF,eAAgC,EAAEmE,WAA4B,KAAK;EACnG,IAAM;IAAEhD,UAAU,EAAEiD,mBAAmB;IAAEvD,IAAI,EAAEwD;EAAiB,CAAC,GAAGrE,eAAe,CAAChB,UAAU;EAC9F,IAAM;IAAE6B,IAAI,EAAEyD;EAAa,CAAC,GAAGH,WAAW,CAACnF,UAAU;EAErD,OAAO,CAACoF,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMnB,qBAAqB,GAAIzE,KAAsB,IACnDA,KAAK,CAACM,UAAU,CAACK,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGkF,KAAA;EAAA,IAAC;IAAElF,IAAI;IAAE4D;EAAiB,CAAC,GAAAsB,KAAA;EAAA,OAAKlF,IAAI,KAAK,SAAS,IAAI4D,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","_utils2","e","__esModule","default","_slicedToArray","r","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","return","isArray","shouldCreateStepFromCommandLogEntry","entry","getConfig","stepsFromCommands","enabled","_entry$attributes","attributes","event","instrument","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","step","getCurrentStep","isLogStep","_resolveConsoleProps","resolveConsoleProps","log","commandName","nameFromProps","props","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","_entry$attributes2","groupStart","end","originalEndGroup","endGroup","originalEnd","is","ALLURE_STEP_CMD_SUBJECT","_ref2","_ref3","_maybeGetAssertionLog","_entry$attributes3","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","resolveRenderProps","stepName","filter","Boolean","join","getLogProps","map","_ref4","_ref5","k","v","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","_entry$attributes4","includes","startsWith","endsWith","substring","isAssertionWithMessage","_resolveConsoleProps2","entries","_ref6","_ref7","isDefined","isAssertLog","Message","_ref8","getStepStack","findLast","newLogEntry","_currentLogEntry$attr","currentEntryIsGroup","currentEntryType","newEntryType","_ref9"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\n\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getConfig, getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\nimport { resolveConsoleProps, resolveRenderProps } from \"./utils.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\n if (!getConfig().stepsFromCommands.enabled) {\n // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.\n return false;\n }\n\n const { event, instrument } = entry.attributes;\n if (instrument !== \"command\") {\n // We are interested in the \"TEST BODY\" panel only for now.\n // Other instruments are logged in separate panels.\n return false;\n }\n\n if (event) {\n // Events are tricky to report as they may span across commands and even leave the test's scope.\n // We ignore them for now.\n return false;\n }\n\n if (isApiStepErrorLogEntry(entry)) {\n // Cypress don't create a log message for 'cy.then' except when it throws an error.\n // This is in particularly happens when the function passed to 'allure.step' throws. In such a case however,\n // creating an extra step from the log entry is redundant because the error is already included in the report as\n // a part of the step.\n return false;\n }\n\n return true;\n};\n\n/**\n * Checks if the current step represents a cy.screenshot command log entry. If this is the case, associates the name\n * of the screenshot with the step. Later, that will allow converting the step with the attachment into the attachment\n * step.\n */\nexport const setupScreenshotAttachmentStep = (originalName: string | undefined, name: string) => {\n const step = getCurrentStep();\n if (step && isLogStep(step)) {\n const {\n name: commandName,\n props: { name: nameFromProps },\n } = resolveConsoleProps(step.log);\n if (commandName === \"screenshot\" && nameFromProps === originalName) {\n step.attachmentName = name;\n }\n }\n};\n\nexport const startCommandLogStep = (entry: CypressLogEntry) => {\n const currentLogEntry = getCurrentLogEntry();\n\n if (typeof currentLogEntry !== \"undefined\" && shouldStopCurrentLogStep(currentLogEntry.log, entry)) {\n stopCommandLogStep(currentLogEntry.log.attributes.id);\n }\n\n pushLogEntry(entry);\n reportStepStart(entry.attributes.id, getCommandLogStepName(entry));\n scheduleCommandLogStepStop(entry);\n};\n\nexport const stopCommandLogStep = (entryId: string) => findAndStopStepWithSubsteps(({ id }) => id === entryId);\n\nconst pushLogEntry = (entry: CypressLogEntry) => {\n const id = entry.attributes.id;\n const stepDescriptor: LogStepDescriptor = { id, type: \"log\", log: entry };\n\n pushStep(stepDescriptor);\n\n // Some properties of some Command Log entries are undefined at the time the entry is stopped. An example is the\n // Yielded property of some queries. We defer converting them to Allure step parameters until the test/hook ends.\n setupStepFinalization(stepDescriptor, (data) => {\n data.parameters = getCommandLogStepParameters(entry);\n\n if (stepDescriptor.attachmentName) {\n // Rename the step to match the attachment name. Once the names are the same, Allure will render the\n // attachment in the place of the step.\n data.name = stepDescriptor.attachmentName;\n }\n });\n};\n\nconst scheduleCommandLogStepStop = (entry: CypressLogEntry) => {\n const { groupStart, end, id } = entry.attributes;\n if (end) {\n // Some entries are already completed (this is similar to the idea behind allure.logStep).\n // Cypress won't call entry.end() in such a case, so we need to stop such a step now.\n // Example: cy.log\n stopCommandLogStep(id);\n } else if (groupStart) {\n // A logging group must be stopped be the user via the Cypress.Log.endGroup() call.\n // If the call is missing, the corresponding step will be stopped either at the test's (the hook's) end.\n const originalEndGroup = entry.endGroup;\n entry.endGroup = function () {\n stopCommandLogStep(id);\n return originalEndGroup.call(this);\n };\n } else {\n // Regular log entries are finalized by Cypress via the Cypress.Log.end() call. We're hooking into this function\n // to complete the step at the same time.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalEnd = entry.end;\n entry.end = function () {\n stopCommandLogStep(id);\n return originalEnd.call(this);\n };\n }\n};\n\nconst isApiStepErrorLogEntry = (entry: CypressLogEntry) => {\n const { name } = entry.attributes;\n return name === \"then\" && Object.is(resolveConsoleProps(entry).props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\n};\n\nconst getCommandLogStepName = (entry: CypressLogEntry) => {\n const { name, message, displayName } = entry.attributes;\n const resolvedName = (displayName ?? name).trim();\n const resolvedMessage = (\n maybeGetAssertionLogMessage(entry) ??\n maybeGetCucumberLogMessage(entry) ??\n resolveRenderProps(entry).message ??\n message\n ).trim();\n const stepName = [resolvedName, resolvedMessage].filter(Boolean).join(\" \");\n return stepName;\n};\n\nconst getCommandLogStepParameters = (entry: CypressLogEntry) =>\n getLogProps(entry)\n .map(([k, v]) => ({\n name: k.toString(),\n value: serializePropValue(v),\n }))\n .filter(getPropValueSetFilter(entry));\n\nconst WELL_KNOWN_CUCUMBER_LOG_NAMES = [\"Given\", \"When\", \"Then\", \"And\"];\n\nconst maybeGetCucumberLogMessage = (entry: CypressLogEntry) => {\n const {\n attributes: { name, message },\n } = entry;\n if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith(\"**\") && message.endsWith(\"**\")) {\n return message.substring(2, message.length - 2);\n }\n};\n\nconst getLogProps = (entry: CypressLogEntry) => {\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\n const { props, name } = resolveConsoleProps(entry);\n\n // accessing LocalStorage after the page reload can stick the test runner\n // to avoid the issue, we just need to log the command manually\n // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`\n // but probably, we don't need to silent them all at this moment\n // the context: https://github.com/allure-framework/allure-js/issues/1222\n if ([\"clearLocalStorage\"].includes(name)) {\n return [] as [string, unknown][];\n }\n\n // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,\n // directly into the step's name.\n // No need to keep the exact same information in the step's parameters.\n return Object.entries(props).filter(([k, v]) => isDefined(v) && !(isAssertionWithMessage && k === \"Message\"));\n};\n\nconst maybeGetAssertionLogMessage = (entry: CypressLogEntry) => {\n if (isAssertLog(entry)) {\n const message = resolveConsoleProps(entry).props.Message;\n\n if (message && typeof message === \"string\") {\n return message;\n }\n }\n};\n\nconst isAssertLog = ({ attributes: { name } }: CypressLogEntry) => name === \"assert\";\n\nconst getCurrentLogEntry = () => getStepStack().findLast(isLogStep);\n\nconst shouldStopCurrentLogStep = (currentLogEntry: CypressLogEntry, newLogEntry: CypressLogEntry) => {\n const { groupStart: currentEntryIsGroup, type: currentEntryType } = currentLogEntry.attributes;\n const { type: newEntryType } = newLogEntry.attributes;\n\n return !currentEntryIsGroup && (currentEntryType === \"child\" || newEntryType !== \"child\");\n};\n\nconst getPropValueSetFilter = (entry: CypressLogEntry) =>\n entry.attributes.name === \"wrap\" ? () => true : ({ name, value }: Parameter) => name !== \"Yielded\" || value !== \"{}\";\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAAqE,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD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KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMtB,qBAAqB,GAAIzE,KAAsB,IACnDA,KAAK,CAACK,UAAU,CAAC1B,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGqH,KAAA;EAAA,IAAGrH,IAAI,GAAAqH,KAAA,CAAJrH,IAAI;IAAEiB,KAAK,GAAAoG,KAAA,CAALpG,KAAK;EAAA,OAAkBjB,IAAI,KAAK,SAAS,IAAIiB,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
@@ -10,18 +10,29 @@ var _steps = require("../steps.js");
10
10
  var _utils = require("../utils.js");
11
11
  var registerCypressEventListeners = () => Cypress.on("fail", onFail).on("log:added", onLogAdded);
12
12
  exports.registerCypressEventListeners = registerCypressEventListeners;
13
- var enableReportingOfCypressScreenshots = () => Cypress.Screenshot.defaults({
14
- onAfterScreenshot
15
- });
13
+ var enableReportingOfCypressScreenshots = () => {
14
+ // Observe the dispatcher, so later defaults() calls cannot replace Allure's reporting.
15
+ var screenshot = Cypress.Screenshot;
16
+ var original = screenshot.onAfterScreenshot;
17
+ screenshot.onAfterScreenshot = function () {
18
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
+ args[_key] = arguments[_key];
20
+ }
21
+ try {
22
+ return original.apply(this, args);
23
+ } finally {
24
+ onAfterScreenshot(...args);
25
+ }
26
+ };
27
+ };
16
28
  exports.enableReportingOfCypressScreenshots = enableReportingOfCypressScreenshots;
17
29
  var onAfterScreenshot = function onAfterScreenshot() {
18
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
19
- _ref[_key] = arguments[_key];
30
+ for (var _len2 = arguments.length, _ref = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
31
+ _ref[_key2] = arguments[_key2];
20
32
  }
21
- var [, {
22
- name: originalName,
23
- path
24
- }] = _ref;
33
+ var _ref$ = _ref[1],
34
+ originalName = _ref$.name,
35
+ path = _ref$.path;
25
36
  var name = originalName !== null && originalName !== void 0 ? originalName : (0, _utils.getFileNameFromPath)(path);
26
37
  (0, _lifecycle.reportScreenshot)(path, name);
27
38
  (0, _commandLog.setupScreenshotAttachmentStep)(originalName, name);
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.js","names":["_commandLog","require","_lifecycle","_steps","_utils","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","exports","enableReportingOfCypressScreenshots","Screenshot","defaults","onAfterScreenshot","_len","arguments","length","_ref","Array","_key","name","originalName","path","getFileNameFromPath","reportScreenshot","setupScreenshotAttachmentStep","_","entry","shouldCreateStepFromCommandLogEntry","startCommandLogStep","error","reportStepError","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => Cypress.Screenshot.defaults({ onAfterScreenshot });\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,IAAMI,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAACC,OAAA,CAAAL,6BAAA,GAAAA,6BAAA;AAEnG,IAAMM,mCAAmC,GAAGA,CAAA,KAAML,OAAO,CAACM,UAAU,CAACC,QAAQ,CAAC;EAAEC;AAAkB,CAAC,CAAC;AAACJ,OAAA,CAAAC,mCAAA,GAAAA,mCAAA;AAE5G,IAAMG,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAA,EAElB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,IADA,GAAG;IAAEC,IAAI,EAAEC,YAAY;IAAEC;EAAK,CAAC,CAAC,GAAAL,IAAA;EAEnC,IAAMG,IAAI,GAAGC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAAE,0BAAmB,EAACD,IAAI,CAAC;EAEtD,IAAAE,2BAAgB,EAACF,IAAI,EAAEF,IAAI,CAAC;EAC5B,IAAAK,yCAA6B,EAACJ,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMZ,UAAU,GAAGA,CAACkB,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAI,IAAAC,+CAAmC,EAACD,KAAK,CAAC,EAAE;IAC9C,IAAAE,+BAAmB,EAACF,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMpB,MAAM,GAAIuB,KAA2B,IAAK;EAC9C,IAAAC,sBAAe,EAACD,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIE,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMF,KAAK;EACb;AACF,CAAC;AAED,IAAME,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAAC7B,OAAO,CAAC8B,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE7B,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cypress.js","names":["_commandLog","require","_lifecycle","_steps","_utils","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","exports","enableReportingOfCypressScreenshots","screenshot","Screenshot","original","onAfterScreenshot","_len","arguments","length","args","Array","_key","apply","_len2","_ref","_key2","_ref$","originalName","name","path","getFileNameFromPath","reportScreenshot","setupScreenshotAttachmentStep","_","entry","shouldCreateStepFromCommandLogEntry","startCommandLogStep","error","reportStepError","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => {\n // Observe the dispatcher, so later defaults() calls cannot replace Allure's reporting.\n const screenshot = Cypress.Screenshot as unknown as {\n onAfterScreenshot: Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"];\n };\n const original = screenshot.onAfterScreenshot;\n screenshot.onAfterScreenshot = function (...args) {\n try {\n return original.apply(this, args);\n } finally {\n onAfterScreenshot(...args);\n }\n };\n};\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,IAAMI,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAACC,OAAA,CAAAL,6BAAA,GAAAA,6BAAA;AAEnG,IAAMM,mCAAmC,GAAGA,CAAA,KAAM;EACvD;EACA,IAAMC,UAAU,GAAGN,OAAO,CAACO,UAE1B;EACD,IAAMC,QAAQ,GAAGF,UAAU,CAACG,iBAAiB;EAC7CH,UAAU,CAACG,iBAAiB,GAAG,YAAmB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAA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ED,IAAME,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAACnC,OAAO,CAACoC,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEnC,MAAM,CAAC","ignoreList":[]}
@@ -7,9 +7,11 @@ exports.throwAfterSpecCompletion = exports.reportTestStart = exports.reportTestS
7
7
  var _allureJsCommons = require("allure-js-commons");
8
8
  var _sdk = require("allure-js-commons/sdk");
9
9
  var _runtime = require("./runtime.js");
10
+ var _serialize = _interopRequireDefault(require("./serialize.js"));
10
11
  var _state = require("./state.js");
11
12
  var _steps = require("./steps.js");
12
13
  var _utils = require("./utils.js");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
15
  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; }
14
16
  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; }
15
17
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -103,7 +105,7 @@ var reportTestPass = () => {
103
105
  exports.reportTestPass = reportTestPass;
104
106
  var reportTestOrHookFail = err => {
105
107
  var status = (0, _sdk.getStatusFromError)(err);
106
- var statusDetails = (0, _sdk.getMessageAndTraceFromError)(err);
108
+ var statusDetails = (0, _sdk.getMessageAndTraceFromError)(err, _serialize.default);
107
109
  (0, _steps.stopAllSteps)(status, statusDetails);
108
110
  (0, _state.enqueueRuntimeMessage)({
109
111
  type: "cypress_fail",
@@ -203,6 +205,7 @@ var throwAfterSpecCompletion = (context, err) => {
203
205
  if (!chain) {
204
206
  throw err;
205
207
  }
208
+ return chain;
206
209
  };
207
210
  exports.throwAfterSpecCompletion = throwAfterSpecCompletion;
208
211
  var flushRuntimeMessages = () => (0, _runtime.getTestRuntime)().flushAllureMessagesToTask("reportAllureCypressSpecMessages");
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","names":["_allureJsCommons","require","_sdk","_runtime","_state","_steps","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","reportRunStart","enqueueRuntimeMessage","type","data","exports","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","finalizeSteps","duration","reportTestStart","test","setCurrentTest","getTestStartData","markTestAsReported","reportStepStart","reportStepStop","step","status","statusDetails","getStepStopData","reportTestPass","reportTestOrHookFail","err","getStatusFromError","getMessageAndTraceFromError","stopAllSteps","completeHookErrorReporting","isEachHook","parent","testFailData","getStatusDataOfTestSkippedByHookError","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","isTestReported","getCurrentTest","Status","SKIPPED","message","getTestSkipData","reportTestEnd","_test$duration","_retries","retries","dropCurrentTest","reportScreenshot","path","contentType","ContentType","PNG","completeSpecIfNoAfterHookLeft","context","isLastRootAfterHook","isAllureHook","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","getTestRuntime","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","iterateTests","reportTestsSkippedByHookError","pending","getTestStopData","suites","getSuitePath","map","s","_context$test$title","_context$test","console","error","concat","_unused"],"sources":["../../../src/browser/lifecycle.ts"],"sourcesContent":["import { ContentType, Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\n\nimport type { CypressFailMessage, CypressHook, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { getTestRuntime } from \"./runtime.js\";\nimport { dropCurrentTest, enqueueRuntimeMessage, getCurrentTest, setCurrentTest } from \"./state.js\";\nimport { finalizeSteps, stopAllSteps } from \"./steps.js\";\nimport {\n getStatusDataOfTestSkippedByHookError,\n getStepStopData,\n getSuitePath,\n getTestSkipData,\n getTestStartData,\n getTestStopData,\n isAllureHook,\n isLastRootAfterHook,\n isTestReported,\n iterateTests,\n markTestAsReported,\n} from \"./utils.js\";\n\nexport const reportRunStart = () => {\n enqueueRuntimeMessage({\n type: \"cypress_run_start\",\n data: {},\n });\n};\n\nexport const reportSuiteStart = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_start\",\n data: {\n id: suite.id,\n name: suite.title,\n root: suite.root,\n start: Date.now(),\n },\n });\n};\n\nexport const reportSuiteEnd = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_end\",\n data: {\n root: suite.root,\n stop: Date.now(),\n },\n });\n};\n\nexport const reportHookStart = (hook: CypressHook, start?: number) => {\n enqueueRuntimeMessage({\n type: \"cypress_hook_start\",\n data: {\n name: hook.title,\n scopeType: hook.hookName.includes(\"each\") ? \"each\" : \"all\",\n position: hook.hookName.includes(\"before\") ? \"before\" : \"after\",\n start: start ?? Date.now(),\n },\n });\n};\n\nexport const reportHookEnd = (hook: CypressHook) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_hook_end\",\n data: {\n duration: hook.duration ?? 0,\n },\n });\n};\n\nexport const reportTestStart = (test: CypressTest) => {\n setCurrentTest(test);\n enqueueRuntimeMessage({\n type: \"cypress_test_start\",\n data: getTestStartData(test),\n });\n markTestAsReported(test);\n};\n\nexport const reportStepStart = (id: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_start\",\n data: {\n id,\n name,\n start: Date.now(),\n },\n });\n};\n\nexport const reportStepStop = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_stop\",\n data: getStepStopData(step, status, statusDetails),\n });\n};\n\nexport const reportTestPass = () => {\n enqueueRuntimeMessage({\n type: \"cypress_test_pass\",\n data: {},\n });\n};\n\nexport const reportTestOrHookFail = (err: Error) => {\n const status = getStatusFromError(err);\n const statusDetails = getMessageAndTraceFromError(err);\n\n stopAllSteps(status, statusDetails);\n\n enqueueRuntimeMessage({\n type: \"cypress_fail\",\n data: {\n status,\n statusDetails,\n },\n });\n};\n\nexport const completeHookErrorReporting = (hook: CypressHook, err: Error) => {\n const isEachHook = hook.hookName.includes(\"each\");\n const suite = hook.parent!;\n const testFailData = getStatusDataOfTestSkippedByHookError(hook.title, isEachHook, err, suite);\n\n // Cypress doens't emit 'hook end' if the hook has failed.\n reportHookEnd(hook);\n\n // Cypress doens't emit 'test end' if the hook has failed.\n // We must report the test's end manualy in case of a 'before each' hook.\n reportCurrentTestIfAny();\n\n // Cypress skips the remaining tests in the suite of a failed hook.\n // We should include them to the report manually.\n reportRemainingTests(suite, testFailData);\n};\n\nexport const reportTestSkip = (test: CypressTest) => {\n if (isTestReported(test)) {\n // Ignore pending events for retry attempts that already ended.\n if (getCurrentTest() !== test) {\n return;\n }\n\n stopAllSteps(Status.SKIPPED, {\n message: \"The test was skipped before the command was completed\",\n });\n } else {\n reportTestStart(test);\n }\n\n enqueueRuntimeMessage({\n type: \"cypress_test_skip\",\n data: getTestSkipData(),\n });\n};\n\nexport const reportTestEnd = (test: CypressTest) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_test_end\",\n data: {\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n },\n });\n dropCurrentTest();\n};\n\nexport const reportScreenshot = (path: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"attachment_path\",\n data: { path, name, contentType: ContentType.PNG },\n });\n};\n\nexport const completeSpecIfNoAfterHookLeft = (context: Mocha.Context) => {\n if (isLastRootAfterHook(context)) {\n const hook = context.test as CypressHook;\n if (!isAllureHook(hook)) {\n reportHookEnd(hook);\n }\n return completeSpecAsync();\n }\n};\n\nexport const completeSpecOnAfterHookFailure = (\n context: Mocha.Context,\n hookError: Error,\n): Cypress.Chainable<unknown> | undefined => {\n try {\n reportTestOrHookFail(hookError);\n completeHookErrorReporting(context.test as CypressHook, hookError);\n\n // cy.task's then doesn't have onrejected, that's why we don't log async Allure errors here.\n return completeSpecAsync();\n } catch (allureError) {\n logAllureRootAfterError(context, allureError);\n }\n};\n\nexport const throwAfterSpecCompletion = (context: Mocha.Context, err: any) => {\n const chain = completeSpecOnAfterHookFailure(context, err as Error)?.then(() => {\n throw err;\n });\n if (!chain) {\n throw err;\n }\n};\n\nexport const flushRuntimeMessages = () => getTestRuntime().flushAllureMessagesToTask(\"reportAllureCypressSpecMessages\");\n\nexport const completeSpecAsync = () =>\n getTestRuntime().flushAllureMessagesToTaskAsync(\"reportFinalAllureCypressSpecMessages\");\n\nconst reportCurrentTestIfAny = () => {\n const currentTest = getCurrentTest();\n if (currentTest) {\n reportTestEnd(currentTest);\n }\n};\n\nconst reportRemainingTests = (suite: CypressSuite, testFailData: CypressFailMessage[\"data\"]) => {\n for (const test of iterateTests(suite)) {\n // Some tests in the suite might've been already reported.\n if (!isTestReported(test)) {\n reportTestsSkippedByHookError(\n test,\n test.pending ? { ...getTestSkipData(), status: Status.SKIPPED } : testFailData,\n );\n }\n }\n};\n\nconst reportTestsSkippedByHookError = (test: CypressTest, testFailData: CypressFailMessage[\"data\"]) => {\n enqueueRuntimeMessage({\n type: \"cypress_skipped_test\",\n data: {\n ...getTestStartData(test),\n ...testFailData,\n ...getTestStopData(test),\n suites: getSuitePath(test).map((s) => s.id),\n },\n });\n markTestAsReported(test);\n};\n\nconst logAllureRootAfterError = (context: Mocha.Context, err: unknown) => {\n // We play safe and swallow errors here to keep the original 'after all' error.\n try {\n // eslint-disable-next-line no-console\n console.error(`Unexpected error when reporting the failure of ${context.test?.title ?? \"'after all'\"}`);\n // eslint-disable-next-line no-console\n console.error(err);\n } catch {}\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAYoB,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc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AAG,CAAC;EACpB,CAAC,CAAC,OAAA2D,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"lifecycle.js","names":["_allureJsCommons","require","_sdk","_runtime","_serialize","_interopRequireDefault","_state","_steps","_utils","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","reportRunStart","enqueueRuntimeMessage","type","data","exports","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","finalizeSteps","duration","reportTestStart","test","setCurrentTest","getTestStartData","markTestAsReported","reportStepStart","reportStepStop","step","status","statusDetails","getStepStopData","reportTestPass","reportTestOrHookFail","err","getStatusFromError","getMessageAndTraceFromError","serializeValue","stopAllSteps","completeHookErrorReporting","isEachHook","parent","testFailData","getStatusDataOfTestSkippedByHookError","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","isTestReported","getCurrentTest","Status","SKIPPED","message","getTestSkipData","reportTestEnd","_test$duration","_retries","retries","dropCurrentTest","reportScreenshot","path","contentType","ContentType","PNG","completeSpecIfNoAfterHookLeft","context","isLastRootAfterHook","isAllureHook","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","getTestRuntime","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","iterateTests","reportTestsSkippedByHookError","pending","getTestStopData","suites","getSuitePath","map","s","_context$test$title","_context$test","console","error","concat","_unused"],"sources":["../../../src/browser/lifecycle.ts"],"sourcesContent":["import { ContentType, Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\n\nimport type { CypressFailMessage, CypressHook, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { getTestRuntime } from \"./runtime.js\";\nimport serializeValue from \"./serialize.js\";\nimport { dropCurrentTest, enqueueRuntimeMessage, getCurrentTest, setCurrentTest } from \"./state.js\";\nimport { finalizeSteps, stopAllSteps } from \"./steps.js\";\nimport {\n getStatusDataOfTestSkippedByHookError,\n getStepStopData,\n getSuitePath,\n getTestSkipData,\n getTestStartData,\n getTestStopData,\n isAllureHook,\n isLastRootAfterHook,\n isTestReported,\n iterateTests,\n markTestAsReported,\n} from \"./utils.js\";\n\nexport const reportRunStart = () => {\n enqueueRuntimeMessage({\n type: \"cypress_run_start\",\n data: {},\n });\n};\n\nexport const reportSuiteStart = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_start\",\n data: {\n id: suite.id,\n name: suite.title,\n root: suite.root,\n start: Date.now(),\n },\n });\n};\n\nexport const reportSuiteEnd = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_end\",\n data: {\n root: suite.root,\n stop: Date.now(),\n },\n });\n};\n\nexport const reportHookStart = (hook: CypressHook, start?: number) => {\n enqueueRuntimeMessage({\n type: \"cypress_hook_start\",\n data: {\n name: hook.title,\n scopeType: hook.hookName.includes(\"each\") ? \"each\" : \"all\",\n position: hook.hookName.includes(\"before\") ? \"before\" : \"after\",\n start: start ?? Date.now(),\n },\n });\n};\n\nexport const reportHookEnd = (hook: CypressHook) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_hook_end\",\n data: {\n duration: hook.duration ?? 0,\n },\n });\n};\n\nexport const reportTestStart = (test: CypressTest) => {\n setCurrentTest(test);\n enqueueRuntimeMessage({\n type: \"cypress_test_start\",\n data: getTestStartData(test),\n });\n markTestAsReported(test);\n};\n\nexport const reportStepStart = (id: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_start\",\n data: {\n id,\n name,\n start: Date.now(),\n },\n });\n};\n\nexport const reportStepStop = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_stop\",\n data: getStepStopData(step, status, statusDetails),\n });\n};\n\nexport const reportTestPass = () => {\n enqueueRuntimeMessage({\n type: \"cypress_test_pass\",\n data: {},\n });\n};\n\nexport const reportTestOrHookFail = (err: Error) => {\n const status = getStatusFromError(err);\n const statusDetails = getMessageAndTraceFromError(err, serializeValue);\n\n stopAllSteps(status, statusDetails);\n\n enqueueRuntimeMessage({\n type: \"cypress_fail\",\n data: {\n status,\n statusDetails,\n },\n });\n};\n\nexport const completeHookErrorReporting = (hook: CypressHook, err: Error) => {\n const isEachHook = hook.hookName.includes(\"each\");\n const suite = hook.parent!;\n const testFailData = getStatusDataOfTestSkippedByHookError(hook.title, isEachHook, err, suite);\n\n // Cypress doens't emit 'hook end' if the hook has failed.\n reportHookEnd(hook);\n\n // Cypress doens't emit 'test end' if the hook has failed.\n // We must report the test's end manualy in case of a 'before each' hook.\n reportCurrentTestIfAny();\n\n // Cypress skips the remaining tests in the suite of a failed hook.\n // We should include them to the report manually.\n reportRemainingTests(suite, testFailData);\n};\n\nexport const reportTestSkip = (test: CypressTest) => {\n if (isTestReported(test)) {\n // Ignore pending events for retry attempts that already ended.\n if (getCurrentTest() !== test) {\n return;\n }\n\n stopAllSteps(Status.SKIPPED, {\n message: \"The test was skipped before the command was completed\",\n });\n } else {\n reportTestStart(test);\n }\n\n enqueueRuntimeMessage({\n type: \"cypress_test_skip\",\n data: getTestSkipData(),\n });\n};\n\nexport const reportTestEnd = (test: CypressTest) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_test_end\",\n data: {\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n },\n });\n dropCurrentTest();\n};\n\nexport const reportScreenshot = (path: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"attachment_path\",\n data: { path, name, contentType: ContentType.PNG },\n });\n};\n\nexport const completeSpecIfNoAfterHookLeft = (context: Mocha.Context) => {\n if (isLastRootAfterHook(context)) {\n const hook = context.test as CypressHook;\n if (!isAllureHook(hook)) {\n reportHookEnd(hook);\n }\n return completeSpecAsync();\n }\n};\n\nexport const completeSpecOnAfterHookFailure = (\n context: Mocha.Context,\n hookError: Error,\n): Cypress.Chainable<unknown> | undefined => {\n try {\n reportTestOrHookFail(hookError);\n completeHookErrorReporting(context.test as CypressHook, hookError);\n\n // cy.task's then doesn't have onrejected, that's why we don't log async Allure errors here.\n return completeSpecAsync();\n } catch (allureError) {\n logAllureRootAfterError(context, allureError);\n }\n};\n\nexport const throwAfterSpecCompletion = (context: Mocha.Context, err: any) => {\n const chain = completeSpecOnAfterHookFailure(context, err as Error)?.then(() => {\n throw err;\n });\n if (!chain) {\n throw err;\n }\n return chain;\n};\n\nexport const flushRuntimeMessages = () => getTestRuntime().flushAllureMessagesToTask(\"reportAllureCypressSpecMessages\");\n\nexport const completeSpecAsync = () =>\n getTestRuntime().flushAllureMessagesToTaskAsync(\"reportFinalAllureCypressSpecMessages\");\n\nconst reportCurrentTestIfAny = () => {\n const currentTest = getCurrentTest();\n if (currentTest) {\n reportTestEnd(currentTest);\n }\n};\n\nconst reportRemainingTests = (suite: CypressSuite, testFailData: CypressFailMessage[\"data\"]) => {\n for (const test of iterateTests(suite)) {\n // Some tests in the suite might've been already reported.\n if (!isTestReported(test)) {\n reportTestsSkippedByHookError(\n test,\n test.pending ? { ...getTestSkipData(), status: Status.SKIPPED } : testFailData,\n );\n }\n }\n};\n\nconst reportTestsSkippedByHookError = (test: CypressTest, testFailData: CypressFailMessage[\"data\"]) => {\n enqueueRuntimeMessage({\n type: \"cypress_skipped_test\",\n data: {\n ...getTestStartData(test),\n ...testFailData,\n ...getTestStopData(test),\n suites: getSuitePath(test).map((s) => s.id),\n },\n });\n markTestAsReported(test);\n};\n\nconst logAllureRootAfterError = (context: Mocha.Context, err: unknown) => {\n // We play safe and swallow errors here to keep the original 'after all' error.\n try {\n // eslint-disable-next-line no-console\n console.error(`Unexpected error when reporting the failure of ${context.test?.title ?? \"'after all'\"}`);\n // eslint-disable-next-line no-console\n console.error(err);\n } catch {}\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAYoB,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAf,CAAA,aAAAI,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAD,OAAA,CAAAG,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAnB,CAAA,EAAAI,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,y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AE,OAAO,CAACC,KAAK,CAAC1D,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA4D,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
@@ -29,10 +29,8 @@ var createSuiteDepthCounterState = () => {
29
29
  };
30
30
  };
31
31
  var patchDescribe = _ref => {
32
- var {
33
- incrementSuiteDepth,
34
- decrementSuiteDepth
35
- } = _ref;
32
+ var incrementSuiteDepth = _ref.incrementSuiteDepth,
33
+ decrementSuiteDepth = _ref.decrementSuiteDepth;
36
34
  var patchDescribeFn = target => (title, configOrFn, fn) => {
37
35
  incrementSuiteDepth();
38
36
  try {
@@ -48,9 +46,7 @@ var patchDescribe = _ref => {
48
46
  globalThis.describe = patchedDescribe;
49
47
  };
50
48
  var patchAfter = _ref2 => {
51
- var {
52
- getSuiteDepth
53
- } = _ref2;
49
+ var getSuiteDepth = _ref2.getSuiteDepth;
54
50
  var originalAfter = globalThis.after;
55
51
  var patchedAfter = (nameOrFn, fn) => {
56
52
  return typeof nameOrFn === "string" ? originalAfter(nameOrFn, wrapRootAfterFn(getSuiteDepth, fn)) : originalAfter(wrapRootAfterFn(getSuiteDepth, nameOrFn));
@@ -61,7 +57,9 @@ var forwardDescribeCall = function forwardDescribeCall(target) {
61
57
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
62
58
  args[_key - 1] = arguments[_key];
63
59
  }
64
- var [title, configOrFn, fn] = args;
60
+ var title = args[0],
61
+ configOrFn = args[1],
62
+ fn = args[2];
65
63
  if (typeof fn === "undefined" && typeof configOrFn === "undefined") {
66
64
  return target(title);
67
65
  } else if (typeof configOrFn === "function") {
@@ -116,7 +114,16 @@ var wrapAfterFnWithoutArgs = fn => {
116
114
  if (syncError) {
117
115
  (0, _lifecycle.throwAfterSpecCompletion)(this, syncError);
118
116
  } else if ((0, _sdk.isPromise)(result)) {
119
- return result.then(() => (0, _lifecycle.completeSpecIfNoAfterHookLeft)(this), asyncError => (0, _lifecycle.throwAfterSpecCompletion)(this, asyncError));
117
+ // Await the hook without queuing Cypress commands inside its promise callbacks.
118
+ var outcome = result.then(() => ({
119
+ ok: true
120
+ }), error => ({
121
+ ok: false,
122
+ error
123
+ }));
124
+ return cy.then(() => outcome).then(settled => {
125
+ return settled.ok ? (0, _lifecycle.completeSpecIfNoAfterHookLeft)(this) : (0, _lifecycle.throwAfterSpecCompletion)(this, settled.error);
126
+ });
120
127
  } else {
121
128
  (0, _lifecycle.completeSpecIfNoAfterHookLeft)(this);
122
129
  return result;