allure-cypress 3.0.8 → 3.1.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.
@@ -159,11 +159,24 @@ var getLogProps = entry => {
159
159
  }
160
160
  } = entry;
161
161
  var isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);
162
+ var {
163
+ props,
164
+ name
165
+ } = consoleProps();
166
+
167
+ // accessing LocalStorage after the page reload can stick the test runner
168
+ // to avoid the issue, we just need to log the command manually
169
+ // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`
170
+ // but probably, we don't need to silent them all at this moment
171
+ // the context: https://github.com/allure-framework/allure-js/issues/1222
172
+ if (["clearLocalStorage"].includes(name)) {
173
+ return [];
174
+ }
162
175
 
163
176
  // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,
164
177
  // directly into the step's name.
165
178
  // No need to keep the exact same information in the step's parameters.
166
- return Object.entries(consoleProps().props).filter(_ref6 => {
179
+ return Object.entries(props).filter(_ref6 => {
167
180
  var [k, v] = _ref6;
168
181
  return isDefined(v) && !(isAssertionWithMessage && k === "Message");
169
182
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commandLog.js","names":["isDefined","reportStepStart","serializePropValue","getCurrentStep","getStepStack","pushStep","setupStepFinalization","ALLURE_STEP_CMD_SUBJECT","findAndStopStepWithSubsteps","isLogStep","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","setupScreenshotAttachmentStep","originalName","name","step","commandName","props","nameFromProps","log","consoleProps","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","getCommandLogStepName","scheduleCommandLogStepStop","entryId","_ref","stepDescriptor","type","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","_ref2","Object","is","_ref3","_ref4","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","renderProps","stepName","filter","Boolean","join","getLogProps","map","_ref5","k","v","toString","value","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref6","isAssertLog","Message","_ref7","findLast","newLogEntry","currentEntryIsGroup","currentEntryType","newEntryType","_ref8"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\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 } = step.log.attributes.consoleProps();\n if (commandName === \"screenshot\" && nameFromProps === originalName) {\n step.attachmentName = name;\n }\n }\n};\n\nexport const startCommandLogStep = (entry: CypressLogEntry) => {\n const currentLogEntry = getCurrentLogEntry();\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 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 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 = ({ attributes: { name, consoleProps } }: CypressLogEntry) =>\n name === \"then\" && Object.is(consoleProps().props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\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 entry.attributes.renderProps().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 {\n attributes: { consoleProps },\n } = entry;\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\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(consoleProps().props).filter(\n ([k, v]) => isDefined(v) && !(isAssertionWithMessage && k === \"Message\"),\n );\n};\n\nconst maybeGetAssertionLogMessage = (entry: CypressLogEntry) => {\n if (isAssertLog(entry)) {\n const message = entry.attributes.consoleProps().props.Message;\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":"AAEA,SAASA,SAAS,QAAQ,aAAa;AACvC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,kBAAkB,MAAM,gBAAgB;AAC/C,SAASC,cAAc,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,qBAAqB,QAAQ,YAAY;AAC1F,SAASC,uBAAuB,EAAEC,2BAA2B,EAAEC,SAAS,QAAQ,YAAY;AAE5F,OAAO,IAAMC,mCAAmC,GAAIC,KAAsB,IAAK;EAC7E,IAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,KAAK,CAACG,UAAU;EAC9C,IAAID,UAAU,KAAK,SAAS,EAAE;IAC5B;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAID,KAAK,EAAE;IACT;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAIG,sBAAsB,CAACJ,KAAK,CAAC,EAAE;IACjC;IACA;IACA;IACA;IACA,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMK,6BAA6B,GAAGA,CAACC,YAAgC,EAAEC,IAAY,KAAK;EAC/F,IAAMC,IAAI,GAAGhB,cAAc,CAAC,CAAC;EAC7B,IAAIgB,IAAI,IAAIV,SAAS,CAACU,IAAI,CAAC,EAAE;IAC3B,IAAM;MACJD,IAAI,EAAEE,WAAW;MACjBC,KAAK,EAAE;QAAEH,IAAI,EAAEI;MAAc;IAC/B,CAAC,GAA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AM;IAAE7C,UAAU,EAAE8C,mBAAmB;IAAElD,IAAI,EAAEmD;EAAiB,CAAC,GAAG9D,eAAe,CAACb,UAAU;EAC9F,IAAM;IAAEwB,IAAI,EAAEoD;EAAa,CAAC,GAAGH,WAAW,CAACzE,UAAU;EAErD,OAAO,CAAC0E,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMjB,qBAAqB,GAAI9D,KAAsB,IACnDA,KAAK,CAACG,UAAU,CAACI,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGyE,KAAA;EAAA,IAAC;IAAEzE,IAAI;IAAEsD;EAAiB,CAAC,GAAAmB,KAAA;EAAA,OAAKzE,IAAI,KAAK,SAAS,IAAIsD,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"commandLog.js","names":["isDefined","reportStepStart","serializePropValue","getCurrentStep","getStepStack","pushStep","setupStepFinalization","ALLURE_STEP_CMD_SUBJECT","findAndStopStepWithSubsteps","isLogStep","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","setupScreenshotAttachmentStep","originalName","name","step","commandName","props","nameFromProps","log","consoleProps","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","getCommandLogStepName","scheduleCommandLogStepStop","entryId","_ref","stepDescriptor","type","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","_ref2","Object","is","_ref3","_ref4","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","renderProps","stepName","filter","Boolean","join","getLogProps","map","_ref5","k","v","toString","value","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref6","isAssertLog","Message","_ref7","findLast","newLogEntry","currentEntryIsGroup","currentEntryType","newEntryType","_ref8"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\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 } = step.log.attributes.consoleProps();\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 = ({ attributes: { name, consoleProps } }: CypressLogEntry) =>\n name === \"then\" && Object.is(consoleProps().props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\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 entry.attributes.renderProps().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 {\n attributes: { consoleProps },\n } = entry;\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\n const { props, name } = consoleProps();\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 = entry.attributes.consoleProps().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":"AAEA,SAASA,SAAS,QAAQ,aAAa;AACvC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,kBAAkB,MAAM,gBAAgB;AAC/C,SAASC,cAAc,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,qBAAqB,QAAQ,YAAY;AAC1F,SAASC,uBAAuB,EAAEC,2BAA2B,EAAEC,SAAS,QAAQ,YAAY;AAE5F,OAAO,IAAMC,mCAAmC,GAAIC,KAAsB,IAAK;EAC7E,IAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,KAAK,CAACG,UAAU;EAC9C,IAAID,UAAU,KAAK,SAAS,EAAE;IAC5B;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAID,KAAK,EAAE;IACT;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAIG,sBAAsB,CAACJ,KAAK,CAAC,EAAE;IACjC;IACA;IACA;IACA;IACA,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMK,6BAA6B,GAAGA,CAACC,YAAgC,EAAEC,IAAY,KAAK;EAC/F,IAAMC,IAAI,GAAGhB,cAAc,CAAC,CAAC;EAC7B,IAAIgB,IAAI,IAAIV,SAAS,CAACU,IAAI,CAAC,EAAE;IAC3B,IAAM;MACJD,IAAI,EAAEE,WAAW;MACjBC,KAAK,EAAE;QAAEH,IAAI,EA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KAAK,QAAQ;AAAA;AAEpF,IAAMU,kBAAkB,GAAGA,CAAA,KAAMxB,YAAY,CAAC,CAAC,CAACkF,QAAQ,CAAC7E,SAAS,CAAC;AAEnE,IAAMoB,wBAAwB,GAAGA,CAACF,eAAgC,EAAE4D,WAA4B,KAAK;EACnG,IAAM;IAAE7C,UAAU,EAAE8C,mBAAmB;IAAElD,IAAI,EAAEmD;EAAiB,CAAC,GAAG9D,eAAe,CAACb,UAAU;EAC9F,IAAM;IAAEwB,IAAI,EAAEoD;EAAa,CAAC,GAAGH,WAAW,CAACzE,UAAU;EAErD,OAAO,CAAC0E,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMjB,qBAAqB,GAAI9D,KAAsB,IACnDA,KAAK,CAACG,UAAU,CAACI,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGyE,KAAA;EAAA,IAAC;IAAEzE,IAAI;IAAEsD;EAAiB,CAAC,GAAAmB,KAAA;EAAA,OAAKzE,IAAI,KAAK,SAAS,IAAIsD,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.js","names":["setupScreenshotAttachmentStep","shouldCreateStepFromCommandLogEntry","startCommandLogStep","reportScreenshot","reportStepError","getFileNameFromPath","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","enableReportingOfCypressScreenshots","Screenshot","defaults","onAfterScreenshot","_len","arguments","length","_ref","Array","_key","name","originalName","path","_","entry","error","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 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,SACEA,6BAA6B,EAC7BC,mCAAmC,EACnCC,mBAAmB,QACd,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,OAAO,IAAMC,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAEzG,OAAO,IAAMC,mCAAmC,GAAGA,CAAA,KAAMJ,OAAO,CAACK,UAAU,CAACC,QAAQ,CAAC;EAAEC;AAAkB,CAAC,CAAC;AAE3G,IAAMA,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,GAAIjB,mBAAmB,CAACkB,IAAI,CAAC;EACtDpB,gBAAgB,CAACoB,IAAI,EAAEF,IAAI,CAAC;EAC5BrB,6BAA6B,CAACsB,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMX,UAAU,GAAGA,CAACc,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAIxB,mCAAmC,CAACwB,KAAK,CAAC,EAAE;IAC9CvB,mBAAmB,CAACuB,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMhB,MAAM,GAAIiB,KAA2B,IAAK;EAC9CtB,eAAe,CAACsB,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIC,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMD,KAAK;EACb;AACF,CAAC;AAED,IAAMC,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAACtB,OAAO,CAACuB,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEtB,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cypress.js","names":["setupScreenshotAttachmentStep","shouldCreateStepFromCommandLogEntry","startCommandLogStep","reportScreenshot","reportStepError","getFileNameFromPath","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","enableReportingOfCypressScreenshots","Screenshot","defaults","onAfterScreenshot","_len","arguments","length","_ref","Array","_key","name","originalName","path","_","entry","error","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,SACEA,6BAA6B,EAC7BC,mCAAmC,EACnCC,mBAAmB,QACd,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,OAAO,IAAMC,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAEzG,OAAO,IAAMC,mCAAmC,GAAGA,CAAA,KAAMJ,OAAO,CAACK,UAAU,CAACC,QAAQ,CAAC;EAAEC;AAAkB,CAAC,CAAC;AAE3G,IAAMA,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,GAAIjB,mBAAmB,CAACkB,IAAI,CAAC;EAEtDpB,gBAAgB,CAACoB,IAAI,EAAEF,IAAI,CAAC;EAC5BrB,6BAA6B,CAACsB,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMX,UAAU,GAAGA,CAACc,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAIxB,mCAAmC,CAACwB,KAAK,CAAC,EAAE;IAC9CvB,mBAAmB,CAACuB,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMhB,MAAM,GAAIiB,KAA2B,IAAK;EAC9CtB,eAAe,CAACsB,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIC,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMD,KAAK;EACb;AACF,CAAC;AAED,IAAMC,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAACtB,OAAO,CAACuB,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEtB,MAAM,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","names":["DEFAULT_RUNTIME_CONFIG","last","toReversed","getAllureState","state","Cypress","env","config","initialized","messages","testPlan","undefined","currentTest","projectDir","stepStack","stepsToFinalize","nextApiStepId","isAllureInitialized","setAllureInitialized","getRuntimeMessages","setRuntimeMessages","value","enqueueRuntimeMessage","message","push","getAllureTestPlan","getProjectDir","getCurrentTest","setCurrentTest","test","dropCurrentTest","getConfig","getStepStack","getCurrentStep","pushStep","step","popStep","pop","popSteps","index","splice","popAllSteps","clearStepStack","setupStepFinalization","finalizer","getStepsToFinalize","clearStepsToFinalize"],"sources":["../../../src/browser/state.ts"],"sourcesContent":["import type { AllureSpecState, CypressMessage, CypressTest, StepDescriptor, StepFinalizer } from \"../types.js\";\nimport { DEFAULT_RUNTIME_CONFIG, last, toReversed } from \"../utils.js\";\n\nexport const getAllureState = () => {\n let state = Cypress.env(\"allure\") as AllureSpecState;\n if (!state) {\n state = {\n config: DEFAULT_RUNTIME_CONFIG,\n initialized: false,\n messages: [],\n testPlan: undefined,\n currentTest: undefined,\n projectDir: undefined,\n stepStack: [],\n stepsToFinalize: [],\n nextApiStepId: 0,\n };\n Cypress.env(\"allure\", state);\n }\n return state;\n};\n\nexport const isAllureInitialized = () => getAllureState().initialized;\n\nexport const setAllureInitialized = () => {\n getAllureState().initialized = true;\n};\n\nexport const getRuntimeMessages = () => getAllureState().messages;\n\nexport const setRuntimeMessages = (value: CypressMessage[]) => {\n getAllureState().messages = value;\n};\n\nexport const enqueueRuntimeMessage = (message: CypressMessage) => {\n getRuntimeMessages().push(message);\n};\n\nexport const getAllureTestPlan = () => getAllureState().testPlan;\n\nexport const getProjectDir = () => getAllureState().projectDir;\n\nexport const getCurrentTest = () => getAllureState().currentTest;\n\nexport const setCurrentTest = (test: CypressTest) => {\n getAllureState().currentTest = test;\n};\n\nexport const dropCurrentTest = () => {\n getAllureState().currentTest = undefined;\n};\n\nexport const getConfig = () => getAllureState().config;\n\nexport const getStepStack = () => getAllureState().stepStack;\n\nexport const getCurrentStep = () => last(getStepStack());\n\nexport const pushStep = (step: StepDescriptor) => getStepStack().push(step);\n\nexport const popStep = () => getStepStack().pop();\n\nexport const popSteps = (index: number) => toReversed(getStepStack().splice(index));\n\nexport const popAllSteps = () => popSteps(0);\n\nexport const clearStepStack = () => {\n getAllureState().stepStack = [];\n};\n\nexport const setupStepFinalization = <T extends StepDescriptor>(step: T, finalizer?: StepFinalizer) =>\n getAllureState().stepsToFinalize.push([step, finalizer]);\n\nexport const getStepsToFinalize = () => getAllureState().stepsToFinalize;\n\nexport const clearStepsToFinalize = () => {\n const state = getAllureState();\n state.stepsToFinalize = [];\n};\n"],"mappings":"AACA,SAASA,sBAAsB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,aAAa;AAEtE,OAAO,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAIC,KAAK,GAAGC,OAAO,CAACC,GAAG,CAAC,QAAQ,CAAoB;EACpD,IAAI,CAACF,KAAK,EAAE;IACVA,KAAK,GAAG;MACNG,MAAM,EAAEP,sBAAsB;MAC9BQ,WAAW,EAAE,KAAK;MAClBC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAEC,SAAS;MACnBC,WAAW,EAAED,SAAS;MACtBE,UAAU,EAAEF,SAAS;MACrBG,SAAS,EAAE,EAAE;MACbC,eAAe,EAAE,EAAE;MACnBC,aAAa,EAAE;IACjB,CAAC;IACDX,OAAO,CAACC,GAAG,CAAC,QAAQ,EAAEF,KAAK,CAAC;EAC9B;EACA,OAAOA,KAAK;AACd,CAAC;AAED,OAAO,IAAMa,mBAAmB,GAAGA,CAAA,KAAMd,cAAc,CAAC,CAAC,CAACK,WAAW;AAErE,OAAO,IAAMU,oBAAoB,GAAGA,CAAA,KAAM;EACxCf,cAAc,CAAC,CAAC,CAACK,WAAW,GAAG,IAAI;AACrC,CAAC;AAED,OAAO,IAAMW,kBAAkB,GAAGA,CAAA,KAAMhB,cAAc,CAAC,CAAC,CAACM,QAAQ;AAEjE,OAAO,IAAMW,kBAAkB,GAAIC,KAAuB,IAAK;EAC7DlB,cAAc,CAAC,CAAC,CAACM,QAAQ,GAAGY,KAAK;AACnC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GA,CAAA,KAAM;EAClCvC,cAAc,CAAC,CAAC,CAACW,SAAS,GAAG,EAAE;AACjC,CAAC;AAED,OAAO,IAAM6B,qBAAqB,GAAGA,CAA2BR,IAAO,EAAES,SAAyB,KAChGzC,cAAc,CAAC,CAAC,CAACY,eAAe,CAACS,IAAI,CAAC,CAACW,IAAI,EAAES,SAAS,CAAC,CAAC;AAE1D,OAAO,IAAMC,kBAAkB,GAAGA,CAAA,KAAM1C,cAAc,CAAC,CAAC,CAACY,eAAe;AAExE,OAAO,IAAM+B,oBAAoB,GAAGA,CAAA,KAAM;EACxC,IAAM1C,KAAK,GAAGD,cAAc,CAAC,CAAC;EAC9BC,KAAK,CAACW,eAAe,GAAG,EAAE;AAC5B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"state.js","names":["DEFAULT_RUNTIME_CONFIG","last","toReversed","getAllureState","state","Cypress","env","config","initialized","messages","testPlan","undefined","currentTest","projectDir","stepStack","stepsToFinalize","nextApiStepId","isAllureInitialized","setAllureInitialized","getRuntimeMessages","setRuntimeMessages","value","enqueueRuntimeMessage","message","push","getAllureTestPlan","getProjectDir","getCurrentTest","setCurrentTest","test","dropCurrentTest","getConfig","getStepStack","getCurrentStep","pushStep","step","popStep","pop","popSteps","index","splice","popAllSteps","clearStepStack","setupStepFinalization","finalizer","getStepsToFinalize","clearStepsToFinalize"],"sources":["../../../src/browser/state.ts"],"sourcesContent":["import type { AllureSpecState, CypressMessage, CypressTest, StepDescriptor, StepFinalizer } from \"../types.js\";\nimport { DEFAULT_RUNTIME_CONFIG, last, toReversed } from \"../utils.js\";\n\nexport const getAllureState = () => {\n let state = Cypress.env(\"allure\") as AllureSpecState;\n\n if (!state) {\n state = {\n config: DEFAULT_RUNTIME_CONFIG,\n initialized: false,\n messages: [],\n testPlan: undefined,\n currentTest: undefined,\n projectDir: undefined,\n stepStack: [],\n stepsToFinalize: [],\n nextApiStepId: 0,\n };\n\n Cypress.env(\"allure\", state);\n }\n\n return state;\n};\n\nexport const isAllureInitialized = () => getAllureState().initialized;\n\nexport const setAllureInitialized = () => {\n getAllureState().initialized = true;\n};\n\nexport const getRuntimeMessages = () => getAllureState().messages;\n\nexport const setRuntimeMessages = (value: CypressMessage[]) => {\n getAllureState().messages = value;\n};\n\nexport const enqueueRuntimeMessage = (message: CypressMessage) => {\n getRuntimeMessages().push(message);\n};\n\nexport const getAllureTestPlan = () => getAllureState().testPlan;\n\nexport const getProjectDir = () => getAllureState().projectDir;\n\nexport const getCurrentTest = () => getAllureState().currentTest;\n\nexport const setCurrentTest = (test: CypressTest) => {\n getAllureState().currentTest = test;\n};\n\nexport const dropCurrentTest = () => {\n getAllureState().currentTest = undefined;\n};\n\nexport const getConfig = () => getAllureState().config;\n\nexport const getStepStack = () => getAllureState().stepStack;\n\nexport const getCurrentStep = () => last(getStepStack());\n\nexport const pushStep = (step: StepDescriptor) => getStepStack().push(step);\n\nexport const popStep = () => getStepStack().pop();\n\nexport const popSteps = (index: number) => toReversed(getStepStack().splice(index));\n\nexport const popAllSteps = () => popSteps(0);\n\nexport const clearStepStack = () => {\n getAllureState().stepStack = [];\n};\n\nexport const setupStepFinalization = <T extends StepDescriptor>(step: T, finalizer?: StepFinalizer) =>\n getAllureState().stepsToFinalize.push([step, finalizer]);\n\nexport const getStepsToFinalize = () => getAllureState().stepsToFinalize;\n\nexport const clearStepsToFinalize = () => {\n const state = getAllureState();\n state.stepsToFinalize = [];\n};\n"],"mappings":"AACA,SAASA,sBAAsB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,aAAa;AAEtE,OAAO,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAIC,KAAK,GAAGC,OAAO,CAACC,GAAG,CAAC,QAAQ,CAAoB;EAEpD,IAAI,CAACF,KAAK,EAAE;IACVA,KAAK,GAAG;MACNG,MAAM,EAAEP,sBAAsB;MAC9BQ,WAAW,EAAE,KAAK;MAClBC,QAAQ,EAAE,EAAE;MACZC,QAAQ,EAAEC,SAAS;MACnBC,WAA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AAC,CAACI,MAAM;AAEtD,OAAO,IAAMyB,YAAY,GAAGA,CAAA,KAAM7B,cAAc,CAAC,CAAC,CAACW,SAAS;AAE5D,OAAO,IAAMmB,cAAc,GAAGA,CAAA,KAAMhC,IAAI,CAAC+B,YAAY,CAAC,CAAC,CAAC;AAExD,OAAO,IAAME,QAAQ,GAAIC,IAAoB,IAAKH,YAAY,CAAC,CAAC,CAACR,IAAI,CAACW,IAAI,CAAC;AAE3E,OAAO,IAAMC,OAAO,GAAGA,CAAA,KAAMJ,YAAY,CAAC,CAAC,CAACK,GAAG,CAAC,CAAC;AAEjD,OAAO,IAAMC,QAAQ,GAAIC,KAAa,IAAKrC,UAAU,CAAC8B,YAAY,CAAC,CAAC,CAACQ,MAAM,CAACD,KAAK,CAAC,CAAC;AAEnF,OAAO,IAAME,WAAW,GAAGA,CAAA,KAAMH,QAAQ,CAAC,CAAC,CAAC;AAE5C,OAAO,IAAMI,cAAc,GAAGA,CAAA,KAAM;EAClCvC,cAAc,CAAC,CAAC,CAACW,SAAS,GAAG,EAAE;AACjC,CAAC;AAED,OAAO,IAAM6B,qBAAqB,GAAGA,CAA2BR,IAAO,EAAES,SAAyB,KAChGzC,cAAc,CAAC,CAAC,CAACY,eAAe,CAACS,IAAI,CAAC,CAACW,IAAI,EAAES,SAAS,CAAC,CAAC;AAE1D,OAAO,IAAMC,kBAAkB,GAAGA,CAAA,KAAM1C,cAAc,CAAC,CAAC,CAACY,eAAe;AAExE,OAAO,IAAM+B,oBAAoB,GAAGA,CAAA,KAAM;EACxC,IAAM1C,KAAK,GAAGD,cAAc,CAAC,CAAC;EAC9BC,KAAK,CAACW,eAAe,GAAG,EAAE;AAC5B,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { LabelName } from "allure-js-commons";
2
2
  import { getAllureTestPlan } from "./state.js";
3
- import { getNamesAndLabels, resolveSpecRelativePath } from "./utils.js";
3
+ import { getTestMetadata, resolveSpecRelativePath } from "./utils.js";
4
4
  export var applyTestPlan = (spec, root) => {
5
5
  var testPlan = getAllureTestPlan();
6
6
  if (testPlan) {
@@ -30,7 +30,7 @@ var getIndicesOfDeselectedTests = (testPlan, spec, specPath, tests) => {
30
30
  var {
31
31
  fullNameSuffix,
32
32
  labels
33
- } = getNamesAndLabels(spec, test);
33
+ } = getTestMetadata(test);
34
34
  var fullName = "".concat(specPath, "#").concat(fullNameSuffix);
35
35
  var allureId = (_labels$find = labels.find(_ref => {
36
36
  var {
@@ -1 +1 @@
1
- {"version":3,"file":"testplan.js","names":["LabelName","getAllureTestPlan","getNamesAndLabels","resolveSpecRelativePath","applyTestPlan","spec","root","testPlan","specPath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","fullName","concat","allureId","find","_ref","name","ALLURE_ID","value","includedInTestPlan","arr","indices","splice","some","_test$id","id","toString","selector"],"sources":["../../../src/browser/testplan.ts"],"sourcesContent":["import { LabelName } from \"allure-js-commons\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\nimport type { CypressSuite, CypressTest } from \"../types.js\";\nimport { getAllureTestPlan } from \"./state.js\";\nimport { getNamesAndLabels, resolveSpecRelativePath } from \"./utils.js\";\n\nexport const applyTestPlan = (spec: Cypress.Spec, root: CypressSuite) => {\n const testPlan = getAllureTestPlan();\n if (testPlan) {\n const specPath = resolveSpecRelativePath(spec);\n for (const suite of iterateSuites(root)) {\n const indicesToRemove = getIndicesOfDeselectedTests(testPlan, spec, specPath, suite.tests);\n removeSortedIndices(suite.tests, indicesToRemove);\n }\n }\n};\n\nconst iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal -\n // the same order as used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nconst getIndicesOfDeselectedTests = (\n testPlan: TestPlanV1,\n spec: Cypress.Spec,\n specPath: string,\n tests: readonly CypressTest[],\n) => {\n const indicesToRemove: number[] = [];\n tests.forEach((test, index) => {\n const { fullNameSuffix, labels } = getNamesAndLabels(spec, test);\n const fullName = `${specPath}#${fullNameSuffix}`;\n const allureId = labels.find(({ name }) => name === LabelName.ALLURE_ID)?.value;\n\n if (!includedInTestPlan(testPlan, fullName, allureId)) {\n indicesToRemove.push(index);\n }\n });\n return indicesToRemove;\n};\n\nconst removeSortedIndices = <T>(arr: T[], indices: readonly number[]) => {\n for (let i = indices.length - 1; i >= 0; i--) {\n arr.splice(indices[i], 1);\n }\n};\n\nconst includedInTestPlan = (testPlan: TestPlanV1, fullName: string, allureId: string | undefined): boolean =>\n testPlan.tests.some((test) => (allureId && test.id?.toString() === allureId) || test.selector === fullName);\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAG7C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,iBAAiB,EAAEC,uBAAuB,QAAQ,YAAY;AAEvE,OAAO,IAAMC,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAAGN,iBAAiB,CAAC,CAAC;EACpC,IAAIM,QAAQ,EAAE;IACZ,IAAMC,QAAQ,GAAGL,uBAAuB,CAACE,IAAI,CAAC;IAC9C,KAAK,IAAMI,KAAK,IAAIC,aAAa,CAACJ,IAAI,CAAC,EAAE;MACvC,IAAMK,eAAe,GAAGC,2BAA2B,CAACL,QAAQ,EAAEF,IAAI,EAAEG,QAAQ,EAAEC,KAAK,CAACI,KAAK,CAAC;MAC1FC,mBAAmB,CAACL,KAAK,CAACI,KAAK,EAAEF,eAAe,CAAC;IACnD;EACF;AACF,CAAC;AAED,IAAMD,aAAa,GAAG,UAAhBA,aAAaA,CAAcK,MAAoB,EAAE;EACrD,IAAMC,UAA0B,GAAG,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AIpB,CAAC,GAAGoB,OAAO,CAAClB,MAAM,GAAG,CAAC,EAAEF,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5CmB,GAAG,CAACE,MAAM,CAACD,OAAO,CAACpB,CAAC,CAAC,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC;AAED,IAAMkB,kBAAkB,GAAGA,CAAC9B,QAAoB,EAAEsB,QAAgB,EAAEE,QAA4B,KAC9FxB,QAAQ,CAACM,KAAK,CAAC4B,IAAI,CAAEjB,IAAI;EAAA,IAAAkB,QAAA;EAAA,OAAMX,QAAQ,IAAI,EAAAW,QAAA,GAAAlB,IAAI,CAACmB,EAAE,cAAAD,QAAA,uBAAPA,QAAA,CAASE,QAAQ,CAAC,CAAC,MAAKb,QAAQ,IAAKP,IAAI,CAACqB,QAAQ,KAAKhB,QAAQ;AAAA,EAAC","ignoreList":[]}
1
+ {"version":3,"file":"testplan.js","names":["LabelName","getAllureTestPlan","getTestMetadata","resolveSpecRelativePath","applyTestPlan","spec","root","testPlan","specPath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","fullName","concat","allureId","find","_ref","name","ALLURE_ID","value","includedInTestPlan","arr","indices","splice","some","_test$id","id","toString","selector"],"sources":["../../../src/browser/testplan.ts"],"sourcesContent":["import { LabelName } from \"allure-js-commons\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\nimport type { CypressSuite, CypressTest } from \"../types.js\";\nimport { getAllureTestPlan } from \"./state.js\";\nimport { getTestMetadata, resolveSpecRelativePath } from \"./utils.js\";\n\nexport const applyTestPlan = (spec: Cypress.Spec, root: CypressSuite) => {\n const testPlan = getAllureTestPlan();\n if (testPlan) {\n const specPath = resolveSpecRelativePath(spec);\n for (const suite of iterateSuites(root)) {\n const indicesToRemove = getIndicesOfDeselectedTests(testPlan, spec, specPath, suite.tests);\n removeSortedIndices(suite.tests, indicesToRemove);\n }\n }\n};\n\nconst iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal -\n // the same order as used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nconst getIndicesOfDeselectedTests = (\n testPlan: TestPlanV1,\n spec: Cypress.Spec,\n specPath: string,\n tests: readonly CypressTest[],\n) => {\n const indicesToRemove: number[] = [];\n tests.forEach((test, index) => {\n const { fullNameSuffix, labels } = getTestMetadata(test);\n const fullName = `${specPath}#${fullNameSuffix}`;\n const allureId = labels.find(({ name }) => name === LabelName.ALLURE_ID)?.value;\n\n if (!includedInTestPlan(testPlan, fullName, allureId)) {\n indicesToRemove.push(index);\n }\n });\n return indicesToRemove;\n};\n\nconst removeSortedIndices = <T>(arr: T[], indices: readonly number[]) => {\n for (let i = indices.length - 1; i >= 0; i--) {\n arr.splice(indices[i], 1);\n }\n};\n\nconst includedInTestPlan = (testPlan: TestPlanV1, fullName: string, allureId: string | undefined): boolean =>\n testPlan.tests.some((test) => (allureId && test.id?.toString() === allureId) || test.selector === fullName);\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAG7C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,YAAY;AAErE,OAAO,IAAMC,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAAGN,iBAAiB,CAAC,CAAC;EACpC,IAAIM,QAAQ,EAAE;IACZ,IAAMC,QAAQ,GAAGL,uBAAuB,CAACE,IAAI,CAAC;IAC9C,KAAK,IAAMI,KAAK,IAAIC,aAAa,CAACJ,IAAI,CAAC,EAAE;MACvC,IAAMK,eAAe,GAAGC,2BAA2B,CAACL,QAA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EsB,QAAQ,EAAEE,QAAQ,CAAC,EAAE;MACrDpB,eAAe,CAACW,IAAI,CAACG,KAAK,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,OAAOd,eAAe;AACxB,CAAC;AAED,IAAMG,mBAAmB,GAAGA,CAAIwB,GAAQ,EAAEC,OAA0B,KAAK;EACvE,KAAK,IAAIpB,CAAC,GAAGoB,OAAO,CAAClB,MAAM,GAAG,CAAC,EAAEF,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5CmB,GAAG,CAACE,MAAM,CAACD,OAAO,CAACpB,CAAC,CAAC,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC;AAED,IAAMkB,kBAAkB,GAAGA,CAAC9B,QAAoB,EAAEsB,QAAgB,EAAEE,QAA4B,KAC9FxB,QAAQ,CAACM,KAAK,CAAC4B,IAAI,CAAEjB,IAAI;EAAA,IAAAkB,QAAA;EAAA,OAAMX,QAAQ,IAAI,EAAAW,QAAA,GAAAlB,IAAI,CAACmB,EAAE,cAAAD,QAAA,uBAAPA,QAAA,CAASE,QAAQ,CAAC,CAAC,MAAKb,QAAQ,IAAKP,IAAI,CAACqB,QAAQ,KAAKhB,QAAQ;AAAA,EAAC","ignoreList":[]}
@@ -26,9 +26,9 @@ export var uint8ArrayToBase64 = data => {
26
26
  return btoa(String.fromCharCode.apply(null, data));
27
27
  };
28
28
  export var getTestStartData = test => {
29
- var _test$wallClockStarte;
30
- return _objectSpread(_objectSpread({}, getNamesAndLabels(Cypress.spec, test)), {}, {
31
- start: ((_test$wallClockStarte = test.wallClockStartedAt) === null || _test$wallClockStarte === void 0 ? void 0 : _test$wallClockStarte.getTime()) || Date.now()
29
+ var _test$wallClockStarte, _test$wallClockStarte2;
30
+ return _objectSpread(_objectSpread({}, getTestMetadata(test)), {}, {
31
+ start: typeof test.wallClockStartedAt === "string" ? Date.parse(test.wallClockStartedAt) : ((_test$wallClockStarte = test.wallClockStartedAt) === null || _test$wallClockStarte === void 0 || (_test$wallClockStarte2 = _test$wallClockStarte.getTime) === null || _test$wallClockStarte2 === void 0 ? void 0 : _test$wallClockStarte2.call(_test$wallClockStarte)) || Date.now()
32
32
  });
33
33
  };
34
34
  export var getTestStopData = test => {
@@ -86,17 +86,19 @@ export var getSuitePath = test => {
86
86
  };
87
87
  export var getSuiteTitlePath = test => getSuitePath(test).filter(s => s.title).map(s => s.title);
88
88
  export var generateApiStepId = () => (getAllureState().nextApiStepId++).toString();
89
- export var getNamesAndLabels = (spec, test) => {
89
+ export var getTestMetadata = test => {
90
90
  var rawName = test.title;
91
91
  var {
92
92
  cleanTitle: name,
93
- labels
93
+ labels,
94
+ links
94
95
  } = extractMetadataFromString(rawName);
95
96
  var suites = test.titlePath().slice(0, -1);
96
97
  var fullNameSuffix = "".concat([...suites, name].join(" "));
97
98
  return {
98
99
  name,
99
100
  labels,
101
+ links,
100
102
  fullNameSuffix
101
103
  };
102
104
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["Status","extractMetadataFromString","getMessageAndTraceFromError","getStatusFromError","ALLURE_REPORT_SYSTEM_HOOK","getAllureState","getProjectDir","resolveStepStatus","IS_WIN","Cypress","platform","getFileNameFromPath","path","substring","lastIndexOf","resolveSpecRelativePath","spec","projectDir","specPath","absolute","length","relative","replaceAll","uint8ArrayToBase64","data","u8arrayLike","Array","isArray","buffer","btoa","String","fromCharCode","apply","getTestStartData","test","_test$wallClockStarte","_objectSpread","getNamesAndLabels","start","wallClockStartedAt","getTime","Date","now","getTestStopData","_test$duration","_retries","duration","retries","getTestSkipData","statusDetails","message","getStepStopData","step","status","id","stop","testReportedKey","Symbol","markTestAsReported","isTestReported","iterateSuites","parent","suiteStack","s","pop","i","suites","push","iterateTests","suite","tests","getSuitePath","reverse","getSuiteTitlePath","filter","title","map","generateApiStepId","nextApiStepId","toString","rawName","cleanTitle","name","labels","titlePath","slice","fullNameSuffix","concat","join","isAllureHook","hook","includes","isRootAfterAllHook","root","hookName","isLastRootAfterHook","context","currentAfterAll","rootSuite","hooks","lastAfterAll","findLast","h","hookId","getStatusDataOfTestSkippedByHookError","hookTitle","isEachHook","err","SKIPPED","trace","getSkipReason","suiteName"],"sources":["../../../src/browser/utils.ts"],"sourcesContent":["import { Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport type { CypressHook, CypressStepStopMessage, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { ALLURE_REPORT_SYSTEM_HOOK } from \"./events/mocha.js\";\nimport { getAllureState, getProjectDir } from \"./state.js\";\nimport { resolveStepStatus } from \"./steps.js\";\n\nconst IS_WIN = Cypress.platform === \"win32\";\n\nexport const getFileNameFromPath = (path: string) => path.substring(path.lastIndexOf(IS_WIN ? \"\\\\\" : \"/\") + 1);\n\nexport const resolveSpecRelativePath = (spec: Cypress.Spec) => {\n const projectDir = getProjectDir();\n const specPath = projectDir ? spec.absolute.substring(projectDir.length + 1) : spec.relative;\n return IS_WIN ? specPath.replaceAll(\"\\\\\", \"/\") : specPath;\n};\n\nexport const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const getTestStartData = (test: CypressTest) => ({\n ...getNamesAndLabels(Cypress.spec, test),\n start: test.wallClockStartedAt?.getTime() || Date.now(),\n});\n\nexport const getTestStopData = (test: CypressTest) => ({\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n});\n\nexport const getTestSkipData = () => ({\n statusDetails: { message: \"This is a pending test\" },\n});\n\nexport const getStepStopData = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n const data: CypressStepStopMessage[\"data\"] = {\n id: step.id,\n stop: Date.now(),\n status: status ?? resolveStepStatus(step),\n };\n if (statusDetails) {\n data.statusDetails = statusDetails;\n }\n return data;\n};\n\nconst testReportedKey = Symbol(\"The test has been reported to Allure\");\n\nexport const markTestAsReported = (test: CypressTest) => {\n (test as any)[testReportedKey] = true;\n};\n\nexport const isTestReported = (test: CypressTest) => (test as any)[testReportedKey] === true;\n\nexport const iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal;\n // the same order is used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nexport const iterateTests = function* (parent: CypressSuite) {\n for (const suite of iterateSuites(parent)) {\n yield* suite.tests;\n }\n};\n\nexport const getSuitePath = (test: CypressTest) => {\n const suites: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = test.parent; s; s = s.parent) {\n suites.push(s);\n }\n suites.reverse();\n return suites;\n};\n\nexport const getSuiteTitlePath = (test: CypressTest): string[] =>\n getSuitePath(test)\n .filter((s) => s.title)\n .map((s) => s.title);\n\nexport const generateApiStepId = () => (getAllureState().nextApiStepId++).toString();\n\nexport const getNamesAndLabels = (spec: Cypress.Spec, test: CypressTest) => {\n const rawName = test.title;\n const { cleanTitle: name, labels } = extractMetadataFromString(rawName);\n const suites = test.titlePath().slice(0, -1);\n const fullNameSuffix = `${[...suites, name].join(\" \")}`;\n return { name, labels, fullNameSuffix };\n};\n\nexport const isAllureHook = (hook: CypressHook) => hook.title.includes(ALLURE_REPORT_SYSTEM_HOOK);\n\nexport const isRootAfterAllHook = (hook: CypressHook) => hook.parent!.root && hook.hookName === \"after all\";\n\nexport const isLastRootAfterHook = (context: Mocha.Context) => {\n const currentAfterAll = context.test as CypressHook;\n const rootSuite = (context.test as CypressHook).parent!;\n const hooks = (rootSuite as any).hooks as CypressHook[];\n const lastAfterAll = hooks.findLast((h) => h.hookName === \"after all\");\n return lastAfterAll?.hookId === currentAfterAll.hookId;\n};\n\nexport const getStatusDataOfTestSkippedByHookError = (\n hookTitle: string,\n isEachHook: boolean,\n err: Error,\n suite: CypressSuite,\n) => {\n const status = isEachHook ? Status.SKIPPED : getStatusFromError(err);\n const { message, trace } = getMessageAndTraceFromError(err);\n return {\n status,\n statusDetails: {\n message: isEachHook ? getSkipReason(hookTitle, suite) : message,\n trace,\n },\n };\n};\n\nconst getSkipReason = (hookTitle: string, suite: CypressSuite) => {\n const suiteName = suite.title ? `'${suite.title}'` : \"root\";\n return `'${hookTitle}' defined in the ${suiteName} suite has failed`;\n};\n"],"mappings":";;;;;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,yBAAyB,EAAEC,2BAA2B,EAAEC,kBAAkB,QAAQ,uBAAuB;AAElH,SAASC,yBAAyB,QAAQ,mBAAmB;AAC7D,SAASC,cAAc,EAAEC,aAAa,QAAQ,YAAY;AAC1D,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,IAAMC,MAAM,GAAGC,OAAO,CAACC,QAAQ,KAAK,OAAO;AAE3C,OAAO,IAAMC,mBAAmB,GAAIC,IAAY,IAAKA,IAAI,CAACC,SAAS,CAACD,IAAI,CAACE,WAAW,CAACN,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9G,OAAO,IAAMO,uBAAuB,GAAIC,IAAkB,IAAK;EAC7D,IAAMC,UAAU,GAAGX,aAAa,CAAC,CAAC;EAClC,IAAMY,QAAQ,GAAGD,UAAU,GAAGD,IAAI,CAACG,QAAQ,CAACN,SAAS,CAACI,UAAU,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGJ,IAAI,CAACK,QAAQ;EAC5F,OAAOb,MAAM,GAAGU,QAAQ,CAACI,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,GAAGJ,QAAQ;AAC3D,CAAC;AAED,OAAO,IAAMK,kBAAkB,GAAIC,IAAa,IAAK;E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D,OAAO,CAAC9D,IAAmB;EACnD,IAAMgE,SAAS,GAAIF,OAAO,CAAC9D,IAAI,CAAiB2B,MAAO;EACvD,IAAMsC,KAAK,GAAID,SAAS,CAASC,KAAsB;EACvD,IAAMC,YAAY,GAAGD,KAAK,CAACE,QAAQ,CAAEC,CAAC,IAAKA,CAAC,CAACR,QAAQ,KAAK,WAAW,CAAC;EACtE,OAAO,CAAAM,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,MAAM,MAAKN,eAAe,CAACM,MAAM;AACxD,CAAC;AAED,OAAO,IAAMC,qCAAqC,GAAGA,CACnDC,SAAiB,EACjBC,UAAmB,EACnBC,GAAU,EACVtC,KAAmB,KAChB;EACH,IAAMhB,MAAM,GAAGqD,UAAU,GAAG1G,MAAM,CAAC4G,OAAO,GAAGzG,kBAAkB,CAACwG,GAAG,CAAC;EACpE,IAAM;IAAEzD,OAAO;IAAE2D;EAAM,CAAC,GAAG3G,2BAA2B,CAACyG,GAAG,CAAC;EAC3D,OAAO;IACLtD,MAAM;IACNJ,aAAa,EAAE;MACbC,OAAO,EAAEwD,UAAU,GAAGI,aAAa,CAACL,SAAS,EAAEpC,KAAK,CAAC,GAAGnB,OAAO;MAC/D2D;IACF;EACF,CAAC;AACH,CAAC;AAED,IAAMC,aAAa,GAAGA,CAACL,SAAiB,EAAEpC,KAAmB,KAAK;EAChE,IAAM0C,SAAS,GAAG1C,KAAK,CAACM,KAAK,OAAAY,MAAA,CAAOlB,KAAK,CAACM,KAAK,SAAM,MAAM;EAC3D,WAAAY,MAAA,CAAWkB,SAAS,uBAAAlB,MAAA,CAAoBwB,SAAS;AACnD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["Status","extractMetadataFromString","getMessageAndTraceFromError","getStatusFromError","ALLURE_REPORT_SYSTEM_HOOK","getAllureState","getProjectDir","resolveStepStatus","IS_WIN","Cypress","platform","getFileNameFromPath","path","substring","lastIndexOf","resolveSpecRelativePath","spec","projectDir","specPath","absolute","length","relative","replaceAll","uint8ArrayToBase64","data","u8arrayLike","Array","isArray","buffer","btoa","String","fromCharCode","apply","getTestStartData","test","_test$wallClockStarte","_test$wallClockStarte2","_objectSpread","getTestMetadata","start","wallClockStartedAt","Date","parse","getTime","call","now","getTestStopData","_test$duration","_retries","duration","retries","getTestSkipData","statusDetails","message","getStepStopData","step","status","id","stop","testReportedKey","Symbol","markTestAsReported","isTestReported","iterateSuites","parent","suiteStack","s","pop","i","suites","push","iterateTests","suite","tests","getSuitePath","reverse","getSuiteTitlePath","filter","title","map","generateApiStepId","nextApiStepId","toString","rawName","cleanTitle","name","labels","links","titlePath","slice","fullNameSuffix","concat","join","isAllureHook","hook","includes","isRootAfterAllHook","root","hookName","isLastRootAfterHook","context","currentAfterAll","rootSuite","hooks","lastAfterAll","findLast","h","hookId","getStatusDataOfTestSkippedByHookError","hookTitle","isEachHook","err","SKIPPED","trace","getSkipReason","suiteName"],"sources":["../../../src/browser/utils.ts"],"sourcesContent":["import { Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport type { CypressHook, CypressStepStopMessage, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { ALLURE_REPORT_SYSTEM_HOOK } from \"./events/mocha.js\";\nimport { getAllureState, getProjectDir } from \"./state.js\";\nimport { resolveStepStatus } from \"./steps.js\";\n\nconst IS_WIN = Cypress.platform === \"win32\";\n\nexport const getFileNameFromPath = (path: string) => path.substring(path.lastIndexOf(IS_WIN ? \"\\\\\" : \"/\") + 1);\n\nexport const resolveSpecRelativePath = (spec: Cypress.Spec) => {\n const projectDir = getProjectDir();\n const specPath = projectDir ? spec.absolute.substring(projectDir.length + 1) : spec.relative;\n return IS_WIN ? specPath.replaceAll(\"\\\\\", \"/\") : specPath;\n};\n\nexport const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const getTestStartData = (test: CypressTest) => ({\n ...getTestMetadata(test),\n start:\n typeof test.wallClockStartedAt === \"string\"\n ? Date.parse(test.wallClockStartedAt)\n : test.wallClockStartedAt?.getTime?.() || Date.now(),\n});\n\nexport const getTestStopData = (test: CypressTest) => ({\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n});\n\nexport const getTestSkipData = () => ({\n statusDetails: { message: \"This is a pending test\" },\n});\n\nexport const getStepStopData = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n const data: CypressStepStopMessage[\"data\"] = {\n id: step.id,\n stop: Date.now(),\n status: status ?? resolveStepStatus(step),\n };\n if (statusDetails) {\n data.statusDetails = statusDetails;\n }\n return data;\n};\n\nconst testReportedKey = Symbol(\"The test has been reported to Allure\");\n\nexport const markTestAsReported = (test: CypressTest) => {\n (test as any)[testReportedKey] = true;\n};\n\nexport const isTestReported = (test: CypressTest) => (test as any)[testReportedKey] === true;\n\nexport const iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal;\n // the same order is used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nexport const iterateTests = function* (parent: CypressSuite) {\n for (const suite of iterateSuites(parent)) {\n yield* suite.tests;\n }\n};\n\nexport const getSuitePath = (test: CypressTest) => {\n const suites: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = test.parent; s; s = s.parent) {\n suites.push(s);\n }\n suites.reverse();\n return suites;\n};\n\nexport const getSuiteTitlePath = (test: CypressTest): string[] =>\n getSuitePath(test)\n .filter((s) => s.title)\n .map((s) => s.title);\n\nexport const generateApiStepId = () => (getAllureState().nextApiStepId++).toString();\n\nexport const getTestMetadata = (test: CypressTest) => {\n const rawName = test.title;\n const { cleanTitle: name, labels, links } = extractMetadataFromString(rawName);\n const suites = test.titlePath().slice(0, -1);\n const fullNameSuffix = `${[...suites, name].join(\" \")}`;\n return { name, labels, links, fullNameSuffix };\n};\n\nexport const isAllureHook = (hook: CypressHook) => hook.title.includes(ALLURE_REPORT_SYSTEM_HOOK);\n\nexport const isRootAfterAllHook = (hook: CypressHook) => hook.parent!.root && hook.hookName === \"after all\";\n\nexport const isLastRootAfterHook = (context: Mocha.Context) => {\n const currentAfterAll = context.test as CypressHook;\n const rootSuite = (context.test as CypressHook).parent!;\n const hooks = (rootSuite as any).hooks as CypressHook[];\n const lastAfterAll = hooks.findLast((h) => h.hookName === \"after all\");\n return lastAfterAll?.hookId === currentAfterAll.hookId;\n};\n\nexport const getStatusDataOfTestSkippedByHookError = (\n hookTitle: string,\n isEachHook: boolean,\n err: Error,\n suite: CypressSuite,\n) => {\n const status = isEachHook ? Status.SKIPPED : getStatusFromError(err);\n const { message, trace } = getMessageAndTraceFromError(err);\n return {\n status,\n statusDetails: {\n message: isEachHook ? getSkipReason(hookTitle, suite) : message,\n trace,\n },\n };\n};\n\nconst getSkipReason = (hookTitle: string, suite: CypressSuite) => {\n const suiteName = suite.title ? `'${suite.title}'` : \"root\";\n return `'${hookTitle}' defined in the ${suiteName} suite has failed`;\n};\n"],"mappings":";;;;;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,yBAAyB,EAAEC,2BAA2B,EAAEC,kBAAkB,QAAQ,uBAAuB;AAElH,SAASC,yBAAyB,QAAQ,mBAAmB;AAC7D,SAASC,cAAc,EAAEC,aAAa,QAAQ,YAAY;AAC1D,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,IAAMC,MAAM,GAAGC,OAAO,CAACC,QAAQ,KAAK,OAAO;AAE3C,OAAO,IAAMC,mBAAmB,GAAIC,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AAE4D;EAAM,CAAC,GAAG/G,2BAA2B,CAAC6G,GAAG,CAAC;EAC3D,OAAO;IACLvD,MAAM;IACNJ,aAAa,EAAE;MACbC,OAAO,EAAEyD,UAAU,GAAGI,aAAa,CAACL,SAAS,EAAErC,KAAK,CAAC,GAAGnB,OAAO;MAC/D4D;IACF;EACF,CAAC;AACH,CAAC;AAED,IAAMC,aAAa,GAAGA,CAACL,SAAiB,EAAErC,KAAmB,KAAK;EAChE,IAAM2C,SAAS,GAAG3C,KAAK,CAACM,KAAK,OAAAa,MAAA,CAAOnB,KAAK,CAACM,KAAK,SAAM,MAAM;EAC3D,WAAAa,MAAA,CAAWkB,SAAS,uBAAAlB,MAAA,CAAoBwB,SAAS;AACnD,CAAC","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var c=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),be=[c.FAILED,c.BROKEN,c.PASSED,c.SKIPPED],De=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),l=function(t){return t.ALLURE_ID="ALLURE_ID",t.AS_ID="ALLURE_ID",t.SUITE="suite",t.PARENT_SUITE="parentSuite",t.SUB_SUITE="subSuite",t.EPIC="epic",t.FEATURE="feature",t.STORY="story",t.SEVERITY="severity",t.TAG="tag",t.OWNER="owner",t.LEAD="lead",t.HOST="host",t.THREAD="thread",t.TEST_METHOD="testMethod",t.TEST_CLASS="testClass",t.PACKAGE="package",t.FRAMEWORK="framework",t.LANGUAGE="language",t.LAYER="layer",t}({}),Pe=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),N=function(t){return t.TEXT="text/plain",t.XML="application/xml",t.HTML="text/html",t.CSV="text/csv",t.TSV="text/tab-separated-values",t.CSS="text/css",t.URI="text/uri-list",t.SVG="image/svg+xml",t.PNG="image/png",t.JSON="application/json",t.ZIP="application/zip",t.WEBM="video/webm",t.JPEG="image/jpeg",t.MP4="video/mp4",t.IMAGEDIFF="application/vnd.allure.image.diff",t}({}),R=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function _(){_=function(a,o){return new r(a,void 0,o)};var t=RegExp.prototype,e=new WeakMap;function r(n,a,o){var p=RegExp(n,a);return e.set(p,o||e.get(n)),M(p,r.prototype)}function s(n,a){var o=e.get(a);return Object.keys(o).reduce(function(p,i){var y=o[i];if(typeof y=="number")p[i]=n[y];else{for(var S=0;n[y[S]]===void 0&&S+1<y.length;)S++;p[i]=n[y[S]]}return p},Object.create(null))}return Re(r,RegExp),r.prototype.exec=function(n){var a=t.exec.call(this,n);if(a){a.groups=s(a,this);var o=a.indices;o&&(o.groups=s(o,this))}return a},r.prototype[Symbol.replace]=function(n,a){if(typeof a=="string"){var o=e.get(this);return t[Symbol.replace].call(this,n,a.replace(/\$<([^>]+)>/g,function(i,y){var S=o[y];return"$"+(Array.isArray(S)?S.join("$"):S)}))}if(typeof a=="function"){var p=this;return t[Symbol.replace].call(this,n,function(){var i=arguments;return typeof i[i.length-1]!="object"&&(i=[].slice.call(i)).push(s(i,p)),a.apply(this,i)})}return t[Symbol.replace].call(this,n,a)},_.apply(this,arguments)}function Re(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&M(t,e)}function M(t,e){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},M(t,e)}var v=t=>{switch(!0){case/assert/gi.test(t.constructor.name):case/expectation/gi.test(t.constructor.name):case(t.name&&/assert/gi.test(t.name)):case(t.message&&/assert/gi.test(t.message)):case(t.stack&&/@vitest\/expect/gi.test(t.stack)):case(t.stack&&/playwright\/lib\/matchers\/expect\.js/gi.test(t.stack)):case"matcherResult"in t:case("inspect"in t&&typeof t.inspect=="function"):return c.FAILED;default:return c.BROKEN}},_e=function(){var{onlyFirst:e=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")},U=t=>{var e=_e();return t.replace(e,"")},h=t=>{var{message:e,stack:r}=t;return{message:e?U(e):void 0,trace:r?U(r):void 0}},gt=_(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),Me=new RegExp(gt,"g"),yt=_(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),ke=new RegExp(yt,"g");var G=t=>{var e=[];t.split(" ").forEach(s=>{var n,a=(n=s.match(gt))===null||n===void 0||(n=n.groups)===null||n===void 0?void 0:n.id;a&&e.push({name:l.ALLURE_ID,value:a});var o=s.match(yt),{name:p,value:i}=o?.groups||{};p&&i&&e?.push({name:p,value:i})});var r=t.replace(ke,"").replace(Me,"").trim();return{labels:e,cleanTitle:r}};var A=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",z=function(e){var{maxDepth:r=0,maxLength:s=0,replacer:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Oe(typeof e=="object"?JSON.stringify(e,we(r,n)):String(e),s)},we=(t,e)=>{var r=[],s=function(a,o){if(typeof o!="object"||o===null)return o;for(;r.length>0&&!Object.is(r.at(-1),this);)r.pop();if(!(t&&r.length>=t||r.includes(o)))return r.push(o),o instanceof Map?Fe(r,o):o instanceof Set?Le(r,o):o};return e?Ie(e,s):s},Ie=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},Fe=(t,e)=>Array.from(e).filter(r=>{var[s]=r;return!t.includes(s)}).map(r=>{var[s,n]=r;return[s,t.includes(n)?void 0:n]}),Le=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),Oe=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function ht(t,e,r,s,n,a,o){try{var p=t[a](o),i=p.value}catch(y){return void r(y)}p.done?e(i):Promise.resolve(i).then(s,n)}function f(t){return function(){var e=this,r=arguments;return new Promise(function(s,n){var a=t.apply(e,r);function o(i){ht(a,s,n,o,p,"next",i)}function p(i){ht(a,s,n,o,p,"throw",i)}o(void 0)})}}var B=class{attachment(){var e=this;return f(function*(){yield e.warning()})()}attachmentFromPath(){var e=this;return f(function*(){yield e.warning()})()}description(){var e=this;return f(function*(){yield e.warning()})()}descriptionHtml(){var e=this;return f(function*(){yield e.warning()})()}displayName(){var e=this;return f(function*(){yield e.warning()})()}historyId(){var e=this;return f(function*(){yield e.warning()})()}labels(){var e=this;return f(function*(){yield e.warning()})()}links(){var e=this;return f(function*(){yield e.warning()})()}parameter(){var e=this;return f(function*(){yield e.warning()})()}logStep(){var e=this;return f(function*(){yield e.warning()})()}step(e,r){var s=this;return f(function*(){return yield s.warning(),r()})()}stepDisplayName(){var e=this;return f(function*(){yield e.warning()})()}stepParameter(){var e=this;return f(function*(){yield e.warning()})()}testCaseId(){var e=this;return f(function*(){yield e.warning()})()}warning(){return f(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},T=new B;var St="allureTestRuntime",K=t=>{globalThis[St]=()=>t},W=()=>globalThis?.[St],V=()=>{var t=W();if(t){var e;return(e=t())!==null&&e!==void 0?e:T}return T},$=()=>{var t=W();if(t){var e;return(e=t())!==null&&e!==void 0?e:T}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=W())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:T})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),T}return T};var m=function(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var a=$();return A(a)?a.then(o=>o[e](...s)):a[e](...s)},g=(t,e)=>m("labels",{name:t,value:e}),He=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},Y=(t,e,r)=>m("links",{url:t,type:r,name:e}),je=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},Ne=(t,e,r)=>m("parameter",t,e,r),Ue=t=>m("description",t),Ge=t=>m("descriptionHtml",t),ze=t=>m("displayName",t),Be=t=>m("historyId",t),We=t=>m("testCaseId",t),Ke=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},Ve=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},$e=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),Ye=(t,e,r)=>m("logStep",t,e,r),qe=(t,e)=>m("step",t,()=>e($e())),Je=(t,e)=>Y(t,e,R.ISSUE),Ze=(t,e)=>Y(t,e,R.TMS),Xe=t=>g(l.ALLURE_ID,t),Qe=t=>g(l.EPIC,t),tr=t=>g(l.FEATURE,t),er=t=>g(l.STORY,t),rr=t=>g(l.SUITE,t),sr=t=>g(l.PARENT_SUITE,t),nr=t=>g(l.SUB_SUITE,t),or=t=>g(l.OWNER,t),ar=t=>g(l.SEVERITY,t),ir=t=>g(l.LAYER,t),pr=t=>g(l.TAG,t),ur=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r.map(n=>({name:l.TAG,value:n})))};var vt={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},xt=(t,e)=>{let r=t.findIndex(e);return r!==-1?q(t.splice(r)):[]},q=t=>{let e=t.length,r=new Array(e);for(let s=0;s<e;s++)r[e-s-1]=t[s];return r},Tt=t=>t[t.length-1],Ct=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:vt,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},Et=()=>d().initialized,At=()=>{d().initialized=!0},J=()=>d().messages,bt=t=>{d().messages=t},u=t=>{J().push(t)},Dt=()=>d().testPlan,Pt=()=>d().projectDir,Rt=()=>d().currentTest,_t=t=>{d().currentTest=t},Mt=()=>{d().currentTest=void 0},kt=()=>d().config,x=()=>d().stepStack,wt=()=>Tt(x()),k=t=>x().push(t);var lr=t=>q(x().splice(t)),It=()=>lr(0);var w=(t,e)=>d().stepsToFinalize.push([t,e]),Ft=()=>d().stepsToFinalize,Lt=()=>{let t=d();t.stepsToFinalize=[]};var Ot=(t,e)=>{let r=Dt();if(r){let s=Ht(t);for(let n of mr(e)){let a=dr(r,t,s,n.tests);fr(n.tests,a)}}},mr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},dr=(t,e,r,s)=>{let n=[];return s.forEach((a,o)=>{let{fullNameSuffix:p,labels:i}=Z(e,a),y=`${r}#${p}`,S=i.find(({name:Ae})=>Ae===l.ALLURE_ID)?.value;gr(t,y,S)||n.push(o)}),n},fr=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},gr=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var I="__allure_report_system_hook__",jt=()=>{Cypress.mocha.getRunner().on("start",yr).on("suite",hr).on("suite end",Wt).on("hook",Sr).on("hook end",vr).on("test",xr).on("pass",Kt).on("fail",Tr).on("pending",Vt).on("test end",rt)},Nt=()=>{afterEach(I,st),after(I,Cr)},yr=()=>{Gt(),zt()},hr=t=>{t.root&&Ot(Cypress.spec,t),Bt(t)},Sr=t=>{C(t)||X(t)},vr=t=>{C(t)||F(t)},xr=t=>{b(t)||Q(t)},Tr=(t,e)=>{let r="hookName"in t;if(r&&Ut(t))return;r&&C(t)&&X(t,Date.now()-(t.duration??0)),tt(e),r&&et(t,e)},Cr=function(){st(),E(this)};var $t=Cypress.platform==="win32",Yt=t=>t.substring(t.lastIndexOf($t?"\\":"/")+1),Ht=t=>{let e=Pt(),r=e?t.absolute.substring(e.length+1):t.relative;return $t?r.replaceAll("\\","/"):r},qt=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,nt=t=>({...Z(Cypress.spec,t),start:t.wallClockStartedAt?.getTime()||Date.now()}),Jt=t=>({duration:t.duration??0,retries:t._retries??0}),ot=()=>({statusDetails:{message:"This is a pending test"}}),Zt=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??ne(t)};return r&&(s.statusDetails=r),s},Xt=Symbol("The test has been reported to Allure"),at=t=>{t[Xt]=!0},b=t=>t[Xt]===!0,Er=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},Qt=function*(t){for(let e of Er(t))yield*e.tests},te=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var ee=()=>(d().nextApiStepId++).toString(),Z=(t,e)=>{let r=e.title,{cleanTitle:s,labels:n}=G(r),o=`${[...e.titlePath().slice(0,-1),s].join(" ")}`;return{name:s,labels:n,fullNameSuffix:o}},C=t=>t.title.includes(I),Ut=t=>t.parent.root&&t.hookName==="after all",re=t=>{let e=t.test;return t.test.parent.hooks.findLast(a=>a.hookName==="after all")?.hookId===e.hookId},se=(t,e,r,s)=>{let n=e?c.SKIPPED:v(r),{message:a,trace:o}=h(r);return{status:n,statusDetails:{message:e?Ar(t,s):a,trace:o}}},Ar=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`};var D={},oe=t=>t.type==="api",P=t=>t.type==="log",it=t=>H(br(),t),br=()=>{let t=ee();return k({id:t,type:"api"}),t},ae=t=>{let e=v(t),r=h(t);Pr(e,r),pe(t)},pt=(t,e)=>L(r=>oe(r),t,e),L=(t,e,r)=>ie(xt(x(),t),e,r),O=(t,e)=>ie(It(),t,e),ut=()=>{O(),Ft().forEach(Dr),Lt()},ne=t=>t.error?v(t.error):c.PASSED,Dr=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=h(s)),e?.(n),u({type:"cypress_step_finalize",data:n})},Pr=(t,e)=>{let r=x(),s=r.at(r.findLastIndex(P)+1);s&&L(n=>Object.is(n,s),t,e)},Rr=(t,e)=>{if(P(t)){let r=t.log.attributes.error;if(r)return t.error=r}return e&&(t.error=e),t.error},ie=(t,e,r)=>{let s;for(let n of t)s=Rr(n,s),_r(n,e,r);s&&pe(s)},pe=t=>x().forEach(e=>e.error=t),_r=(t,e,r)=>{ue(t,e,r),oe(t)&&t.error&&w(t)};var Gt=()=>K(new ct),lt=()=>V(),ct=class{constructor(){this.#e()}labels(...e){return this.#t({type:"metadata",data:{labels:e}})}links(...e){return this.#t({type:"metadata",data:{links:e}})}parameter(e,r,s){return this.#t({type:"metadata",data:{parameters:[{name:e,value:r,...s}]}})}description(e){return this.#t({type:"metadata",data:{description:e}})}descriptionHtml(e){return this.#t({type:"metadata",data:{descriptionHtml:e}})}displayName(e){return this.#t({type:"metadata",data:{displayName:e}})}historyId(e){return this.#t({type:"metadata",data:{historyId:e}})}testCaseId(e){return this.#t({type:"metadata",data:{testCaseId:e}})}attachment(e,r,s){let n=r?.type==="Buffer"?r.data:r,a=typeof n=="string"?"utf8":"base64",o=qt(n);return this.#t({type:"attachment_content",data:{name:e,content:o,encoding:a,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(e,r,s){return this.#t({type:"attachment_path",data:{name:e,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}logStep(e,r=c.PASSED,s){return cy.wrap(D,{log:!1}).then(()=>(it(e),Cypress.Promise.resolve())).then(()=>(pt(r,s?h(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(D,{log:!1}).then(()=>(it(e),Cypress.Promise.resolve(r()))).then(s=>(pt(),s))}stepDisplayName(e){return this.#t({type:"step_metadata",data:{name:e}})}stepParameter(e,r,s){return this.#t({type:"step_metadata",data:{parameters:[{name:e,value:r,mode:s}]}})}flushAllureMessagesToTask(e){let r=this.#r();r.length&&cy.task(e,{absolutePath:Cypress.spec.absolute,messages:r},{log:!1})}flushAllureMessagesToTaskAsync(e){let r=this.#r();if(r.length){let s={absolutePath:Cypress.spec.absolute,messages:r,isInteractive:Cypress.config("isInteractive")};return cy.task(e,s,{log:!1})}}#e(){bt([])}#t(e){return u(e),Cypress.Promise.resolve()}#r(){let e=J();return this.#e(),e}};var zt=()=>{u({type:"cypress_run_start",data:{}})},Bt=t=>{u({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},Wt=t=>{u({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},X=(t,e)=>{u({type:"cypress_hook_start",data:{name:t.title,scopeType:t.hookName.includes("each")?"each":"all",position:t.hookName.includes("before")?"before":"after",start:e??Date.now()}})},F=t=>{ut(),u({type:"cypress_hook_end",data:{duration:t.duration??0}})},Q=t=>{_t(t),u({type:"cypress_test_start",data:nt(t)}),at(t)},H=(t,e)=>{u({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},ue=(t,e,r)=>{u({type:"cypress_step_stop",data:Zt(t,e,r)})},Kt=()=>{u({type:"cypress_test_pass",data:{}})},tt=t=>{let e=v(t),r=h(t);O(e,r),u({type:"cypress_fail",data:{status:e,statusDetails:r}})},et=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=se(t.title,r,e,s);F(t),Mr(),kr(s,n)},Vt=t=>{b(t)?O(c.SKIPPED,{message:"The test was skipped before the command was completed"}):Q(t),u({type:"cypress_test_skip",data:ot()})},rt=t=>{ut(),u({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),Mt()},ce=(t,e)=>{u({type:"attachment_path",data:{path:t,name:e,contentType:N.PNG}})},E=t=>{if(re(t)){let e=t.test;return C(e)||F(e),le()}},mt=(t,e)=>{try{return tt(e),et(t.test,e),le()}catch(r){Ir(t,r)}},dt=(t,e)=>{if(!mt(t,e)?.then(()=>{throw e}))throw e},st=()=>lt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),le=()=>lt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),Mr=()=>{let t=Rt();t&&rt(t)},kr=(t,e)=>{for(let r of Qt(t))b(r)||wr(r,r.pending?{...ot(),status:c.SKIPPED}:e)},wr=(t,e)=>{u({type:"cypress_skipped_test",data:{...nt(t),...e,...Jt(t),suites:te(t).map(r=>r.id)}}),at(t)},Ir=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var de=()=>{let t=Fr();Lr(t),Or(t)},Fr=()=>{let t=0;return{getSuiteDepth:()=>t,incrementSuiteDepth:()=>{t++},decrementSuiteDepth:()=>{t--}}},Lr=({incrementSuiteDepth:t,decrementSuiteDepth:e})=>{let r=a=>(o,p,i)=>{t();try{return Hr(a,o,p,i)}finally{e()}},s=globalThis.describe,n=r(s);n.only=r(s.only),n.skip=r(s.skip),globalThis.describe=n},Or=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,me(t,n)):e(me(t,s));globalThis.after=r},Hr=(t,...e)=>{let[r,s,n]=e;return typeof n>"u"&&typeof s>"u"?t(r):typeof s=="function"?t(r,s):t(r,s,n)},me=(t,e)=>{if(t()===0&&e){let r=e.length?jr(e):Nr(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},jr=t=>function(e){let r=s=>{if(s){mt(this,s)?.then(()=>e(s))||e(s);return}try{if(E(this)?.then(()=>e()))return}catch(n){e(n);return}e()};return t.bind(this)(r)},Nr=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)dt(this,r);else return A(e)?e.then(()=>E(this),s=>dt(this,s)):(E(this),e)};var fe=t=>Gr(t)?ge(t):z(t,Ur()),Ur=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=kt();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:zr}},Gr=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),ge=t=>Cypress.dom.stringify(t,"long"),zr=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return ge(e)}return e};var ye=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||Kr(t))},he=(t,e)=>{let r=wt();if(r&&P(r)){let{name:s,props:{name:n}}=r.log.attributes.consoleProps();s==="screenshot"&&n===t&&(r.attachmentName=e)}},Se=t=>{let e=Xr();typeof e<"u"&&Qr(e.log,t)&&j(e.log.attributes.id),Br(t),H(t.attributes.id,Vr(t)),Wr(t)},j=t=>L(({id:e})=>e===t),Br=t=>{let r={id:t.attributes.id,type:"log",log:t};k(r),w(r,s=>{s.parameters=$r(t),r.attachmentName&&(s.name=r.attachmentName)})},Wr=t=>{let{groupStart:e,end:r,id:s}=t.attributes;if(r)j(s);else if(e){let n=t.endGroup;t.endGroup=function(){return j(s),n.call(this)}}else{let n=t.end;t.end=function(){return j(s),n.call(this)}}},Kr=({attributes:{name:t,consoleProps:e}})=>t==="then"&&Object.is(e().props["Applied To"],D),Vr=t=>{let{name:e,message:r,displayName:s}=t.attributes,n=(s??e).trim(),a=(ve(t)??qr(t)??t.attributes.renderProps().message??r).trim();return[n,a].filter(Boolean).join(" ")},$r=t=>Jr(t).map(([e,r])=>({name:e.toString(),value:fe(r)})).filter(ts(t)),Yr=["Given","When","Then","And"],qr=t=>{let{attributes:{name:e,message:r}}=t;if(Yr.includes(e.trim())&&r.startsWith("**")&&r.endsWith("**"))return r.substring(2,r.length-2)},Jr=t=>{let{attributes:{consoleProps:e}}=t,r=!!ve(t);return Object.entries(e().props).filter(([s,n])=>Ct(n)&&!(r&&s==="Message"))},ve=t=>{if(Zr(t)){let e=t.attributes.consoleProps().props.Message;if(e&&typeof e=="string")return e}},Zr=({attributes:{name:t}})=>t==="assert",Xr=()=>x().findLast(P),Qr=(t,e)=>{let{groupStart:r,type:s}=t.attributes,{type:n}=e.attributes;return!r&&(s==="child"||n!=="child")},ts=t=>t.attributes.name==="wrap"?()=>!0:({name:e,value:r})=>e!=="Yielded"||r!=="{}";var xe=()=>Cypress.on("fail",Te).on("log:added",rs),ft=()=>Cypress.Screenshot.defaults({onAfterScreenshot:es}),es=(...[,{name:t,path:e}])=>{let r=t??Yt(e);ce(e,r),he(t,r)},rs=(t,e)=>{ye(e)&&Se(e)},Te=t=>{if(ae(t),ss())throw t},ss=()=>Object.is(Cypress.listeners("fail").at(-1),Te);var Ce=()=>{jt(),xe(),Nt(),de()};var Ee=()=>{Et()||(At(),Ce(),ft())};Ee();export{N as ContentType,l as LabelName,R as LinkType,Pe as Severity,De as Stage,c as Status,be as StatusByPriority,Xe as allureId,Ke as attachment,Ve as attachmentPath,Ue as description,Ge as descriptionHtml,ze as displayName,Qe as epic,tr as feature,Be as historyId,Je as issue,g as label,He as labels,ir as layer,Y as link,je as links,Ye as logStep,or as owner,Ne as parameter,sr as parentSuite,ar as severity,qe as step,er as story,nr as subSuite,rr as suite,pr as tag,ur as tags,We as testCaseId,Ze as tms};
1
+ var c=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),Pe=[c.FAILED,c.BROKEN,c.PASSED,c.SKIPPED],Re=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),l=function(t){return t.ALLURE_ID="ALLURE_ID",t.AS_ID="ALLURE_ID",t.SUITE="suite",t.PARENT_SUITE="parentSuite",t.SUB_SUITE="subSuite",t.EPIC="epic",t.FEATURE="feature",t.STORY="story",t.SEVERITY="severity",t.TAG="tag",t.OWNER="owner",t.LEAD="lead",t.HOST="host",t.THREAD="thread",t.TEST_METHOD="testMethod",t.TEST_CLASS="testClass",t.PACKAGE="package",t.FRAMEWORK="framework",t.LANGUAGE="language",t.LAYER="layer",t}({}),_e=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),G=function(t){return t.TEXT="text/plain",t.XML="application/xml",t.HTML="text/html",t.CSV="text/csv",t.TSV="text/tab-separated-values",t.CSS="text/css",t.URI="text/uri-list",t.SVG="image/svg+xml",t.PNG="image/png",t.JSON="application/json",t.ZIP="application/zip",t.WEBM="video/webm",t.JPEG="image/jpeg",t.MP4="video/mp4",t.IMAGEDIFF="application/vnd.allure.image.diff",t}({}),M=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function z(){z=function(o,a){return new r(o,void 0,a)};var t=RegExp.prototype,e=new WeakMap;function r(n,o,a){var p=RegExp(n,o);return e.set(p,a||e.get(n)),k(p,r.prototype)}function s(n,o){var a=e.get(o);return Object.keys(a).reduce(function(p,i){var g=a[i];if(typeof g=="number")p[i]=n[g];else{for(var y=0;n[g[y]]===void 0&&y+1<g.length;)y++;p[i]=n[g[y]]}return p},Object.create(null))}return Me(r,RegExp),r.prototype.exec=function(n){var o=t.exec.call(this,n);if(o){o.groups=s(o,this);var a=o.indices;a&&(a.groups=s(a,this))}return o},r.prototype[Symbol.replace]=function(n,o){if(typeof o=="string"){var a=e.get(this);return t[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)>/g,function(i,g){var y=a[g];return"$"+(Array.isArray(y)?y.join("$"):y)}))}if(typeof o=="function"){var p=this;return t[Symbol.replace].call(this,n,function(){var i=arguments;return typeof i[i.length-1]!="object"&&(i=[].slice.call(i)).push(s(i,p)),o.apply(this,i)})}return t[Symbol.replace].call(this,n,o)},z.apply(this,arguments)}function Me(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},k(t,e)}function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function B(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?St(Object(r),!0).forEach(function(s){ke(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function ke(t,e,r){return(e=we(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){var e=Fe(t,"string");return typeof e=="symbol"?e:e+""}function Fe(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var v=t=>{switch(!0){case/assert/gi.test(t.constructor.name):case/expectation/gi.test(t.constructor.name):case(t.name&&/assert/gi.test(t.name)):case(t.message&&/assert/gi.test(t.message)):case(t.stack&&/@vitest\/expect/gi.test(t.stack)):case(t.stack&&/playwright\/lib\/matchers\/expect\.js/gi.test(t.stack)):case"matcherResult"in t:case("inspect"in t&&typeof t.inspect=="function"):return c.FAILED;default:return c.BROKEN}},Ie=function(){var{onlyFirst:e=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")},K=t=>{var e=Ie();return t.replace(e,"")},Le=t=>{if(!t||typeof t!="object")return{};if("matcherResult"in t&&t.matcherResult!==void 0&&typeof t.matcherResult=="object")return{actual:T(t.matcherResult.actual),expected:T(t.matcherResult.expected)};var e="actual"in t&&t.actual!==void 0?{actual:T(t.actual)}:{},r="expected"in t&&t.expected!==void 0?{expected:T(t.expected)}:{};return B(B({},e),r)},S=t=>{var{message:e,stack:r}=t;return B({message:e?K(e):void 0,trace:r?K(r):void 0},Le(t))};var Oe=z(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/,{type:1}),vt=new RegExp(Oe,"g");var je=t=>t?.[1],He=t=>{var e,r=/['"`]/,s=new RegExp("^".concat(r.source)),n=new RegExp("".concat(r.source,"$")),o=(e=t?.[2])!==null&&e!==void 0?e:"";return s.test(o)&&n.test(o)?o.slice(1,-1):o};var W=t=>{var e=[],r=[],s=t.matchAll(vt),n=t.replaceAll(vt,"").split(" ").filter(Boolean).reduce((_,U)=>/^[\n\r]/.test(U)?_+U:"".concat(_," ").concat(U),"").trim();for(var o of s){var a=o,p=je(a),i=He(a);if(!(!p||!i)){var[g,y]=p.split(".");switch(g){case"id":e.push({name:l.ALLURE_ID,value:i});break;case"label":e.push({name:y,value:i});break;case"link":r.push({type:y,url:i});break}}}return{labels:e,links:r,cleanTitle:n}};var C=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",T=function(e){var{maxDepth:r=0,maxLength:s=0,replacer:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(typeof e=="object"?JSON.stringify(e,Ne(r,n)):String(e),s)},Ne=(t,e)=>{var r=[],s=function(o,a){if(typeof a!="object"||a===null)return a;for(;r.length>0&&!Object.is(r.at(-1),this);)r.pop();if(!(t&&r.length>=t||r.includes(a)))return r.push(a),a instanceof Map?Ge(r,a):a instanceof Set?ze(r,a):a};return e?Ue(e,s):s},Ue=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},Ge=(t,e)=>Array.from(e).filter(r=>{var[s]=r;return!t.includes(s)}).map(r=>{var[s,n]=r;return[s,t.includes(n)?void 0:n]}),ze=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),Be=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function xt(t,e,r,s,n,o,a){try{var p=t[o](a),i=p.value}catch(g){return void r(g)}p.done?e(i):Promise.resolve(i).then(s,n)}function f(t){return function(){var e=this,r=arguments;return new Promise(function(s,n){var o=t.apply(e,r);function a(i){xt(o,s,n,a,p,"next",i)}function p(i){xt(o,s,n,a,p,"throw",i)}a(void 0)})}}var $=class{attachment(){var e=this;return f(function*(){yield e.warning()})()}attachmentFromPath(){var e=this;return f(function*(){yield e.warning()})()}description(){var e=this;return f(function*(){yield e.warning()})()}descriptionHtml(){var e=this;return f(function*(){yield e.warning()})()}displayName(){var e=this;return f(function*(){yield e.warning()})()}historyId(){var e=this;return f(function*(){yield e.warning()})()}labels(){var e=this;return f(function*(){yield e.warning()})()}links(){var e=this;return f(function*(){yield e.warning()})()}parameter(){var e=this;return f(function*(){yield e.warning()})()}logStep(){var e=this;return f(function*(){yield e.warning()})()}step(e,r){var s=this;return f(function*(){return yield s.warning(),r()})()}stepDisplayName(){var e=this;return f(function*(){yield e.warning()})()}stepParameter(){var e=this;return f(function*(){yield e.warning()})()}testCaseId(){var e=this;return f(function*(){yield e.warning()})()}warning(){return f(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},A=new $;var Tt="allureTestRuntime",q=t=>{globalThis[Tt]=()=>t},V=()=>globalThis?.[Tt],Y=()=>{var t=V();if(t){var e;return(e=t())!==null&&e!==void 0?e:A}return A},J=()=>{var t=V();if(t){var e;return(e=t())!==null&&e!==void 0?e:A}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=V())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:A})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),A}return A};var m=function(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var o=J();return C(o)?o.then(a=>a[e](...s)):o[e](...s)},h=(t,e)=>m("labels",{name:t,value:e}),Ke=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},Z=(t,e,r)=>m("links",{url:t,type:r,name:e}),We=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},$e=(t,e,r)=>m("parameter",t,e,r),Ve=t=>m("description",t),qe=t=>m("descriptionHtml",t),Ye=t=>m("displayName",t),Je=t=>m("historyId",t),Ze=t=>m("testCaseId",t),Xe=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},Qe=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},tr=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),er=(t,e,r)=>m("logStep",t,e,r),rr=(t,e)=>m("step",t,()=>e(tr())),sr=(t,e)=>Z(t,e,M.ISSUE),nr=(t,e)=>Z(t,e,M.TMS),or=t=>h(l.ALLURE_ID,t),ar=t=>h(l.EPIC,t),ir=t=>h(l.FEATURE,t),pr=t=>h(l.STORY,t),ur=t=>h(l.SUITE,t),cr=t=>h(l.PARENT_SUITE,t),lr=t=>h(l.SUB_SUITE,t),mr=t=>h(l.OWNER,t),dr=t=>h(l.SEVERITY,t),fr=t=>h(l.LAYER,t),gr=t=>h(l.TAG,t),yr=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r.map(n=>({name:l.TAG,value:n})))};var At={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},Et=(t,e)=>{let r=t.findIndex(e);return r!==-1?X(t.splice(r)):[]},X=t=>{let e=t.length,r=new Array(e);for(let s=0;s<e;s++)r[e-s-1]=t[s];return r},bt=t=>t[t.length-1],Ct=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:At,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},Dt=()=>d().initialized,Pt=()=>{d().initialized=!0},Q=()=>d().messages,Rt=t=>{d().messages=t},u=t=>{Q().push(t)},_t=()=>d().testPlan,Mt=()=>d().projectDir,kt=()=>d().currentTest,wt=t=>{d().currentTest=t},Ft=()=>{d().currentTest=void 0},It=()=>d().config,x=()=>d().stepStack,Lt=()=>bt(x()),w=t=>x().push(t);var Sr=t=>X(x().splice(t)),Ot=()=>Sr(0);var F=(t,e)=>d().stepsToFinalize.push([t,e]),jt=()=>d().stepsToFinalize,Ht=()=>{let t=d();t.stepsToFinalize=[]};var Nt=(t,e)=>{let r=_t();if(r){let s=Ut(t);for(let n of vr(e)){let o=xr(r,t,s,n.tests);Tr(n.tests,o)}}},vr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},xr=(t,e,r,s)=>{let n=[];return s.forEach((o,a)=>{let{fullNameSuffix:p,labels:i}=tt(o),g=`${r}#${p}`,y=i.find(({name:_})=>_===l.ALLURE_ID)?.value;Ar(t,g,y)||n.push(a)}),n},Tr=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},Ar=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var I="__allure_report_system_hook__",Gt=()=>{Cypress.mocha.getRunner().on("start",Er).on("suite",br).on("suite end",Vt).on("hook",Cr).on("hook end",Dr).on("test",Pr).on("pass",qt).on("fail",Rr).on("pending",Yt).on("test end",ot)},zt=()=>{afterEach(I,at),after(I,_r)},Er=()=>{Kt(),Wt()},br=t=>{t.root&&Nt(Cypress.spec,t),$t(t)},Cr=t=>{E(t)||et(t)},Dr=t=>{E(t)||L(t)},Pr=t=>{D(t)||rt(t)},Rr=(t,e)=>{let r="hookName"in t;if(r&&Bt(t))return;r&&E(t)&&et(t,Date.now()-(t.duration??0)),st(e),r&&nt(t,e)},_r=function(){at(),b(this)};var Jt=Cypress.platform==="win32",Zt=t=>t.substring(t.lastIndexOf(Jt?"\\":"/")+1),Ut=t=>{let e=Mt(),r=e?t.absolute.substring(e.length+1):t.relative;return Jt?r.replaceAll("\\","/"):r},Xt=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,it=t=>({...tt(t),start:typeof t.wallClockStartedAt=="string"?Date.parse(t.wallClockStartedAt):t.wallClockStartedAt?.getTime?.()||Date.now()}),Qt=t=>({duration:t.duration??0,retries:t._retries??0}),pt=()=>({statusDetails:{message:"This is a pending test"}}),te=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??ie(t)};return r&&(s.statusDetails=r),s},ee=Symbol("The test has been reported to Allure"),ut=t=>{t[ee]=!0},D=t=>t[ee]===!0,Mr=function*(t){let e=[];for(let r=t;r;r=e.pop()){yield r;for(let s=r.suites.length-1;s>=0;s--)e.push(r.suites[s])}},re=function*(t){for(let e of Mr(t))yield*e.tests},se=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var ne=()=>(d().nextApiStepId++).toString(),tt=t=>{let e=t.title,{cleanTitle:r,labels:s,links:n}=W(e),a=`${[...t.titlePath().slice(0,-1),r].join(" ")}`;return{name:r,labels:s,links:n,fullNameSuffix:a}},E=t=>t.title.includes(I),Bt=t=>t.parent.root&&t.hookName==="after all",oe=t=>{let e=t.test;return t.test.parent.hooks.findLast(o=>o.hookName==="after all")?.hookId===e.hookId},ae=(t,e,r,s)=>{let n=e?c.SKIPPED:v(r),{message:o,trace:a}=S(r);return{status:n,statusDetails:{message:e?kr(t,s):o,trace:a}}},kr=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`};var P={},pe=t=>t.type==="api",R=t=>t.type==="log",ct=t=>H(wr(),t),wr=()=>{let t=ne();return w({id:t,type:"api"}),t},ue=t=>{let e=v(t),r=S(t);Ir(e,r),le(t)},lt=(t,e)=>O(r=>pe(r),t,e),O=(t,e,r)=>ce(Et(x(),t),e,r),j=(t,e)=>ce(Ot(),t,e),mt=()=>{j(),jt().forEach(Fr),Ht()},ie=t=>t.error?v(t.error):c.PASSED,Fr=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=S(s)),e?.(n),u({type:"cypress_step_finalize",data:n})},Ir=(t,e)=>{let r=x(),s=r.at(r.findLastIndex(R)+1);s&&O(n=>Object.is(n,s),t,e)},Lr=(t,e)=>{if(R(t)){let r=t.log.attributes.error;if(r)return t.error=r}return e&&(t.error=e),t.error},ce=(t,e,r)=>{let s;for(let n of t)s=Lr(n,s),Or(n,e,r);s&&le(s)},le=t=>x().forEach(e=>e.error=t),Or=(t,e,r)=>{me(t,e,r),pe(t)&&t.error&&F(t)};var Kt=()=>q(new dt),ft=()=>Y(),dt=class{constructor(){this.#e()}labels(...e){return this.#t({type:"metadata",data:{labels:e}})}links(...e){return this.#t({type:"metadata",data:{links:e}})}parameter(e,r,s){return this.#t({type:"metadata",data:{parameters:[{name:e,value:r,...s}]}})}description(e){return this.#t({type:"metadata",data:{description:e}})}descriptionHtml(e){return this.#t({type:"metadata",data:{descriptionHtml:e}})}displayName(e){return this.#t({type:"metadata",data:{displayName:e}})}historyId(e){return this.#t({type:"metadata",data:{historyId:e}})}testCaseId(e){return this.#t({type:"metadata",data:{testCaseId:e}})}attachment(e,r,s){let n=r?.type==="Buffer"?r.data:r,o=typeof n=="string"?"utf8":"base64",a=Xt(n);return this.#t({type:"attachment_content",data:{name:e,content:a,encoding:o,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(e,r,s){return this.#t({type:"attachment_path",data:{name:e,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}logStep(e,r=c.PASSED,s){return cy.wrap(P,{log:!1}).then(()=>(ct(e),Cypress.Promise.resolve())).then(()=>(lt(r,s?S(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(P,{log:!1}).then(()=>(ct(e),Cypress.Promise.resolve(r()))).then(s=>(lt(),s))}stepDisplayName(e){return this.#t({type:"step_metadata",data:{name:e}})}stepParameter(e,r,s){return this.#t({type:"step_metadata",data:{parameters:[{name:e,value:r,mode:s}]}})}flushAllureMessagesToTask(e){let r=this.#r();r.length&&cy.task(e,{absolutePath:Cypress.spec.absolute,messages:r},{log:!1})}flushAllureMessagesToTaskAsync(e){let r=this.#r();if(r.length){let s={absolutePath:Cypress.spec.absolute,messages:r,isInteractive:Cypress.config("isInteractive")};return cy.task(e,s,{log:!1})}}#e(){Rt([])}#t(e){return u(e),Cypress.Promise.resolve()}#r(){let e=Q();return this.#e(),e}};var Wt=()=>{u({type:"cypress_run_start",data:{}})},$t=t=>{u({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},Vt=t=>{u({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},et=(t,e)=>{u({type:"cypress_hook_start",data:{name:t.title,scopeType:t.hookName.includes("each")?"each":"all",position:t.hookName.includes("before")?"before":"after",start:e??Date.now()}})},L=t=>{mt(),u({type:"cypress_hook_end",data:{duration:t.duration??0}})},rt=t=>{wt(t),u({type:"cypress_test_start",data:it(t)}),ut(t)},H=(t,e)=>{u({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},me=(t,e,r)=>{u({type:"cypress_step_stop",data:te(t,e,r)})},qt=()=>{u({type:"cypress_test_pass",data:{}})},st=t=>{let e=v(t),r=S(t);j(e,r),u({type:"cypress_fail",data:{status:e,statusDetails:r}})},nt=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=ae(t.title,r,e,s);L(t),jr(),Hr(s,n)},Yt=t=>{D(t)?j(c.SKIPPED,{message:"The test was skipped before the command was completed"}):rt(t),u({type:"cypress_test_skip",data:pt()})},ot=t=>{mt(),u({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),Ft()},de=(t,e)=>{u({type:"attachment_path",data:{path:t,name:e,contentType:G.PNG}})},b=t=>{if(oe(t)){let e=t.test;return E(e)||L(e),fe()}},gt=(t,e)=>{try{return st(e),nt(t.test,e),fe()}catch(r){Ur(t,r)}},yt=(t,e)=>{if(!gt(t,e)?.then(()=>{throw e}))throw e},at=()=>ft().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),fe=()=>ft().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),jr=()=>{let t=kt();t&&ot(t)},Hr=(t,e)=>{for(let r of re(t))D(r)||Nr(r,r.pending?{...pt(),status:c.SKIPPED}:e)},Nr=(t,e)=>{u({type:"cypress_skipped_test",data:{...it(t),...e,...Qt(t),suites:se(t).map(r=>r.id)}}),ut(t)},Ur=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var ye=()=>{let t=Gr();zr(t),Br(t)},Gr=()=>{let t=0;return{getSuiteDepth:()=>t,incrementSuiteDepth:()=>{t++},decrementSuiteDepth:()=>{t--}}},zr=({incrementSuiteDepth:t,decrementSuiteDepth:e})=>{let r=o=>(a,p,i)=>{t();try{return Kr(o,a,p,i)}finally{e()}},s=globalThis.describe,n=r(s);n.only=r(s.only),n.skip=r(s.skip),globalThis.describe=n},Br=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,ge(t,n)):e(ge(t,s));globalThis.after=r},Kr=(t,...e)=>{let[r,s,n]=e;return typeof n>"u"&&typeof s>"u"?t(r):typeof s=="function"?t(r,s):t(r,s,n)},ge=(t,e)=>{if(t()===0&&e){let r=e.length?Wr(e):$r(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},Wr=t=>function(e){let r=s=>{if(s){gt(this,s)?.then(()=>e(s))||e(s);return}try{if(b(this)?.then(()=>e()))return}catch(n){e(n);return}e()};return t.bind(this)(r)},$r=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)yt(this,r);else return C(e)?e.then(()=>b(this),s=>yt(this,s)):(b(this),e)};var he=t=>qr(t)?Se(t):T(t,Vr()),Vr=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=It();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:Yr}},qr=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),Se=t=>Cypress.dom.stringify(t,"long"),Yr=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return Se(e)}return e};var ve=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||Xr(t))},xe=(t,e)=>{let r=Lt();if(r&&R(r)){let{name:s,props:{name:n}}=r.log.attributes.consoleProps();s==="screenshot"&&n===t&&(r.attachmentName=e)}},Te=t=>{let e=os();typeof e<"u"&&as(e.log,t)&&N(e.log.attributes.id),Jr(t),H(t.attributes.id,Qr(t)),Zr(t)},N=t=>O(({id:e})=>e===t),Jr=t=>{let r={id:t.attributes.id,type:"log",log:t};w(r),F(r,s=>{s.parameters=ts(t),r.attachmentName&&(s.name=r.attachmentName)})},Zr=t=>{let{groupStart:e,end:r,id:s}=t.attributes;if(r)N(s);else if(e){let n=t.endGroup;t.endGroup=function(){return N(s),n.call(this)}}else{let n=t.end;t.end=function(){return N(s),n.call(this)}}},Xr=({attributes:{name:t,consoleProps:e}})=>t==="then"&&Object.is(e().props["Applied To"],P),Qr=t=>{let{name:e,message:r,displayName:s}=t.attributes,n=(s??e).trim(),o=(Ae(t)??rs(t)??t.attributes.renderProps().message??r).trim();return[n,o].filter(Boolean).join(" ")},ts=t=>ss(t).map(([e,r])=>({name:e.toString(),value:he(r)})).filter(is(t)),es=["Given","When","Then","And"],rs=t=>{let{attributes:{name:e,message:r}}=t;if(es.includes(e.trim())&&r.startsWith("**")&&r.endsWith("**"))return r.substring(2,r.length-2)},ss=t=>{let{attributes:{consoleProps:e}}=t,r=!!Ae(t),{props:s,name:n}=e();return["clearLocalStorage"].includes(n)?[]:Object.entries(s).filter(([o,a])=>Ct(a)&&!(r&&o==="Message"))},Ae=t=>{if(ns(t)){let e=t.attributes.consoleProps().props.Message;if(e&&typeof e=="string")return e}},ns=({attributes:{name:t}})=>t==="assert",os=()=>x().findLast(R),as=(t,e)=>{let{groupStart:r,type:s}=t.attributes,{type:n}=e.attributes;return!r&&(s==="child"||n!=="child")},is=t=>t.attributes.name==="wrap"?()=>!0:({name:e,value:r})=>e!=="Yielded"||r!=="{}";var Ee=()=>Cypress.on("fail",be).on("log:added",us),ht=()=>Cypress.Screenshot.defaults({onAfterScreenshot:ps}),ps=(...[,{name:t,path:e}])=>{let r=t??Zt(e);de(e,r),xe(t,r)},us=(t,e)=>{ve(e)&&Te(e)},be=t=>{if(ue(t),cs())throw t},cs=()=>Object.is(Cypress.listeners("fail").at(-1),be);var Ce=()=>{Gt(),Ee(),zt(),ye()};var De=()=>{Dt()||(Pt(),Ce(),ht())};De();export{G as ContentType,l as LabelName,M as LinkType,_e as Severity,Re as Stage,c as Status,Pe as StatusByPriority,or as allureId,Xe as attachment,Qe as attachmentPath,Ve as description,qe as descriptionHtml,Ye as displayName,ar as epic,ir as feature,Je as historyId,sr as issue,h as label,Ke as labels,fr as layer,Z as link,We as links,er as logStep,mr as owner,$e as parameter,cr as parentSuite,dr as severity,rr as step,pr as story,lr as subSuite,ur as suite,gr as tag,yr as tags,Ze as testCaseId,nr as tms};
2
2
  //# sourceMappingURL=index.js.map