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.
@@ -170,11 +170,24 @@ var getLogProps = entry => {
170
170
  }
171
171
  } = entry;
172
172
  var isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);
173
+ var {
174
+ props,
175
+ name
176
+ } = consoleProps();
177
+
178
+ // accessing LocalStorage after the page reload can stick the test runner
179
+ // to avoid the issue, we just need to log the command manually
180
+ // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`
181
+ // but probably, we don't need to silent them all at this moment
182
+ // the context: https://github.com/allure-framework/allure-js/issues/1222
183
+ if (["clearLocalStorage"].includes(name)) {
184
+ return [];
185
+ }
173
186
 
174
187
  // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,
175
188
  // directly into the step's name.
176
189
  // No need to keep the exact same information in the step's parameters.
177
- return Object.entries(consoleProps().props).filter(_ref6 => {
190
+ return Object.entries(props).filter(_ref6 => {
178
191
  var [k, v] = _ref6;
179
192
  return (0, _utils.isDefined)(v) && !(isAssertionWithMessage && k === "Message");
180
193
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","e","__esModule","default","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","name","step","getCurrentStep","isLogStep","commandName","props","nameFromProps","log","consoleProps","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","_ref2","Object","is","ALLURE_STEP_CMD_SUBJECT","_ref3","_ref4","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","renderProps","stepName","filter","Boolean","join","getLogProps","map","_ref5","k","v","toString","value","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref6","isDefined","isAssertLog","Message","_ref7","getStepStack","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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA6F,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtF,IAAMG,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;AAJAK,OAAA,CAAAN,mCAAA,GAAAA,mCAAA;AAKO,IAAMO,6BAA6B,GAAGA,CAACC,YAAgC,EAAEC,IAAY,KAAK;EAC/F,IAAMC,IAAI,GAAG,IAAAC,qBAAc,EAAC,CAAC;EAC7B,IA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ED,IAAM+B,WAAW,GAAGE,KAAA;EAAA,IAAC;IAAEjF,UAAU,EAAE;MAAEK;IAAK;EAAmB,CAAC,GAAA4E,KAAA;EAAA,OAAK5E,IAAI,KAAK,QAAQ;AAAA;AAEpF,IAAMY,kBAAkB,GAAGA,CAAA,KAAM,IAAAiE,mBAAY,EAAC,CAAC,CAACC,QAAQ,CAAC3E,gBAAS,CAAC;AAEnE,IAAMU,wBAAwB,GAAGA,CAACF,eAAgC,EAAEoE,WAA4B,KAAK;EACnG,IAAM;IAAEjD,UAAU,EAAEkD,mBAAmB;IAAExD,IAAI,EAAEyD;EAAiB,CAAC,GAAGtE,eAAe,CAAChB,UAAU;EAC9F,IAAM;IAAE6B,IAAI,EAAE0D;EAAa,CAAC,GAAGH,WAAW,CAACpF,UAAU;EAErD,OAAO,CAACqF,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMnB,qBAAqB,GAAIvE,KAAsB,IACnDA,KAAK,CAACG,UAAU,CAACK,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGmF,KAAA;EAAA,IAAC;IAAEnF,IAAI;IAAE6D;EAAiB,CAAC,GAAAsB,KAAA;EAAA,OAAKnF,IAAI,KAAK,SAAS,IAAI6D,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","e","__esModule","default","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","name","step","getCurrentStep","isLogStep","commandName","props","nameFromProps","log","consoleProps","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","_ref2","Object","is","ALLURE_STEP_CMD_SUBJECT","_ref3","_ref4","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","renderProps","stepName","filter","Boolean","join","getLogProps","map","_ref5","k","v","toString","value","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref6","isDefined","isAssertLog","Message","_ref7","getStepStack","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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA6F,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtF,IAAMG,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;I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F,IAAI;IAAE6D;EAAiB,CAAC,GAAAsB,KAAA;EAAA,OAAKnF,IAAI,KAAK,SAAS,IAAI6D,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.js","names":["_commandLog","require","_lifecycle","_steps","_utils","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","exports","enableReportingOfCypressScreenshots","Screenshot","defaults","onAfterScreenshot","_len","arguments","length","_ref","Array","_key","name","originalName","path","getFileNameFromPath","reportScreenshot","setupScreenshotAttachmentStep","_","entry","shouldCreateStepFromCommandLogEntry","startCommandLogStep","error","reportStepError","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => Cypress.Screenshot.defaults({ onAfterScreenshot });\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,IAAMI,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAACC,OAAA,CAAAL,6BAAA,GAAAA,6BAAA;AAEnG,IAAMM,mCAAmC,GAAGA,CAAA,KAAML,OAAO,CAACM,UAAU,CAACC,QAAQ,CAAC;EAAEC;AAAkB,CAAC,CAAC;AAACJ,OAAA,CAAAC,mCAAA,GAAAA,mCAAA;AAE5G,IAAMG,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAA,EAElB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,IADA,GAAG;IAAEC,IAAI,EAAEC,YAAY;IAAEC;EAAK,CAAC,CAAC,GAAAL,IAAA;EAEnC,IAAMG,IAAI,GAAGC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAAE,0BAAmB,EAACD,IAAI,CAAC;EACtD,IAAAE,2BAAgB,EAACF,IAAI,EAAEF,IAAI,CAAC;EAC5B,IAAAK,yCAA6B,EAACJ,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMZ,UAAU,GAAGA,CAACkB,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAI,IAAAC,+CAAmC,EAACD,KAAK,CAAC,EAAE;IAC9C,IAAAE,+BAAmB,EAACF,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMpB,MAAM,GAAIuB,KAA2B,IAAK;EAC9C,IAAAC,sBAAe,EAACD,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIE,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMF,KAAK;EACb;AACF,CAAC;AAED,IAAME,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAAC7B,OAAO,CAAC8B,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE7B,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cypress.js","names":["_commandLog","require","_lifecycle","_steps","_utils","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","exports","enableReportingOfCypressScreenshots","Screenshot","defaults","onAfterScreenshot","_len","arguments","length","_ref","Array","_key","name","originalName","path","getFileNameFromPath","reportScreenshot","setupScreenshotAttachmentStep","_","entry","shouldCreateStepFromCommandLogEntry","startCommandLogStep","error","reportStepError","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => Cypress.Screenshot.defaults({ onAfterScreenshot });\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,IAAMI,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAACC,OAAA,CAAAL,6BAAA,GAAAA,6BAAA;AAEnG,IAAMM,mCAAmC,GAAGA,CAAA,KAAML,OAAO,CAACM,UAAU,CAACC,QAAQ,CAAC;EAAEC;AAAkB,CAAC,CAAC;AAACJ,OAAA,CAAAC,mCAAA,GAAAA,mCAAA;AAE5G,IAAMG,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAA,EAElB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,IADA,GAAG;IAAEC,IAAI,EAAEC,YAAY;IAAEC;EAAK,CAAC,CAAC,GAAAL,IAAA;EAEnC,IAAMG,IAAI,GAAGC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAAE,0BAAmB,EAACD,IAAI,CAAC;EAEtD,IAAAE,2BAAgB,EAACF,IAAI,EAAEF,IAAI,CAAC;EAC5B,IAAAK,yCAA6B,EAACJ,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMZ,UAAU,GAAGA,CAACkB,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAI,IAAAC,+CAAmC,EAACD,KAAK,CAAC,EAAE;IAC9C,IAAAE,+BAAmB,EAACF,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMpB,MAAM,GAAIuB,KAA2B,IAAK;EAC9C,IAAAC,sBAAe,EAACD,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIE,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMF,KAAK;EACb;AACF,CAAC;AAED,IAAME,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAAC7B,OAAO,CAAC8B,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE7B,MAAM,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","names":["_utils","require","getAllureState","state","Cypress","env","config","DEFAULT_RUNTIME_CONFIG","initialized","messages","testPlan","undefined","currentTest","projectDir","stepStack","stepsToFinalize","nextApiStepId","exports","isAllureInitialized","setAllureInitialized","getRuntimeMessages","setRuntimeMessages","value","enqueueRuntimeMessage","message","push","getAllureTestPlan","getProjectDir","getCurrentTest","setCurrentTest","test","dropCurrentTest","getConfig","getStepStack","getCurrentStep","last","pushStep","step","popStep","pop","popSteps","index","toReversed","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,IAAAA,MAAA,GAAAC,OAAA;AAEO,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAIC,KAAK,GAA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CAAC,CAAC;AAACxB,OAAA,CAAAuB,QAAA,GAAAA,QAAA;AAE7E,IAAMI,WAAW,GAAGA,CAAA,KAAMJ,QAAQ,CAAC,CAAC,CAAC;AAACvB,OAAA,CAAA2B,WAAA,GAAAA,WAAA;AAEtC,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC3C,cAAc,CAAC,CAAC,CAACY,SAAS,GAAG,EAAE;AACjC,CAAC;AAACG,OAAA,CAAA4B,cAAA,GAAAA,cAAA;AAEK,IAAMC,qBAAqB,GAAGA,CAA2BT,IAAO,EAAEU,SAAyB,KAChG7C,cAAc,CAAC,CAAC,CAACa,eAAe,CAACU,IAAI,CAAC,CAACY,IAAI,EAAEU,SAAS,CAAC,CAAC;AAAC9B,OAAA,CAAA6B,qBAAA,GAAAA,qBAAA;AAEpD,IAAME,kBAAkB,GAAGA,CAAA,KAAM9C,cAAc,CAAC,CAAC,CAACa,eAAe;AAACE,OAAA,CAAA+B,kBAAA,GAAAA,kBAAA;AAElE,IAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,IAAM9C,KAAK,GAAGD,cAAc,CAAC,CAAC;EAC9BC,KAAK,CAACY,eAAe,GAAG,EAAE;AAC5B,CAAC;AAACE,OAAA,CAAAgC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"state.js","names":["_utils","require","getAllureState","state","Cypress","env","config","DEFAULT_RUNTIME_CONFIG","initialized","messages","testPlan","undefined","currentTest","projectDir","stepStack","stepsToFinalize","nextApiStepId","exports","isAllureInitialized","setAllureInitialized","getRuntimeMessages","setRuntimeMessages","value","enqueueRuntimeMessage","message","push","getAllureTestPlan","getProjectDir","getCurrentTest","setCurrentTest","test","dropCurrentTest","getConfig","getStepStack","getCurrentStep","last","pushStep","step","popStep","pop","popSteps","index","toReversed","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"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A,OAAA;AAE3C,IAAME,QAAQ,GAAIC,KAAa,IAAK,IAAAC,iBAAU,EAACT,YAAY,CAAC,CAAC,CAACU,MAAM,CAACF,KAAK,CAAC,CAAC;AAACxB,OAAA,CAAAuB,QAAA,GAAAA,QAAA;AAE7E,IAAMI,WAAW,GAAGA,CAAA,KAAMJ,QAAQ,CAAC,CAAC,CAAC;AAACvB,OAAA,CAAA2B,WAAA,GAAAA,WAAA;AAEtC,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC3C,cAAc,CAAC,CAAC,CAACY,SAAS,GAAG,EAAE;AACjC,CAAC;AAACG,OAAA,CAAA4B,cAAA,GAAAA,cAAA;AAEK,IAAMC,qBAAqB,GAAGA,CAA2BT,IAAO,EAAEU,SAAyB,KAChG7C,cAAc,CAAC,CAAC,CAACa,eAAe,CAACU,IAAI,CAAC,CAACY,IAAI,EAAEU,SAAS,CAAC,CAAC;AAAC9B,OAAA,CAAA6B,qBAAA,GAAAA,qBAAA;AAEpD,IAAME,kBAAkB,GAAGA,CAAA,KAAM9C,cAAc,CAAC,CAAC,CAACa,eAAe;AAACE,OAAA,CAAA+B,kBAAA,GAAAA,kBAAA;AAElE,IAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,IAAM9C,KAAK,GAAGD,cAAc,CAAC,CAAC;EAC9BC,KAAK,CAACY,eAAe,GAAG,EAAE;AAC5B,CAAC;AAACE,OAAA,CAAAgC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -37,7 +37,7 @@ var getIndicesOfDeselectedTests = (testPlan, spec, specPath, tests) => {
37
37
  var {
38
38
  fullNameSuffix,
39
39
  labels
40
- } = (0, _utils.getNamesAndLabels)(spec, test);
40
+ } = (0, _utils.getTestMetadata)(test);
41
41
  var fullName = "".concat(specPath, "#").concat(fullNameSuffix);
42
42
  var allureId = (_labels$find = labels.find(_ref => {
43
43
  var {
@@ -1 +1 @@
1
- {"version":3,"file":"testplan.js","names":["_allureJsCommons","require","_state","_utils","applyTestPlan","spec","root","testPlan","getAllureTestPlan","specPath","resolveSpecRelativePath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","exports","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","getNamesAndLabels","fullName","concat","allureId","find","_ref","name","LabelName","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,IAAAA,gBAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAAG,IAAAC,wBAAiB,EAAC,CAAC;EACpC,IAAID,QAAQ,EAAE;IACZ,IAAME,QAAQ,GAAG,IAAAC,8BAAuB,EAACL,IAAI,CAAC;IAC9C,KAAK,IAAMM,KAAK,IAAIC,aAAa,CAACN,IAAI,CAAC,EAAE;MACvC,IAAMO,eAAe,GAAGC,2BAA2B,CAACP,QAAQ,EAAEF,IAAI,EAAEI,QAAQ,EAAEE,KAAK,CAACI,KAAK,CAAC;MAC1FC,mBAAmB,CAACL,KAAK,CAACI,KAAK,EAAEF,eAAe,CAAC;IACnD;EACF;AACF,CAAC;AAACI,OAAA,CAAAb,aAAA,GAAAA,aAAA;AAEF,IAAMQ,aAAa,GAAG,UAAhBA,aAAaA,CAAcM,MAAoB,EAAE;EACrD,IAAMC,UAA0B,GAAG,EAAE;EACrC,KAAK,IAAIC,CAA2B,GAAGF,MAAM,EAAEE,CAAC,EAAEA,CAAC,GAAGD,UAAU,CAACE,GAAG,CAAC,CAAC,EAAE;IACtE,MAAMD,CAAC;;IAEP;IACA;IACA,KAAK,IAAIE,CAAC,GAAGF,CAAC,CAACG,MAAM,CAACC,MAAM,GAAG,CAAC,EAAEF,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;MAC7CH,UAAU,CAACM,IAAI,CAACL,CAA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AAC+B,IAAI,CAAEnB,IAAI;EAAA,IAAAoB,QAAA;EAAA,OAAMZ,QAAQ,IAAI,EAAAY,QAAA,GAAApB,IAAI,CAACqB,EAAE,cAAAD,QAAA,uBAAPA,QAAA,CAASE,QAAQ,CAAC,CAAC,MAAKd,QAAQ,IAAKR,IAAI,CAACuB,QAAQ,KAAKjB,QAAQ;AAAA,EAAC","ignoreList":[]}
1
+ {"version":3,"file":"testplan.js","names":["_allureJsCommons","require","_state","_utils","applyTestPlan","spec","root","testPlan","getAllureTestPlan","specPath","resolveSpecRelativePath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","exports","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","getTestMetadata","fullName","concat","allureId","find","_ref","name","LabelName","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,IAAAA,gBAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAAG,IAAAC,wBAAiB,EAAC,CAAC;EACpC,IAAID,QAAQ,EAAE;IACZ,IAAME,QAAQ,GAAG,IAAAC,8BAAuB,EAACL,IAAI,CAAC;IAC9C,KAAK,IAAMM,KAAK,IAAIC,aAAa,CAACN,IAAI,CAAC,EAAE;MACvC,IAAMO,eAAe,GAAGC,2BAA2B,CAACP,QAAQ,EAAEF,IAAI,EAAEI,QAAQ,EAAEE,KAAK,CAACI,KAAK,CAAC;MAC1FC,mBAAmB,CAACL,KAAK,CAACI,KAAK,EAAEF,eAAe,CAAC;IACnD;EACF;AACF,CAAC;AAACI,OAAA,CAAAb,aAAA,GAAAA,aAAA;AAEF,IAAMQ,aAAa,GAAG,UAAhBA,aAAaA,CAAcM,MAAoB,EAAE;EACrD,IAAMC,UAA0B,GAAG,EAAE;EACrC,KAA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ACpB,MAAM,GAAG,CAAC,EAAEF,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5CqB,GAAG,CAACE,MAAM,CAACD,OAAO,CAACtB,CAAC,CAAC,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC;AAED,IAAMoB,kBAAkB,GAAGA,CAACnC,QAAoB,EAAE0B,QAAgB,EAAEE,QAA4B,KAC9F5B,QAAQ,CAACQ,KAAK,CAAC+B,IAAI,CAAEnB,IAAI;EAAA,IAAAoB,QAAA;EAAA,OAAMZ,QAAQ,IAAI,EAAAY,QAAA,GAAApB,IAAI,CAACqB,EAAE,cAAAD,QAAA,uBAAPA,QAAA,CAASE,QAAQ,CAAC,CAAC,MAAKd,QAAQ,IAAKR,IAAI,CAACuB,QAAQ,KAAKjB,QAAQ;AAAA,EAAC","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.uint8ArrayToBase64 = exports.resolveSpecRelativePath = exports.markTestAsReported = exports.iterateTests = exports.iterateSuites = exports.isTestReported = exports.isRootAfterAllHook = exports.isLastRootAfterHook = exports.isAllureHook = exports.getTestStopData = exports.getTestStartData = exports.getTestSkipData = exports.getSuiteTitlePath = exports.getSuitePath = exports.getStepStopData = exports.getStatusDataOfTestSkippedByHookError = exports.getNamesAndLabels = exports.getFileNameFromPath = exports.generateApiStepId = void 0;
6
+ exports.uint8ArrayToBase64 = exports.resolveSpecRelativePath = exports.markTestAsReported = exports.iterateTests = exports.iterateSuites = exports.isTestReported = exports.isRootAfterAllHook = exports.isLastRootAfterHook = exports.isAllureHook = exports.getTestStopData = exports.getTestStartData = exports.getTestSkipData = exports.getTestMetadata = exports.getSuiteTitlePath = exports.getSuitePath = exports.getStepStopData = exports.getStatusDataOfTestSkippedByHookError = exports.getFileNameFromPath = exports.generateApiStepId = void 0;
7
7
  var _allureJsCommons = require("allure-js-commons");
8
8
  var _sdk = require("allure-js-commons/sdk");
9
9
  var _mocha = require("./events/mocha.js");
@@ -35,9 +35,9 @@ var uint8ArrayToBase64 = data => {
35
35
  };
36
36
  exports.uint8ArrayToBase64 = uint8ArrayToBase64;
37
37
  var getTestStartData = test => {
38
- var _test$wallClockStarte;
39
- return _objectSpread(_objectSpread({}, getNamesAndLabels(Cypress.spec, test)), {}, {
40
- start: ((_test$wallClockStarte = test.wallClockStartedAt) === null || _test$wallClockStarte === void 0 ? void 0 : _test$wallClockStarte.getTime()) || Date.now()
38
+ var _test$wallClockStarte, _test$wallClockStarte2;
39
+ return _objectSpread(_objectSpread({}, getTestMetadata(test)), {}, {
40
+ 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()
41
41
  });
42
42
  };
43
43
  exports.getTestStartData = getTestStartData;
@@ -104,21 +104,23 @@ var getSuiteTitlePath = test => getSuitePath(test).filter(s => s.title).map(s =>
104
104
  exports.getSuiteTitlePath = getSuiteTitlePath;
105
105
  var generateApiStepId = () => ((0, _state.getAllureState)().nextApiStepId++).toString();
106
106
  exports.generateApiStepId = generateApiStepId;
107
- var getNamesAndLabels = (spec, test) => {
107
+ var getTestMetadata = test => {
108
108
  var rawName = test.title;
109
109
  var {
110
110
  cleanTitle: name,
111
- labels
111
+ labels,
112
+ links
112
113
  } = (0, _sdk.extractMetadataFromString)(rawName);
113
114
  var suites = test.titlePath().slice(0, -1);
114
115
  var fullNameSuffix = "".concat([...suites, name].join(" "));
115
116
  return {
116
117
  name,
117
118
  labels,
119
+ links,
118
120
  fullNameSuffix
119
121
  };
120
122
  };
121
- exports.getNamesAndLabels = getNamesAndLabels;
123
+ exports.getTestMetadata = getTestMetadata;
122
124
  var isAllureHook = hook => hook.title.includes(_mocha.ALLURE_REPORT_SYSTEM_HOOK);
123
125
  exports.isAllureHook = isAllureHook;
124
126
  var isRootAfterAllHook = hook => hook.parent.root && hook.hookName === "after all";
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_allureJsCommons","require","_sdk","_mocha","_state","_steps","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","IS_WIN","Cypress","platform","getFileNameFromPath","path","substring","lastIndexOf","exports","resolveSpecRelativePath","spec","projectDir","getProjectDir","specPath","absolute","relative","replaceAll","uint8ArrayToBase64","data","u8arrayLike","Array","isArray","buffer","btoa","fromCharCode","getTestStartData","test","_test$wallClockStarte","getNamesAndLabels","start","wallClockStartedAt","getTime","Date","now","getTestStopData","_test$duration","_retries","duration","retries","getTestSkipData","statusDetails","message","getStepStopData","step","status","id","stop","resolveStepStatus","testReportedKey","markTestAsReported","isTestReported","iterateSuites","parent","suiteStack","s","pop","suites","iterateTests","suite","tests","getSuitePath","reverse","getSuiteTitlePath","title","map","generateApiStepId","getAllureState","nextApiStepId","toString","rawName","cleanTitle","name","labels","extractMetadataFromString","titlePath","slice","fullNameSuffix","concat","join","isAllureHook","hook","includes","ALLURE_REPORT_SYSTEM_HOOK","isRootAfterAllHook","root","hookName","isLastRootAfterHook","context","currentAfterAll","rootSuite","hooks","lastAfterAll","findLast","h","hookId","getStatusDataOfTestSkippedByHookError","hookTitle","isEachHook","err","Status","SKIPPED","getStatusFromError","trace","getMessageAndTraceFromError","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,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA+C,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,EAAAC,CAAA,E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AAmB,EACnBC,GAAU,EACVxC,KAAmB,KAChB;EACH,IAAMd,MAAM,GAAGqD,UAAU,GAAGE,uBAAM,CAACC,OAAO,GAAG,IAAAC,uBAAkB,EAACH,GAAG,CAAC;EACpE,IAAM;IAAEzD,OAAO;IAAE6D;EAAM,CAAC,GAAG,IAAAC,gCAA2B,EAACL,GAAG,CAAC;EAC3D,OAAO;IACLtD,MAAM;IACNJ,aAAa,EAAE;MACbC,OAAO,EAAEwD,UAAU,GAAGO,aAAa,CAACR,SAAS,EAAEtC,KAAK,CAAC,GAAGjB,OAAO;MAC/D6D;IACF;EACF,CAAC;AACH,CAAC;AAAC9F,OAAA,CAAAuF,qCAAA,GAAAA,qCAAA;AAEF,IAAMS,aAAa,GAAGA,CAACR,SAAiB,EAAEtC,KAAmB,KAAK;EAChE,IAAM+C,SAAS,GAAG/C,KAAK,CAACK,KAAK,OAAAc,MAAA,CAAOnB,KAAK,CAACK,KAAK,SAAM,MAAM;EAC3D,WAAAc,MAAA,CAAWmB,SAAS,uBAAAnB,MAAA,CAAoB4B,SAAS;AACnD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["_allureJsCommons","require","_sdk","_mocha","_state","_steps","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","IS_WIN","Cypress","platform","getFileNameFromPath","path","substring","lastIndexOf","exports","resolveSpecRelativePath","spec","projectDir","getProjectDir","specPath","absolute","relative","replaceAll","uint8ArrayToBase64","data","u8arrayLike","Array","isArray","buffer","btoa","fromCharCode","getTestStartData","test","_test$wallClockStarte","_test$wallClockStarte2","getTestMetadata","start","wallClockStartedAt","Date","parse","getTime","now","getTestStopData","_test$duration","_retries","duration","retries","getTestSkipData","statusDetails","message","getStepStopData","step","status","id","stop","resolveStepStatus","testReportedKey","markTestAsReported","isTestReported","iterateSuites","parent","suiteStack","s","pop","suites","iterateTests","suite","tests","getSuitePath","reverse","getSuiteTitlePath","title","map","generateApiStepId","getAllureState","nextApiStepId","toString","rawName","cleanTitle","name","labels","links","extractMetadataFromString","titlePath","slice","fullNameSuffix","concat","join","isAllureHook","hook","includes","ALLURE_REPORT_SYSTEM_HOOK","isRootAfterAllHook","root","hookName","isLastRootAfterHook","context","currentAfterAll","rootSuite","hooks","lastAfterAll","findLast","h","hookId","getStatusDataOfTestSkippedByHookError","hookTitle","isEachHook","err","Status","SKIPPED","getStatusFromError","trace","getMessageAndTraceFromError","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,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA+C,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAA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AAEF,IAAMS,aAAa,GAAGA,CAACR,SAAiB,EAAEvC,KAAmB,KAAK;EAChE,IAAMgD,SAAS,GAAGhD,KAAK,CAACK,KAAK,OAAAe,MAAA,CAAOpB,KAAK,CAACK,KAAK,SAAM,MAAM;EAC3D,WAAAe,MAAA,CAAWmB,SAAS,uBAAAnB,MAAA,CAAoB4B,SAAS;AACnD,CAAC","ignoreList":[]}
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var G=Object.defineProperty;var er=Object.getOwnPropertyDescriptor;var rr=Object.getOwnPropertyNames;var sr=Object.prototype.hasOwnProperty;var nr=(t,e)=>{for(var r in e)G(t,r,{get:e[r],enumerable:!0})},or=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of rr(e))!sr.call(t,n)&&n!==r&&G(t,n,{get:()=>e[n],enumerable:!(s=er(e,n))||s.enumerable});return t};var ar=t=>or(G({},"__esModule",{value:!0}),t);var ls={};nr(ls,{ContentType:()=>_,LabelName:()=>c,LinkType:()=>A,Severity:()=>St,Stage:()=>ht,Status:()=>u,StatusByPriority:()=>yt,allureId:()=>Ht,attachment:()=>kt,attachmentPath:()=>wt,description:()=>Dt,descriptionHtml:()=>Pt,displayName:()=>Rt,epic:()=>jt,feature:()=>Nt,historyId:()=>_t,issue:()=>Lt,label:()=>g,labels:()=>Et,layer:()=>Vt,link:()=>w,links:()=>At,logStep:()=>It,owner:()=>Wt,parameter:()=>bt,parentSuite:()=>zt,severity:()=>Kt,step:()=>Ft,story:()=>Ut,subSuite:()=>Bt,suite:()=>Gt,tag:()=>$t,tags:()=>Yt,testCaseId:()=>Mt,tms:()=>Ot});module.exports=ar(ls);var u=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),yt=[u.FAILED,u.BROKEN,u.PASSED,u.SKIPPED],ht=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),c=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}({}),St=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),_=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}({}),A=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function M(){M=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)),k(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 ir(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)},M.apply(this,arguments)}function ir(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)}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 u.FAILED;default:return u.BROKEN}},pr=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")},z=t=>{var e=pr();return t.replace(e,"")},h=t=>{var{message:e,stack:r}=t;return{message:e?z(e):void 0,trace:r?z(r):void 0}},vt=M(/(?:^|\s)@?allure\.id[:=]([^\s]+)/,{id:1}),ur=new RegExp(vt,"g"),xt=M(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/,{name:1,value:2}),cr=new RegExp(xt,"g");var B=t=>{var e=[];t.split(" ").forEach(s=>{var n,a=(n=s.match(vt))===null||n===void 0||(n=n.groups)===null||n===void 0?void 0:n.id;a&&e.push({name:c.ALLURE_ID,value:a});var o=s.match(xt),{name:p,value:i}=o?.groups||{};p&&i&&e?.push({name:p,value:i})});var r=t.replace(cr,"").replace(ur,"").trim();return{labels:e,cleanTitle:r}};var b=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",W=function(e){var{maxDepth:r=0,maxLength:s=0,replacer:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return gr(typeof e=="object"?JSON.stringify(e,lr(r,n)):String(e),s)},lr=(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?dr(r,o):o instanceof Set?fr(r,o):o};return e?mr(e,s):s},mr=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},dr=(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]}),fr=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),gr=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function Tt(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){Tt(a,s,n,o,p,"next",i)}function p(i){Tt(a,s,n,o,p,"throw",i)}o(void 0)})}}var K=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 K;var Ct="allureTestRuntime",$=t=>{globalThis[Ct]=()=>t},V=()=>globalThis?.[Ct],Y=()=>{var t=V();if(t){var e;return(e=t())!==null&&e!==void 0?e:T}return T},q=()=>{var t=V();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=V())===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=q();return b(a)?a.then(o=>o[e](...s)):a[e](...s)},g=(t,e)=>m("labels",{name:t,value:e}),Et=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},w=(t,e,r)=>m("links",{url:t,type:r,name:e}),At=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},bt=(t,e,r)=>m("parameter",t,e,r),Dt=t=>m("description",t),Pt=t=>m("descriptionHtml",t),Rt=t=>m("displayName",t),_t=t=>m("historyId",t),Mt=t=>m("testCaseId",t),kt=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},wt=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},yr=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),It=(t,e,r)=>m("logStep",t,e,r),Ft=(t,e)=>m("step",t,()=>e(yr())),Lt=(t,e)=>w(t,e,A.ISSUE),Ot=(t,e)=>w(t,e,A.TMS),Ht=t=>g(c.ALLURE_ID,t),jt=t=>g(c.EPIC,t),Nt=t=>g(c.FEATURE,t),Ut=t=>g(c.STORY,t),Gt=t=>g(c.SUITE,t),zt=t=>g(c.PARENT_SUITE,t),Bt=t=>g(c.SUB_SUITE,t),Wt=t=>g(c.OWNER,t),Kt=t=>g(c.SEVERITY,t),Vt=t=>g(c.LAYER,t),$t=t=>g(c.TAG,t),Yt=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:c.TAG,value:n})))};var qt={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},Jt=(t,e)=>{let r=t.findIndex(e);return r!==-1?J(t.splice(r)):[]},J=t=>{let e=t.length,r=new Array(e);for(let s=0;s<e;s++)r[e-s-1]=t[s];return r},Zt=t=>t[t.length-1],Xt=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:qt,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},Qt=()=>d().initialized,te=()=>{d().initialized=!0},Z=()=>d().messages,ee=t=>{d().messages=t},l=t=>{Z().push(t)},re=()=>d().testPlan,se=()=>d().projectDir,ne=()=>d().currentTest,oe=t=>{d().currentTest=t},ae=()=>{d().currentTest=void 0},ie=()=>d().config,x=()=>d().stepStack,pe=()=>Zt(x()),I=t=>x().push(t);var Sr=t=>J(x().splice(t)),ue=()=>Sr(0);var F=(t,e)=>d().stepsToFinalize.push([t,e]),ce=()=>d().stepsToFinalize,le=()=>{let t=d();t.stepsToFinalize=[]};var me=(t,e)=>{let r=re();if(r){let s=de(t);for(let n of vr(e)){let a=xr(r,t,s,n.tests);Tr(n.tests,a)}}},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((a,o)=>{let{fullNameSuffix:p,labels:i}=X(e,a),y=`${r}#${p}`,S=i.find(({name:tr})=>tr===c.ALLURE_ID)?.value;Cr(t,y,S)||n.push(o)}),n},Tr=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},Cr=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var L="__allure_report_system_hook__",fe=()=>{Cypress.mocha.getRunner().on("start",Er).on("suite",Ar).on("suite end",xe).on("hook",br).on("hook end",Dr).on("test",Pr).on("pass",Te).on("fail",Rr).on("pending",Ce).on("test end",st)},ge=()=>{afterEach(L,nt),after(L,_r)},Er=()=>{he(),Se()},Ar=t=>{t.root&&me(Cypress.spec,t),ve(t)},br=t=>{C(t)||Q(t)},Dr=t=>{C(t)||O(t)},Pr=t=>{D(t)||tt(t)},Rr=(t,e)=>{let r="hookName"in t;if(r&&ye(t))return;r&&C(t)&&Q(t,Date.now()-(t.duration??0)),et(e),r&&rt(t,e)},_r=function(){nt(),E(this)};var Ee=Cypress.platform==="win32",Ae=t=>t.substring(t.lastIndexOf(Ee?"\\":"/")+1),de=t=>{let e=se(),r=e?t.absolute.substring(e.length+1):t.relative;return Ee?r.replaceAll("\\","/"):r},be=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,ot=t=>({...X(Cypress.spec,t),start:t.wallClockStartedAt?.getTime()||Date.now()}),De=t=>({duration:t.duration??0,retries:t._retries??0}),at=()=>({statusDetails:{message:"This is a pending test"}}),Pe=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??Fe(t)};return r&&(s.statusDetails=r),s},Re=Symbol("The test has been reported to Allure"),it=t=>{t[Re]=!0},D=t=>t[Re]===!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])}},_e=function*(t){for(let e of Mr(t))yield*e.tests},Me=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var ke=()=>(d().nextApiStepId++).toString(),X=(t,e)=>{let r=e.title,{cleanTitle:s,labels:n}=B(r),o=`${[...e.titlePath().slice(0,-1),s].join(" ")}`;return{name:s,labels:n,fullNameSuffix:o}},C=t=>t.title.includes(L),ye=t=>t.parent.root&&t.hookName==="after all",we=t=>{let e=t.test;return t.test.parent.hooks.findLast(a=>a.hookName==="after all")?.hookId===e.hookId},Ie=(t,e,r,s)=>{let n=e?u.SKIPPED:v(r),{message:a,trace:o}=h(r);return{status:n,statusDetails:{message:e?kr(t,s):a,trace:o}}},kr=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`};var P={},Le=t=>t.type==="api",R=t=>t.type==="log",pt=t=>N(wr(),t),wr=()=>{let t=ke();return I({id:t,type:"api"}),t},Oe=t=>{let e=v(t),r=h(t);Fr(e,r),je(t)},ut=(t,e)=>H(r=>Le(r),t,e),H=(t,e,r)=>He(Jt(x(),t),e,r),j=(t,e)=>He(ue(),t,e),ct=()=>{j(),ce().forEach(Ir),le()},Fe=t=>t.error?v(t.error):u.PASSED,Ir=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=h(s)),e?.(n),l({type:"cypress_step_finalize",data:n})},Fr=(t,e)=>{let r=x(),s=r.at(r.findLastIndex(R)+1);s&&H(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},He=(t,e,r)=>{let s;for(let n of t)s=Lr(n,s),Or(n,e,r);s&&je(s)},je=t=>x().forEach(e=>e.error=t),Or=(t,e,r)=>{Ne(t,e,r),Le(t)&&t.error&&F(t)};var he=()=>$(new lt),mt=()=>Y(),lt=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=be(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=u.PASSED,s){return cy.wrap(P,{log:!1}).then(()=>(pt(e),Cypress.Promise.resolve())).then(()=>(ut(r,s?h(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(P,{log:!1}).then(()=>(pt(e),Cypress.Promise.resolve(r()))).then(s=>(ut(),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(){ee([])}#t(e){return l(e),Cypress.Promise.resolve()}#r(){let e=Z();return this.#e(),e}};var Se=()=>{l({type:"cypress_run_start",data:{}})},ve=t=>{l({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},xe=t=>{l({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},Q=(t,e)=>{l({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()}})},O=t=>{ct(),l({type:"cypress_hook_end",data:{duration:t.duration??0}})},tt=t=>{oe(t),l({type:"cypress_test_start",data:ot(t)}),it(t)},N=(t,e)=>{l({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},Ne=(t,e,r)=>{l({type:"cypress_step_stop",data:Pe(t,e,r)})},Te=()=>{l({type:"cypress_test_pass",data:{}})},et=t=>{let e=v(t),r=h(t);j(e,r),l({type:"cypress_fail",data:{status:e,statusDetails:r}})},rt=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=Ie(t.title,r,e,s);O(t),Hr(),jr(s,n)},Ce=t=>{D(t)?j(u.SKIPPED,{message:"The test was skipped before the command was completed"}):tt(t),l({type:"cypress_test_skip",data:at()})},st=t=>{ct(),l({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),ae()},Ue=(t,e)=>{l({type:"attachment_path",data:{path:t,name:e,contentType:_.PNG}})},E=t=>{if(we(t)){let e=t.test;return C(e)||O(e),Ge()}},dt=(t,e)=>{try{return et(e),rt(t.test,e),Ge()}catch(r){Ur(t,r)}},ft=(t,e)=>{if(!dt(t,e)?.then(()=>{throw e}))throw e},nt=()=>mt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),Ge=()=>mt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),Hr=()=>{let t=ne();t&&st(t)},jr=(t,e)=>{for(let r of _e(t))D(r)||Nr(r,r.pending?{...at(),status:u.SKIPPED}:e)},Nr=(t,e)=>{l({type:"cypress_skipped_test",data:{...ot(t),...e,...De(t),suites:Me(t).map(r=>r.id)}}),it(t)},Ur=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var Be=()=>{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=a=>(o,p,i)=>{t();try{return Wr(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},Br=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,ze(t,n)):e(ze(t,s));globalThis.after=r},Wr=(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)},ze=(t,e)=>{if(t()===0&&e){let r=e.length?Kr(e):Vr(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},Kr=t=>function(e){let r=s=>{if(s){dt(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)},Vr=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)ft(this,r);else return b(e)?e.then(()=>E(this),s=>ft(this,s)):(E(this),e)};var We=t=>Yr(t)?Ke(t):W(t,$r()),$r=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=ie();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:qr}},Yr=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),Ke=t=>Cypress.dom.stringify(t,"long"),qr=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return Ke(e)}return e};var Ve=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||Xr(t))},$e=(t,e)=>{let r=pe();if(r&&R(r)){let{name:s,props:{name:n}}=r.log.attributes.consoleProps();s==="screenshot"&&n===t&&(r.attachmentName=e)}},Ye=t=>{let e=os();typeof e<"u"&&as(e.log,t)&&U(e.log.attributes.id),Jr(t),N(t.attributes.id,Qr(t)),Zr(t)},U=t=>H(({id:e})=>e===t),Jr=t=>{let r={id:t.attributes.id,type:"log",log:t};I(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)U(s);else if(e){let n=t.endGroup;t.endGroup=function(){return U(s),n.call(this)}}else{let n=t.end;t.end=function(){return U(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(),a=(qe(t)??rs(t)??t.attributes.renderProps().message??r).trim();return[n,a].filter(Boolean).join(" ")},ts=t=>ss(t).map(([e,r])=>({name:e.toString(),value:We(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=!!qe(t);return Object.entries(e().props).filter(([s,n])=>Xt(n)&&!(r&&s==="Message"))},qe=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 Je=()=>Cypress.on("fail",Ze).on("log:added",us),gt=()=>Cypress.Screenshot.defaults({onAfterScreenshot:ps}),ps=(...[,{name:t,path:e}])=>{let r=t??Ae(e);Ue(e,r),$e(t,r)},us=(t,e)=>{Ve(e)&&Ye(e)},Ze=t=>{if(Oe(t),cs())throw t},cs=()=>Object.is(Cypress.listeners("fail").at(-1),Ze);var Xe=()=>{fe(),Je(),ge(),Be()};var Qe=()=>{Qt()||(te(),Xe(),gt())};Qe();
1
+ "use strict";var B=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var or=Object.prototype.hasOwnProperty;var ar=(t,e)=>{for(var r in e)B(t,r,{get:e[r],enumerable:!0})},ir=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of nr(e))!or.call(t,n)&&n!==r&&B(t,n,{get:()=>e[n],enumerable:!(s=sr(e,n))||s.enumerable});return t};var pr=t=>ir(B({},"__esModule",{value:!0}),t);var Ss={};ar(Ss,{ContentType:()=>k,LabelName:()=>c,LinkType:()=>C,Severity:()=>Tt,Stage:()=>xt,Status:()=>u,StatusByPriority:()=>vt,allureId:()=>Ut,attachment:()=>It,attachmentPath:()=>Lt,description:()=>_t,descriptionHtml:()=>Mt,displayName:()=>kt,epic:()=>Gt,feature:()=>zt,historyId:()=>wt,issue:()=>Ht,label:()=>h,labels:()=>Dt,layer:()=>Yt,link:()=>F,links:()=>Pt,logStep:()=>Ot,owner:()=>Vt,parameter:()=>Rt,parentSuite:()=>Wt,severity:()=>qt,step:()=>jt,story:()=>Bt,subSuite:()=>$t,suite:()=>Kt,tag:()=>Jt,tags:()=>Zt,testCaseId:()=>Ft,tms:()=>Nt});module.exports=pr(Ss);var u=function(t){return t.FAILED="failed",t.BROKEN="broken",t.PASSED="passed",t.SKIPPED="skipped",t}({}),vt=[u.FAILED,u.BROKEN,u.PASSED,u.SKIPPED],xt=function(t){return t.SCHEDULED="scheduled",t.RUNNING="running",t.FINISHED="finished",t.PENDING="pending",t.INTERRUPTED="interrupted",t}({}),c=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}({}),Tt=function(t){return t.BLOCKER="blocker",t.CRITICAL="critical",t.NORMAL="normal",t.MINOR="minor",t.TRIVIAL="trivial",t}({}),k=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}({}),C=function(t){return t.DEFAULT="link",t.ISSUE="issue",t.TMS="tms",t}({});function K(){K=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)),w(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 ur(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)},K.apply(this,arguments)}function ur(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&&w(t,e)}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},w(t,e)}function At(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 W(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?At(Object(r),!0).forEach(function(s){cr(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):At(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function cr(t,e,r){return(e=lr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lr(t){var e=mr(t,"string");return typeof e=="symbol"?e:e+""}function mr(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 u.FAILED;default:return u.BROKEN}},dr=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")},$=t=>{var e=dr();return t.replace(e,"")},fr=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 W(W({},e),r)},S=t=>{var{message:e,stack:r}=t;return W({message:e?$(e):void 0,trace:r?$(r):void 0},fr(t))};var gr=K(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/,{type:1}),Et=new RegExp(gr,"g");var yr=t=>t?.[1],hr=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 V=t=>{var e=[],r=[],s=t.matchAll(Et),n=t.replaceAll(Et,"").split(" ").filter(Boolean).reduce((M,z)=>/^[\n\r]/.test(z)?M+z:"".concat(M," ").concat(z),"").trim();for(var o of s){var a=o,p=yr(a),i=hr(a);if(!(!p||!i)){var[g,y]=p.split(".");switch(g){case"id":e.push({name:c.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 D=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 Ar(typeof e=="object"?JSON.stringify(e,Sr(r,n)):String(e),s)},Sr=(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?xr(r,a):a instanceof Set?Tr(r,a):a};return e?vr(e,s):s},vr=(t,e)=>function(r,s){return e.call(this,r,t.call(this,r,s))},xr=(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]}),Tr=(t,e)=>Array.from(e).map(r=>t.includes(r)?void 0:r),Ar=(t,e)=>e&&t.length>e?"".concat(t.substring(0,e),"..."):t;function bt(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){bt(o,s,n,a,p,"next",i)}function p(i){bt(o,s,n,a,p,"throw",i)}a(void 0)})}}var q=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 q;var Ct="allureTestRuntime",J=t=>{globalThis[Ct]=()=>t},Y=()=>globalThis?.[Ct],Z=()=>{var t=Y();if(t){var e;return(e=t())!==null&&e!==void 0?e:A}return A},X=()=>{var t=Y();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=Y())===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=X();return D(o)?o.then(a=>a[e](...s)):o[e](...s)},h=(t,e)=>m("labels",{name:t,value:e}),Dt=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("labels",...r)},F=(t,e,r)=>m("links",{url:t,type:r,name:e}),Pt=function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return m("links",...r)},Rt=(t,e,r)=>m("parameter",t,e,r),_t=t=>m("description",t),Mt=t=>m("descriptionHtml",t),kt=t=>m("displayName",t),wt=t=>m("historyId",t),Ft=t=>m("testCaseId",t),It=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachment",t,e,s)},Lt=(t,e,r)=>{var s=typeof r=="string"?{contentType:r}:r;return m("attachmentFromPath",t,e,s)},Er=()=>({displayName:t=>m("stepDisplayName",t),parameter:(t,e,r)=>m("stepParameter",t,e,r)}),Ot=(t,e,r)=>m("logStep",t,e,r),jt=(t,e)=>m("step",t,()=>e(Er())),Ht=(t,e)=>F(t,e,C.ISSUE),Nt=(t,e)=>F(t,e,C.TMS),Ut=t=>h(c.ALLURE_ID,t),Gt=t=>h(c.EPIC,t),zt=t=>h(c.FEATURE,t),Bt=t=>h(c.STORY,t),Kt=t=>h(c.SUITE,t),Wt=t=>h(c.PARENT_SUITE,t),$t=t=>h(c.SUB_SUITE,t),Vt=t=>h(c.OWNER,t),qt=t=>h(c.SEVERITY,t),Yt=t=>h(c.LAYER,t),Jt=t=>h(c.TAG,t),Zt=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:c.TAG,value:n})))};var Xt={stepsFromCommands:{maxArgumentLength:128,maxArgumentDepth:3}},Qt=(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},te=t=>t[t.length-1],ee=t=>typeof t<"u";var d=()=>{let t=Cypress.env("allure");return t||(t={config:Xt,initialized:!1,messages:[],testPlan:void 0,currentTest:void 0,projectDir:void 0,stepStack:[],stepsToFinalize:[],nextApiStepId:0},Cypress.env("allure",t)),t},re=()=>d().initialized,se=()=>{d().initialized=!0},tt=()=>d().messages,ne=t=>{d().messages=t},l=t=>{tt().push(t)},oe=()=>d().testPlan,ae=()=>d().projectDir,ie=()=>d().currentTest,pe=t=>{d().currentTest=t},ue=()=>{d().currentTest=void 0},ce=()=>d().config,x=()=>d().stepStack,le=()=>te(x()),I=t=>x().push(t);var Cr=t=>Q(x().splice(t)),me=()=>Cr(0);var L=(t,e)=>d().stepsToFinalize.push([t,e]),de=()=>d().stepsToFinalize,fe=()=>{let t=d();t.stepsToFinalize=[]};var ge=(t,e)=>{let r=oe();if(r){let s=ye(t);for(let n of Dr(e)){let o=Pr(r,t,s,n.tests);Rr(n.tests,o)}}},Dr=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])}},Pr=(t,e,r,s)=>{let n=[];return s.forEach((o,a)=>{let{fullNameSuffix:p,labels:i}=et(o),g=`${r}#${p}`,y=i.find(({name:M})=>M===c.ALLURE_ID)?.value;_r(t,g,y)||n.push(a)}),n},Rr=(t,e)=>{for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)},_r=(t,e,r)=>t.tests.some(s=>r&&s.id?.toString()===r||s.selector===e);var O="__allure_report_system_hook__",he=()=>{Cypress.mocha.getRunner().on("start",Mr).on("suite",kr).on("suite end",Ee).on("hook",wr).on("hook end",Fr).on("test",Ir).on("pass",be).on("fail",Lr).on("pending",Ce).on("test end",at)},Se=()=>{afterEach(O,it),after(O,Or)},Mr=()=>{xe(),Te()},kr=t=>{t.root&&ge(Cypress.spec,t),Ae(t)},wr=t=>{E(t)||rt(t)},Fr=t=>{E(t)||j(t)},Ir=t=>{P(t)||st(t)},Lr=(t,e)=>{let r="hookName"in t;if(r&&ve(t))return;r&&E(t)&&rt(t,Date.now()-(t.duration??0)),nt(e),r&&ot(t,e)},Or=function(){it(),b(this)};var De=Cypress.platform==="win32",Pe=t=>t.substring(t.lastIndexOf(De?"\\":"/")+1),ye=t=>{let e=ae(),r=e?t.absolute.substring(e.length+1):t.relative;return De?r.replaceAll("\\","/"):r},Re=t=>Array.isArray(t)||t.buffer?btoa(String.fromCharCode.apply(null,t)):t,pt=t=>({...et(t),start:typeof t.wallClockStartedAt=="string"?Date.parse(t.wallClockStartedAt):t.wallClockStartedAt?.getTime?.()||Date.now()}),_e=t=>({duration:t.duration??0,retries:t._retries??0}),ut=()=>({statusDetails:{message:"This is a pending test"}}),Me=(t,e,r)=>{let s={id:t.id,stop:Date.now(),status:e??je(t)};return r&&(s.statusDetails=r),s},ke=Symbol("The test has been reported to Allure"),ct=t=>{t[ke]=!0},P=t=>t[ke]===!0,jr=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])}},we=function*(t){for(let e of jr(t))yield*e.tests},Fe=t=>{let e=[];for(let r=t.parent;r;r=r.parent)e.push(r);return e.reverse(),e};var Ie=()=>(d().nextApiStepId++).toString(),et=t=>{let e=t.title,{cleanTitle:r,labels:s,links:n}=V(e),a=`${[...t.titlePath().slice(0,-1),r].join(" ")}`;return{name:r,labels:s,links:n,fullNameSuffix:a}},E=t=>t.title.includes(O),ve=t=>t.parent.root&&t.hookName==="after all",Le=t=>{let e=t.test;return t.test.parent.hooks.findLast(o=>o.hookName==="after all")?.hookId===e.hookId},Oe=(t,e,r,s)=>{let n=e?u.SKIPPED:v(r),{message:o,trace:a}=S(r);return{status:n,statusDetails:{message:e?Hr(t,s):o,trace:a}}},Hr=(t,e)=>{let r=e.title?`'${e.title}'`:"root";return`'${t}' defined in the ${r} suite has failed`};var R={},He=t=>t.type==="api",_=t=>t.type==="log",lt=t=>U(Nr(),t),Nr=()=>{let t=Ie();return I({id:t,type:"api"}),t},Ne=t=>{let e=v(t),r=S(t);Gr(e,r),Ge(t)},mt=(t,e)=>H(r=>He(r),t,e),H=(t,e,r)=>Ue(Qt(x(),t),e,r),N=(t,e)=>Ue(me(),t,e),dt=()=>{N(),de().forEach(Ur),fe()},je=t=>t.error?v(t.error):u.PASSED,Ur=([t,e])=>{let{id:r,error:s}=t,n={id:r};s&&(n.statusDetails=S(s)),e?.(n),l({type:"cypress_step_finalize",data:n})},Gr=(t,e)=>{let r=x(),s=r.at(r.findLastIndex(_)+1);s&&H(n=>Object.is(n,s),t,e)},zr=(t,e)=>{if(_(t)){let r=t.log.attributes.error;if(r)return t.error=r}return e&&(t.error=e),t.error},Ue=(t,e,r)=>{let s;for(let n of t)s=zr(n,s),Br(n,e,r);s&&Ge(s)},Ge=t=>x().forEach(e=>e.error=t),Br=(t,e,r)=>{ze(t,e,r),He(t)&&t.error&&L(t)};var xe=()=>J(new ft),gt=()=>Z(),ft=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=Re(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=u.PASSED,s){return cy.wrap(R,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve())).then(()=>(mt(r,s?S(s):void 0),Cypress.Promise.resolve()))}step(e,r){return cy.wrap(R,{log:!1}).then(()=>(lt(e),Cypress.Promise.resolve(r()))).then(s=>(mt(),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(){ne([])}#t(e){return l(e),Cypress.Promise.resolve()}#r(){let e=tt();return this.#e(),e}};var Te=()=>{l({type:"cypress_run_start",data:{}})},Ae=t=>{l({type:"cypress_suite_start",data:{id:t.id,name:t.title,root:t.root,start:Date.now()}})},Ee=t=>{l({type:"cypress_suite_end",data:{root:t.root,stop:Date.now()}})},rt=(t,e)=>{l({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()}})},j=t=>{dt(),l({type:"cypress_hook_end",data:{duration:t.duration??0}})},st=t=>{pe(t),l({type:"cypress_test_start",data:pt(t)}),ct(t)},U=(t,e)=>{l({type:"cypress_step_start",data:{id:t,name:e,start:Date.now()}})},ze=(t,e,r)=>{l({type:"cypress_step_stop",data:Me(t,e,r)})},be=()=>{l({type:"cypress_test_pass",data:{}})},nt=t=>{let e=v(t),r=S(t);N(e,r),l({type:"cypress_fail",data:{status:e,statusDetails:r}})},ot=(t,e)=>{let r=t.hookName.includes("each"),s=t.parent,n=Oe(t.title,r,e,s);j(t),Kr(),Wr(s,n)},Ce=t=>{P(t)?N(u.SKIPPED,{message:"The test was skipped before the command was completed"}):st(t),l({type:"cypress_test_skip",data:ut()})},at=t=>{dt(),l({type:"cypress_test_end",data:{duration:t.duration??0,retries:t._retries??0}}),ue()},Be=(t,e)=>{l({type:"attachment_path",data:{path:t,name:e,contentType:k.PNG}})},b=t=>{if(Le(t)){let e=t.test;return E(e)||j(e),Ke()}},yt=(t,e)=>{try{return nt(e),ot(t.test,e),Ke()}catch(r){Vr(t,r)}},ht=(t,e)=>{if(!yt(t,e)?.then(()=>{throw e}))throw e},it=()=>gt().flushAllureMessagesToTask("reportAllureCypressSpecMessages"),Ke=()=>gt().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages"),Kr=()=>{let t=ie();t&&at(t)},Wr=(t,e)=>{for(let r of we(t))P(r)||$r(r,r.pending?{...ut(),status:u.SKIPPED}:e)},$r=(t,e)=>{l({type:"cypress_skipped_test",data:{...pt(t),...e,..._e(t),suites:Fe(t).map(r=>r.id)}}),ct(t)},Vr=(t,e)=>{try{console.error(`Unexpected error when reporting the failure of ${t.test?.title??"'after all'"}`),console.error(e)}catch{}};var $e=()=>{let t=qr();Yr(t),Jr(t)},qr=()=>{let t=0;return{getSuiteDepth:()=>t,incrementSuiteDepth:()=>{t++},decrementSuiteDepth:()=>{t--}}},Yr=({incrementSuiteDepth:t,decrementSuiteDepth:e})=>{let r=o=>(a,p,i)=>{t();try{return Zr(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},Jr=({getSuiteDepth:t})=>{let e=globalThis.after,r=(s,n)=>typeof s=="string"?e(s,We(t,n)):e(We(t,s));globalThis.after=r},Zr=(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)},We=(t,e)=>{if(t()===0&&e){let r=e.length?Xr(e):Qr(e);return Object.defineProperty(r,"name",{value:e.name}),r}return e},Xr=t=>function(e){let r=s=>{if(s){yt(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)},Qr=t=>function(){let e,r;try{e=t.bind(this)()}catch(s){r=s}if(r)ht(this,r);else return D(e)?e.then(()=>b(this),s=>ht(this,s)):(b(this),e)};var Ve=t=>es(t)?qe(t):T(t,ts()),ts=()=>{let{stepsFromCommands:{maxArgumentDepth:t,maxArgumentLength:e}}=ce();return{maxDepth:t,maxLength:e,nonNullReplacerWithDomSupport:rs}},es=t=>typeof t=="object"&&t!==null&&Cypress.dom.isDom(t),qe=t=>Cypress.dom.stringify(t,"long"),rs=(t,e)=>{if(typeof e=="object"){if(e===null)return;if(Cypress.dom.isDom(e))return qe(e)}return e};var Ye=t=>{let{event:e,instrument:r}=t.attributes;return!(r!=="command"||e||os(t))},Je=(t,e)=>{let r=le();if(r&&_(r)){let{name:s,props:{name:n}}=r.log.attributes.consoleProps();s==="screenshot"&&n===t&&(r.attachmentName=e)}},Ze=t=>{let e=ms();typeof e<"u"&&ds(e.log,t)&&G(e.log.attributes.id),ss(t),U(t.attributes.id,as(t)),ns(t)},G=t=>H(({id:e})=>e===t),ss=t=>{let r={id:t.attributes.id,type:"log",log:t};I(r),L(r,s=>{s.parameters=is(t),r.attachmentName&&(s.name=r.attachmentName)})},ns=t=>{let{groupStart:e,end:r,id:s}=t.attributes;if(r)G(s);else if(e){let n=t.endGroup;t.endGroup=function(){return G(s),n.call(this)}}else{let n=t.end;t.end=function(){return G(s),n.call(this)}}},os=({attributes:{name:t,consoleProps:e}})=>t==="then"&&Object.is(e().props["Applied To"],R),as=t=>{let{name:e,message:r,displayName:s}=t.attributes,n=(s??e).trim(),o=(Xe(t)??us(t)??t.attributes.renderProps().message??r).trim();return[n,o].filter(Boolean).join(" ")},is=t=>cs(t).map(([e,r])=>({name:e.toString(),value:Ve(r)})).filter(fs(t)),ps=["Given","When","Then","And"],us=t=>{let{attributes:{name:e,message:r}}=t;if(ps.includes(e.trim())&&r.startsWith("**")&&r.endsWith("**"))return r.substring(2,r.length-2)},cs=t=>{let{attributes:{consoleProps:e}}=t,r=!!Xe(t),{props:s,name:n}=e();return["clearLocalStorage"].includes(n)?[]:Object.entries(s).filter(([o,a])=>ee(a)&&!(r&&o==="Message"))},Xe=t=>{if(ls(t)){let e=t.attributes.consoleProps().props.Message;if(e&&typeof e=="string")return e}},ls=({attributes:{name:t}})=>t==="assert",ms=()=>x().findLast(_),ds=(t,e)=>{let{groupStart:r,type:s}=t.attributes,{type:n}=e.attributes;return!r&&(s==="child"||n!=="child")},fs=t=>t.attributes.name==="wrap"?()=>!0:({name:e,value:r})=>e!=="Yielded"||r!=="{}";var Qe=()=>Cypress.on("fail",tr).on("log:added",ys),St=()=>Cypress.Screenshot.defaults({onAfterScreenshot:gs}),gs=(...[,{name:t,path:e}])=>{let r=t??Pe(e);Be(e,r),Je(t,r)},ys=(t,e)=>{Ye(e)&&Ze(e)},tr=t=>{if(Ne(t),hs())throw t},hs=()=>Object.is(Cypress.listeners("fail").at(-1),tr);var er=()=>{he(),Qe(),Se(),$e()};var rr=()=>{re()||(se(),er(),St())};rr();
2
2
  //# sourceMappingURL=index.js.map