allure-cypress 3.15.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.
- package/README.md +3 -3
- package/dist/cjs/browser/commandLog.js +44 -57
- package/dist/cjs/browser/commandLog.js.map +1 -1
- package/dist/cjs/browser/events/cypress.js +3 -4
- package/dist/cjs/browser/events/cypress.js.map +1 -1
- package/dist/cjs/browser/lifecycle.js +1 -0
- package/dist/cjs/browser/lifecycle.js.map +1 -1
- package/dist/cjs/browser/patching.js +16 -9
- package/dist/cjs/browser/patching.js.map +1 -1
- package/dist/cjs/browser/runtime.js +22 -4
- package/dist/cjs/browser/runtime.js.map +1 -1
- package/dist/cjs/browser/serialize.js +4 -6
- package/dist/cjs/browser/serialize.js.map +1 -1
- package/dist/cjs/browser/steps.js +11 -5
- package/dist/cjs/browser/steps.js.map +1 -1
- package/dist/cjs/browser/testplan.js +13 -11
- package/dist/cjs/browser/testplan.js.map +1 -1
- package/dist/cjs/browser/utils.js +7 -9
- package/dist/cjs/browser/utils.js.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/reporter.js +56 -98
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/esm/browser/commandLog.js +44 -57
- package/dist/esm/browser/commandLog.js.map +1 -1
- package/dist/esm/browser/events/cypress.js +3 -4
- package/dist/esm/browser/events/cypress.js.map +1 -1
- package/dist/esm/browser/lifecycle.js +1 -0
- package/dist/esm/browser/lifecycle.js.map +1 -1
- package/dist/esm/browser/patching.js +16 -9
- package/dist/esm/browser/patching.js.map +1 -1
- package/dist/esm/browser/runtime.js +22 -4
- package/dist/esm/browser/runtime.js.map +1 -1
- package/dist/esm/browser/serialize.js +4 -6
- package/dist/esm/browser/serialize.js.map +1 -1
- package/dist/esm/browser/steps.js +11 -5
- package/dist/esm/browser/steps.js.map +1 -1
- package/dist/esm/browser/testplan.js +13 -11
- package/dist/esm/browser/testplan.js.map +1 -1
- package/dist/esm/browser/utils.js +7 -9
- package/dist/esm/browser/utils.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/reporter.js +56 -98
- package/dist/esm/reporter.js.map +1 -1
- package/dist/types/browser/lifecycle.d.ts +1 -1
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -39,15 +39,15 @@ Install Allure Report separately when you want to render the generated `allure-r
|
|
|
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
|
|
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: {
|
|
@@ -244,8 +244,8 @@ Otherwise, it may not work as expected.
|
|
|
244
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:
|
|
245
245
|
|
|
246
246
|
```javascript
|
|
247
|
-
import { defineConfig } from "cypress";
|
|
248
247
|
import { allureCypress } from "allure-cypress/reporter";
|
|
248
|
+
import { defineConfig } from "cypress";
|
|
249
249
|
|
|
250
250
|
export default defineConfig({
|
|
251
251
|
e2e: {
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
160
|
-
|
|
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(
|
|
188
|
-
var
|
|
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 =
|
|
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
|
|
212
|
-
type
|
|
213
|
-
|
|
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 :
|
|
220
|
-
var
|
|
221
|
-
|
|
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\" ? ()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3E,IAAI,KAAK,QAAQ;AAAA;AAEpF,IAAMY,kBAAkB,GAAGA,CAAA,KAAM,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;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AAI;EAEZ,OAAO,CAACyD,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,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":[]}
|
|
@@ -30,10 +30,9 @@ var onAfterScreenshot = function onAfterScreenshot() {
|
|
|
30
30
|
for (var _len2 = arguments.length, _ref = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
31
31
|
_ref[_key2] = arguments[_key2];
|
|
32
32
|
}
|
|
33
|
-
var [,
|
|
34
|
-
name
|
|
35
|
-
path
|
|
36
|
-
}] = _ref;
|
|
33
|
+
var _ref$ = _ref[1],
|
|
34
|
+
originalName = _ref$.name,
|
|
35
|
+
path = _ref$.path;
|
|
37
36
|
var name = originalName !== null && originalName !== void 0 ? originalName : (0, _utils.getFileNameFromPath)(path);
|
|
38
37
|
(0, _lifecycle.reportScreenshot)(path, name);
|
|
39
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","Screenshot","original","onAfterScreenshot","_len","arguments","length","args","Array","_key","apply","_len2","_ref","_key2","
|
|
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 }\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AAAC,KAAA,GAAAF,IAAA;IADWG,YAAY,GAAAD,KAAA,CAAlBE,IAAI;IAAgBC,IAAI,GAAAH,KAAA,CAAJG,IAAI;EAEhC,IAAMD,IAAI,GAAGD,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAAG,0BAAmB,EAACD,IAAI,CAAC;EAEtD,IAAAE,2BAAgB,EAACF,IAAI,EAAED,IAAI,CAAC;EAC5B,IAAAI,yCAA6B,EAACL,YAAY,EAAEC,IAAI,CAAC;AACnD,CAAC;AAED,IAAMnB,UAAU,GAAGA,CAACwB,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAI,IAAAC,+CAAmC,EAACD,KAAK,CAAC,EAAE;IAC9C,IAAAE,+BAAmB,EAACF,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAM1B,MAAM,GAAI6B,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,CAACnC,OAAO,CAACoC,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEnC,MAAM,CAAC","ignoreList":[]}
|
|
@@ -205,6 +205,7 @@ var throwAfterSpecCompletion = (context, err) => {
|
|
|
205
205
|
if (!chain) {
|
|
206
206
|
throw err;
|
|
207
207
|
}
|
|
208
|
+
return chain;
|
|
208
209
|
};
|
|
209
210
|
exports.throwAfterSpecCompletion = throwAfterSpecCompletion;
|
|
210
211
|
var flushRuntimeMessages = () => (0, _runtime.getTestRuntime)().flushAllureMessagesToTask("reportAllureCypressSpecMessages");
|
|
@@ -1 +1 @@
|
|
|
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};\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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AAA8C,qBAAc,EAACzB,IAAI,CAAC,EAAE;MACzB4D,6BAA6B,CAC3B5D,IAAI,EACJA,IAAI,CAAC6D,OAAO,GAAA5G,aAAA,CAAAA,aAAA,KAAQ,IAAA6E,sBAAe,EAAC,CAAC;QAAEvB,MAAM,EAAEoB,uBAAM,CAACC;MAAO,KAAKR,YACpE,CAAC;IACH;EACF;AACF,CAAC;AAED,IAAMwC,6BAA6B,GAAGA,CAAC5D,IAAiB,EAAEoB,YAAwC,KAAK;EACrG,IAAA9C,4BAAqB,EAAC;IACpBC,IAAI,EAAE,sBAAsB;IAC5BC,IAAI,EAAAvB,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,KACC,IAAAiD,uBAAgB,EAACF,IAAI,CAAC,GACtBoB,YAAY,GACZ,IAAA0C,sBAAe,EAAC9D,IAAI,CAAC;MACxB+D,MAAM,EAAE,IAAAC,mBAAY,EAAChE,IAAI,CAAC,CAACiE,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACtF,EAAE;IAAC;EAE/C,CAAC,CAAC;EACF,IAAAuB,yBAAkB,EAACH,IAAI,CAAC;AAC1B,CAAC;AAED,IAAMiD,uBAAuB,GAAGA,CAACP,OAAsB,EAAE9B,GAAY,KAAK;EACxE;EACA,IAAI;IAAA,IAAAuD,mBAAA,EAAAC,aAAA;IACF;IACAC,OAAO,CAACC,KAAK,mDAAAC,MAAA,EAAAJ,mBAAA,IAAAC,aAAA,GAAmD1B,OAAO,CAAC1C,IAAI,cAAAoE,aAAA,uBAAZA,aAAA,CAActF,KAAK,cAAAqF,mBAAA,cAAAA,mBAAA,GAAI,aAAa,CAAE,CAAC;IACvG;IACAE,OAAO,CAACC,KAAK,CAAC1D,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA4D,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":";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|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
var patchDescribe = _ref => {
|
|
32
|
-
var
|
|
33
|
-
|
|
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
|
|
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
|
-
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patching.js","names":["_sdk","require","_lifecycle","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","exports","suiteDepth","getSuiteDepth","incrementSuiteDepth","decrementSuiteDepth","_ref","patchDescribeFn","target","title","configOrFn","fn","forwardDescribeCall","originalDescribeFn","globalThis","describe","patchedDescribe","only","skip","_ref2","originalAfter","after","patchedAfter","nameOrFn","wrapRootAfterFn","_len","arguments","length","args","Array","_key","wrappedFn","wrapAfterFnWithCallback","wrapAfterFnWithoutArgs","Object","defineProperty","value","name","done","wrappedDone","hookError","_completeSpecOnAfterH","completeSpecOnAfterHookFailure","then","_completeSpecIfNoAfte","completeSpecIfNoAfterHookLeft","allureError","bind","result","syncError","e","throwAfterSpecCompletion","isPromise","
|
|
1
|
+
{"version":3,"file":"patching.js","names":["_sdk","require","_lifecycle","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","exports","suiteDepth","getSuiteDepth","incrementSuiteDepth","decrementSuiteDepth","_ref","patchDescribeFn","target","title","configOrFn","fn","forwardDescribeCall","originalDescribeFn","globalThis","describe","patchedDescribe","only","skip","_ref2","originalAfter","after","patchedAfter","nameOrFn","wrapRootAfterFn","_len","arguments","length","args","Array","_key","wrappedFn","wrapAfterFnWithCallback","wrapAfterFnWithoutArgs","Object","defineProperty","value","name","done","wrappedDone","hookError","_completeSpecOnAfterH","completeSpecOnAfterHookFailure","then","_completeSpecIfNoAfte","completeSpecIfNoAfterHookLeft","allureError","bind","result","syncError","e","throwAfterSpecCompletion","isPromise","outcome","ok","error","cy","settled"],"sources":["../../../src/browser/patching.ts"],"sourcesContent":["import { isPromise } from \"allure-js-commons/sdk\";\n\nimport type { CypressSuiteFunction, DirectHookImplementation, HookImplementation } from \"../types.js\";\nimport {\n completeSpecIfNoAfterHookLeft,\n completeSpecOnAfterHookFailure,\n throwAfterSpecCompletion,\n} from \"./lifecycle.js\";\n\ntype SuiteDepthCounter = {\n getSuiteDepth: () => number;\n incrementSuiteDepth: () => void;\n decrementSuiteDepth: () => void;\n};\n\n/**\n * Patches the `after` function, to inject reporting of spec-level\n * `after` hooks defined by the user.\n */\nexport const enableScopeLevelAfterHookReporting = () => {\n const suiteDepthCounter = createSuiteDepthCounterState();\n patchDescribe(suiteDepthCounter);\n patchAfter(suiteDepthCounter);\n};\n\nconst createSuiteDepthCounterState = (): SuiteDepthCounter => {\n let suiteDepth = 0;\n return {\n getSuiteDepth: () => suiteDepth,\n incrementSuiteDepth: () => {\n suiteDepth++;\n },\n decrementSuiteDepth: () => {\n suiteDepth--;\n },\n };\n};\n\nconst patchDescribe = ({ incrementSuiteDepth, decrementSuiteDepth }: SuiteDepthCounter) => {\n const patchDescribeFn =\n (target: CypressSuiteFunction): CypressSuiteFunction =>\n (title, configOrFn, fn) => {\n incrementSuiteDepth();\n try {\n return forwardDescribeCall(target, title, configOrFn, fn);\n } finally {\n decrementSuiteDepth();\n }\n };\n const originalDescribeFn: Mocha.SuiteFunction = globalThis.describe;\n const patchedDescribe = patchDescribeFn(originalDescribeFn) as Mocha.SuiteFunction;\n patchedDescribe.only = patchDescribeFn(\n originalDescribeFn.only as CypressSuiteFunction,\n ) as Mocha.ExclusiveSuiteFunction;\n patchedDescribe.skip = patchDescribeFn(originalDescribeFn.skip as CypressSuiteFunction) as Mocha.PendingSuiteFunction;\n globalThis.describe = patchedDescribe;\n};\n\nconst patchAfter = ({ getSuiteDepth }: SuiteDepthCounter) => {\n const originalAfter = globalThis.after;\n const patchedAfter = (nameOrFn: string | HookImplementation, fn?: HookImplementation): void => {\n return typeof nameOrFn === \"string\"\n ? originalAfter(nameOrFn, wrapRootAfterFn(getSuiteDepth, fn))\n : originalAfter(wrapRootAfterFn(getSuiteDepth, nameOrFn)!);\n };\n globalThis.after = patchedAfter;\n};\n\nconst forwardDescribeCall = (target: CypressSuiteFunction, ...args: Parameters<CypressSuiteFunction>) => {\n const [title, configOrFn, fn] = args;\n if (typeof fn === \"undefined\" && typeof configOrFn === \"undefined\") {\n return target(title);\n } else if (typeof configOrFn === \"function\") {\n return target(title, configOrFn);\n } else {\n return target(title, configOrFn, fn);\n }\n};\n\nconst wrapRootAfterFn = (getSuiteDepth: () => number, fn?: HookImplementation): HookImplementation | undefined => {\n if (getSuiteDepth() === 0 && fn) {\n const wrappedFn = fn.length ? wrapAfterFnWithCallback(fn) : wrapAfterFnWithoutArgs(fn as DirectHookImplementation);\n Object.defineProperty(wrappedFn, \"name\", { value: fn.name });\n return wrappedFn;\n }\n return fn;\n};\n\nconst wrapAfterFnWithCallback = (fn: Mocha.Func): Mocha.Func => {\n return function (this: Mocha.Context, done: Mocha.Done) {\n const wrappedDone = (hookError?: Error) => {\n if (hookError) {\n if (!completeSpecOnAfterHookFailure(this, hookError)?.then(() => done(hookError))) {\n done(hookError);\n }\n return;\n }\n\n try {\n if (completeSpecIfNoAfterHookLeft(this)?.then(() => done())) {\n return;\n }\n } catch (allureError) {\n done(allureError);\n return;\n }\n\n done();\n };\n return fn.bind(this)(wrappedDone);\n };\n};\n\nconst wrapAfterFnWithoutArgs = (fn: DirectHookImplementation) => {\n return function (this: Mocha.Context) {\n let result;\n let syncError: any;\n\n try {\n result = fn.bind(this)();\n } catch (e) {\n syncError = e;\n }\n\n if (syncError) {\n throwAfterSpecCompletion(this, syncError);\n } else if (isPromise(result)) {\n // Await the hook without queuing Cypress commands inside its promise callbacks.\n const outcome = result.then(\n () => ({ ok: true as const }),\n (error: unknown) => ({ ok: false as const, error }),\n );\n return cy\n .then(() => outcome)\n .then((settled) => {\n return settled.ok ? completeSpecIfNoAfterHookLeft(this) : throwAfterSpecCompletion(this, settled.error);\n });\n } else {\n completeSpecIfNoAfterHookLeft(this);\n return result;\n }\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAYA;AACA;AACA;AACA;AACO,IAAME,kCAAkC,GAAGA,CAAA,KAAM;EACtD,IAAMC,iBAAiB,GAAGC,4BAA4B,CAAC,CAAC;EACxDC,aAAa,CAACF,iBAAiB,CAAC;EAChCG,UAAU,CAACH,iBAAiB,CAAC;AAC/B,CAAC;AAACI,OAAA,CAAAL,kCAAA,GAAAA,kCAAA;AAEF,IAAME,4BAA4B,GAAGA,CAAA,KAAyB;EAC5D,IAAII,UAAU,GAAG,CAAC;EAClB,OAAO;IACLC,aAAa,EAAEA,CAAA,KAAMD,UAAU;IAC/BE,mBAAmB,EAAEA,CAAA,KAAM;MACzBF,UAAU,EAAE;IACd,CAAC;IACDG,mBAAmB,EAAEA,CAAA,KAAM;MACzBH,UAAU,EAAE;IACd;EACF,CAAC;AACH,CAAC;AAED,IAAMH,aAAa,GAAGO,IAAA,IAAqE;EAAA,IAAlEF,mBAAmB,GAAAE,IAAA,CAAnBF,mBAAmB;IAAEC,mBAAmB,GAAAC,IAAA,CAAnBD,mBAAmB;EAC/D,IAAME,eAAe,GAClBC,MAA4B,IAC7B,CAACC,KAAK,EAAEC,UAAU,EAAEC,EAAE,KAAK;IACzBP,mBAAmB,CAAC,CAAC;IACrB,IAAI;MACF,OAAOQ,mBAAmB,CAACJ,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAEC,EAAE,CAAC;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
|
13
13
|
var _utils = require("./utils.js");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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; } }
|
|
18
|
+
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; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
21
|
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; }
|
|
16
22
|
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; }
|
|
17
23
|
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; }
|
|
@@ -140,7 +146,10 @@ class AllureCypressTestRuntime {
|
|
|
140
146
|
});
|
|
141
147
|
}
|
|
142
148
|
attachment(name, content, options) {
|
|
143
|
-
var
|
|
149
|
+
var _assertClassBrand$cal = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
|
|
150
|
+
_assertClassBrand$cal2 = _slicedToArray(_assertClassBrand$cal, 2),
|
|
151
|
+
attachmentContent = _assertClassBrand$cal2[0],
|
|
152
|
+
actualEncoding = _assertClassBrand$cal2[1];
|
|
144
153
|
return _assertClassBrand(_AllureCypressTestRuntime_brand, this, _enqueueMessageAsync).call(this, {
|
|
145
154
|
type: "attachment_content",
|
|
146
155
|
data: {
|
|
@@ -164,7 +173,10 @@ class AllureCypressTestRuntime {
|
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
globalAttachment(name, content, options) {
|
|
167
|
-
var
|
|
176
|
+
var _assertClassBrand$cal3 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
|
|
177
|
+
_assertClassBrand$cal4 = _slicedToArray(_assertClassBrand$cal3, 2),
|
|
178
|
+
attachmentContent = _assertClassBrand$cal4[0],
|
|
179
|
+
actualEncoding = _assertClassBrand$cal4[1];
|
|
168
180
|
return _assertClassBrand(_AllureCypressTestRuntime_brand, this, _enqueueMessageAsync).call(this, {
|
|
169
181
|
type: "global_attachment_content",
|
|
170
182
|
data: {
|
|
@@ -429,7 +441,10 @@ function _createSyncRuntime() {
|
|
|
429
441
|
}
|
|
430
442
|
}),
|
|
431
443
|
attachment: (name, content, options) => {
|
|
432
|
-
var
|
|
444
|
+
var _assertClassBrand$cal5 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
|
|
445
|
+
_assertClassBrand$cal6 = _slicedToArray(_assertClassBrand$cal5, 2),
|
|
446
|
+
attachmentContent = _assertClassBrand$cal6[0],
|
|
447
|
+
actualEncoding = _assertClassBrand$cal6[1];
|
|
433
448
|
(0, _state.enqueueRuntimeMessage)({
|
|
434
449
|
type: "attachment_content",
|
|
435
450
|
data: {
|
|
@@ -451,7 +466,10 @@ function _createSyncRuntime() {
|
|
|
451
466
|
}
|
|
452
467
|
}),
|
|
453
468
|
globalAttachment: (name, content, options) => {
|
|
454
|
-
var
|
|
469
|
+
var _assertClassBrand$cal7 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
|
|
470
|
+
_assertClassBrand$cal8 = _slicedToArray(_assertClassBrand$cal7, 2),
|
|
471
|
+
attachmentContent = _assertClassBrand$cal8[0],
|
|
472
|
+
actualEncoding = _assertClassBrand$cal8[1];
|
|
455
473
|
(0, _state.enqueueRuntimeMessage)({
|
|
456
474
|
type: "global_attachment_content",
|
|
457
475
|
data: {
|