allure-playwright 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/utils.js CHANGED
@@ -43,7 +43,7 @@ var isAfterHookStep = exports.isAfterHookStep = function isAfterHookStep(step) {
43
43
  var isBeforeHookStep = exports.isBeforeHookStep = function isBeforeHookStep(step) {
44
44
  return isDescendantOfStepWithTitle(step, BEFORE_HOOKS_ROOT_STEP_TITLE);
45
45
  };
46
- var diffEndRegexp = exports.diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/;
46
+ var diffEndRegexp = exports.diffEndRegexp = /-((expected)|(diff)|(actual))\.(png|webp)$/;
47
47
  var normalizeHookTitle = exports.normalizeHookTitle = function normalizeHookTitle(title) {
48
48
  return title.replace(/^[aA]ttach\s"(.+)"$/, "$1");
49
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_allureJsCommons","require","_sdk","_syncAnnotations","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","toPrimitive","call","TypeError","String","Number","AFTER_HOOKS_ROOT_STEP_TITLE","exports","BEFORE_HOOKS_ROOT_STEP_TITLE","statusToAllureStats","status","expectedStatus","Status","SKIPPED","BROKEN","PASSED","FAILED","isDescendantOfStepWithTitle","step","title","parent","isAfterHookStep","isBeforeHookStep","diffEndRegexp","normalizeHookTitle","replace","normalizeAttachStepTitle","match","trim","getSkipAnnotation","annotations","find","annotation","type","getStepStatusData","_step$annotations$fin","annotatedStatus","ALLURE_STEP_STATUS_ANNOTATION","isAllureStepStatus","description","undefined","statusDetails","error","getMessageAndTraceFromError","skipAnnotation","message","finalizeStepResult","stepResult","_getStepStatusData","nextStatus","stage","Stage","FINISHED"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { TestStatus } from \"@playwright/test\";\nimport type { TestStep } from \"@playwright/test/reporter\";\nimport { Stage, Status, type StatusDetails, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError } from \"allure-js-commons/sdk\";\n\nimport { ALLURE_STEP_STATUS_ANNOTATION, isAllureStepStatus } from \"./syncAnnotations.js\";\n\nexport const AFTER_HOOKS_ROOT_STEP_TITLE = \"After Hooks\";\n\nexport const BEFORE_HOOKS_ROOT_STEP_TITLE = \"Before Hooks\";\n\nexport const statusToAllureStats = (status: TestStatus, expectedStatus: TestStatus): Status => {\n if (status === \"skipped\") {\n return Status.SKIPPED;\n }\n\n if (status === \"timedOut\") {\n return Status.BROKEN;\n }\n\n if (status === expectedStatus) {\n return Status.PASSED;\n }\n\n return Status.FAILED;\n};\n\nexport const isDescendantOfStepWithTitle = (step: TestStep, title: string): boolean => {\n let parent = step.parent;\n\n while (parent) {\n if (parent.title === title) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n};\n\nexport const isAfterHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, AFTER_HOOKS_ROOT_STEP_TITLE);\n\nexport const isBeforeHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, BEFORE_HOOKS_ROOT_STEP_TITLE);\n\nexport const diffEndRegexp = /-((expected)|(diff)|(actual))\\.png$/;\n\nexport const normalizeHookTitle = (title: string) => {\n return title.replace(/^[aA]ttach\\s\"(.+)\"$/, \"$1\");\n};\n\nexport const normalizeAttachStepTitle = (title: string): string => {\n const match = title.match(/[\"'`]{1}(.+?)[\"'`]{1}/);\n if (match?.[1]) {\n return match[1];\n }\n return title.replace(/^(test\\.)?attach\\s*/i, \"\").trim();\n};\n\nexport const getSkipAnnotation = (step: Pick<TestStep, \"annotations\">) => {\n return step.annotations.find((annotation) => annotation.type === \"skip\");\n};\n\nexport const getStepStatusData = (\n step: Pick<TestStep, \"annotations\" | \"error\">,\n): {\n status: Status;\n statusDetails?: StatusDetails;\n} => {\n const annotatedStatus = step.annotations.find(\n (annotation) => annotation.type === ALLURE_STEP_STATUS_ANNOTATION && isAllureStepStatus(annotation.description),\n )?.description;\n\n if (annotatedStatus !== undefined) {\n return {\n status: annotatedStatus as Status,\n statusDetails: step.error ? { ...getMessageAndTraceFromError(step.error) } : undefined,\n };\n }\n\n if (step.error) {\n return {\n status: Status.FAILED,\n statusDetails: { ...getMessageAndTraceFromError(step.error) },\n };\n }\n\n const skipAnnotation = getSkipAnnotation(step);\n\n if (skipAnnotation) {\n return {\n status: Status.SKIPPED,\n statusDetails: skipAnnotation.description ? { message: skipAnnotation.description } : undefined,\n };\n }\n\n return {\n status: Status.PASSED,\n };\n};\n\nexport const finalizeStepResult = (stepResult: StepResult, step: Pick<TestStep, \"annotations\" | \"error\">) => {\n const { status: nextStatus, statusDetails } = getStepStatusData(step);\n\n stepResult.status = nextStatus;\n stepResult.stage = Stage.FINISHED;\n\n if (statusDetails) {\n // Preserve any previously collected fields and only overwrite values provided by the current step outcome.\n stepResult.statusDetails = { ...stepResult.statusDetails, ...statusDetails };\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAAyF,SAAAG,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAX,CAAA,GAAAS,MAA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AAU,CAACrC,MAAM,GAAGuC,UAAU;EAC9BF,UAAU,CAACG,KAAK,GAAGC,sBAAK,CAACC,QAAQ;EAEjC,IAAIX,aAAa,EAAE;IACjB;IACAM,UAAU,CAACN,aAAa,GAAAtD,aAAA,CAAAA,aAAA,KAAQ4D,UAAU,CAACN,aAAa,GAAKA,aAAa,CAAE;EAC9E;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["_allureJsCommons","require","_sdk","_syncAnnotations","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","toPrimitive","call","TypeError","String","Number","AFTER_HOOKS_ROOT_STEP_TITLE","exports","BEFORE_HOOKS_ROOT_STEP_TITLE","statusToAllureStats","status","expectedStatus","Status","SKIPPED","BROKEN","PASSED","FAILED","isDescendantOfStepWithTitle","step","title","parent","isAfterHookStep","isBeforeHookStep","diffEndRegexp","normalizeHookTitle","replace","normalizeAttachStepTitle","match","trim","getSkipAnnotation","annotations","find","annotation","type","getStepStatusData","_step$annotations$fin","annotatedStatus","ALLURE_STEP_STATUS_ANNOTATION","isAllureStepStatus","description","undefined","statusDetails","error","getMessageAndTraceFromError","skipAnnotation","message","finalizeStepResult","stepResult","_getStepStatusData","nextStatus","stage","Stage","FINISHED"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { TestStatus } from \"@playwright/test\";\nimport type { TestStep } from \"@playwright/test/reporter\";\nimport { Stage, Status, type StatusDetails, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError } from \"allure-js-commons/sdk\";\n\nimport { ALLURE_STEP_STATUS_ANNOTATION, isAllureStepStatus } from \"./syncAnnotations.js\";\n\nexport const AFTER_HOOKS_ROOT_STEP_TITLE = \"After Hooks\";\n\nexport const BEFORE_HOOKS_ROOT_STEP_TITLE = \"Before Hooks\";\n\nexport const statusToAllureStats = (status: TestStatus, expectedStatus: TestStatus): Status => {\n if (status === \"skipped\") {\n return Status.SKIPPED;\n }\n\n if (status === \"timedOut\") {\n return Status.BROKEN;\n }\n\n if (status === expectedStatus) {\n return Status.PASSED;\n }\n\n return Status.FAILED;\n};\n\nexport const isDescendantOfStepWithTitle = (step: TestStep, title: string): boolean => {\n let parent = step.parent;\n\n while (parent) {\n if (parent.title === title) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n};\n\nexport const isAfterHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, AFTER_HOOKS_ROOT_STEP_TITLE);\n\nexport const isBeforeHookStep = (step: TestStep) => isDescendantOfStepWithTitle(step, BEFORE_HOOKS_ROOT_STEP_TITLE);\n\nexport const diffEndRegexp = /-((expected)|(diff)|(actual))\\.(png|webp)$/;\n\nexport const normalizeHookTitle = (title: string) => {\n return title.replace(/^[aA]ttach\\s\"(.+)\"$/, \"$1\");\n};\n\nexport const normalizeAttachStepTitle = (title: string): string => {\n const match = title.match(/[\"'`]{1}(.+?)[\"'`]{1}/);\n if (match?.[1]) {\n return match[1];\n }\n return title.replace(/^(test\\.)?attach\\s*/i, \"\").trim();\n};\n\nexport const getSkipAnnotation = (step: Pick<TestStep, \"annotations\">) => {\n return step.annotations.find((annotation) => annotation.type === \"skip\");\n};\n\nexport const getStepStatusData = (\n step: Pick<TestStep, \"annotations\" | \"error\">,\n): {\n status: Status;\n statusDetails?: StatusDetails;\n} => {\n const annotatedStatus = step.annotations.find(\n (annotation) => annotation.type === ALLURE_STEP_STATUS_ANNOTATION && isAllureStepStatus(annotation.description),\n )?.description;\n\n if (annotatedStatus !== undefined) {\n return {\n status: annotatedStatus as Status,\n statusDetails: step.error ? { ...getMessageAndTraceFromError(step.error) } : undefined,\n };\n }\n\n if (step.error) {\n return {\n status: Status.FAILED,\n statusDetails: { ...getMessageAndTraceFromError(step.error) },\n };\n }\n\n const skipAnnotation = getSkipAnnotation(step);\n\n if (skipAnnotation) {\n return {\n status: Status.SKIPPED,\n statusDetails: skipAnnotation.description ? { message: skipAnnotation.description } : undefined,\n };\n }\n\n return {\n status: Status.PASSED,\n };\n};\n\nexport const finalizeStepResult = (stepResult: StepResult, step: Pick<TestStep, \"annotations\" | \"error\">) => {\n const { status: nextStatus, statusDetails } = getStepStatusData(step);\n\n stepResult.status = nextStatus;\n stepResult.stage = Stage.FINISHED;\n\n if (statusDetails) {\n // Preserve any previously collected fields and only overwrite values provided by the current step outcome.\n stepResult.statusDetails = { ...stepResult.statusDetails, ...statusDetails };\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAAyF,SAAAG,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAX,CAAA,GAAAS,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAP,CAAA,GAAAA,CAAA,CAAAY,MAAA,WAAAL,CAAA,WAAAE,MAAA,CAAAI,wBAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAR,CAAA,YAAAQ,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAA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  /* eslint max-lines: off */
33
33
 
34
34
  import { ContentType, LabelName, LinkType, Stage, Status } from "allure-js-commons";
35
- import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, hasLabel, stripAnsi } from "allure-js-commons/sdk";
35
+ import { extractMetadataFromString, getMessageAndTraceFromError, getMetadataLabel, getStatusFromError, hasLabel, stripAnsi, toGlobalErrorMessage } from "allure-js-commons/sdk";
36
36
  import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, ShallowStepsStack, createDefaultWriter, createStepResult, formatLink, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, includedInTestPlan, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, md5, parseTestPlan, randomUuid, readImageAsBase64 } from "allure-js-commons/sdk/reporter";
37
37
  import { allurePlaywrightLegacyApi } from "./legacy.js";
38
38
  import { AFTER_HOOKS_ROOT_STEP_TITLE, BEFORE_HOOKS_ROOT_STEP_TITLE, diffEndRegexp, finalizeStepResult, isAfterHookStep, isBeforeHookStep, isDescendantOfStepWithTitle, normalizeAttachStepTitle, normalizeHookTitle, statusToAllureStats } from "./utils.js";
@@ -960,7 +960,11 @@ export var AllureReporter = /*#__PURE__*/function () {
960
960
  return;
961
961
  }
962
962
  this.emittedHookGlobalErrorKeys.add(key);
963
- this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage(normalizeHookTitle(step.title), details)]);
963
+ this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage({
964
+ name: normalizeHookTitle(step.title),
965
+ details: details,
966
+ status: getStatusFromError(step.error)
967
+ })]);
964
968
  }
965
969
  }, {
966
970
  key: "addSkippedResults",
@@ -1211,8 +1215,8 @@ export var AllureReporter = /*#__PURE__*/function () {
1211
1215
  key: "processAttachment",
1212
1216
  value: function () {
1213
1217
  var _processAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(testUuid, attachmentStepUuid, attachment) {
1214
- var _replace;
1215
- var allureRuntimeMessage, message, parentUuid, contentType, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
1218
+ var _attachment$path$matc, _attachment$path, _replace;
1219
+ var allureRuntimeMessage, message, parentUuid, contentType, extMatch, ext, pathWithoutEndFromSnapshotDir, pathWithoutEnd, fileExists, readImageFromDirs, actualBase64, expectedBase64, diffBase64, diffName;
1216
1220
  return _regenerator().w(function (_context8) {
1217
1221
  while (1) switch (_context8.n) {
1218
1222
  case 0:
@@ -1272,8 +1276,10 @@ export var AllureReporter = /*#__PURE__*/function () {
1272
1276
  }
1273
1277
  return _context8.a(2);
1274
1278
  case 7:
1275
- pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.png/, "");
1276
- pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.png/, "");
1279
+ extMatch = (_attachment$path$matc = (_attachment$path = attachment.path) === null || _attachment$path === void 0 ? void 0 : _attachment$path.match(/\.(png|webp)$/)) !== null && _attachment$path$matc !== void 0 ? _attachment$path$matc : attachment.name.match(/\.(png|webp)$/);
1280
+ ext = extMatch ? extMatch[0] : ".png";
1281
+ pathWithoutEndFromSnapshotDir = (_replace = attachment.path.replace(this.outputDir, this.snapshotDir)) === null || _replace === void 0 ? void 0 : _replace.replace(diffEndRegexp, "").replace(/\.(png|webp)$/, "");
1282
+ pathWithoutEnd = attachment.path.replace(diffEndRegexp, "").replace(/\.(png|webp)$/, "");
1277
1283
  if (!(this.processedDiffs.includes(pathWithoutEnd) || this.processedDiffs.includes(pathWithoutEndFromSnapshotDir))) {
1278
1284
  _context8.n = 8;
1279
1285
  break;
@@ -1306,8 +1312,8 @@ export var AllureReporter = /*#__PURE__*/function () {
1306
1312
  return _regenerator().w(function (_context7) {
1307
1313
  while (1) switch (_context7.n) {
1308
1314
  case 0:
1309
- defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier, ".png");
1310
- snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier, ".png");
1315
+ defaultPath = "".concat(pathWithoutEnd, "-").concat(modifier).concat(ext);
1316
+ snapshotPath = "".concat(pathWithoutEndFromSnapshotDir, "-").concat(modifier).concat(ext);
1311
1317
  _context7.n = 1;
1312
1318
  return fileExists(defaultPath);
1313
1319
  case 1:
@@ -1422,14 +1428,6 @@ export var allure = allurePlaywrightLegacyApi;
1422
1428
  * @deprecated for removal, import functions directly from "@playwright/test".
1423
1429
  */
1424
1430
  export { test, expect } from "@playwright/test";
1425
- var toGlobalErrorMessage = function toGlobalErrorMessage(name, details) {
1426
- return {
1427
- type: "global_error",
1428
- data: _objectSpread(_objectSpread({}, details), {}, {
1429
- message: details.message ? "".concat(name, " failed: ").concat(details.message) : "".concat(name, " failed")
1430
- })
1431
- };
1432
- };
1433
1431
  var isDirectHookStep = function isDirectHookStep(step) {
1434
1432
  var _step$parent, _step$parent2;
1435
1433
  return (((_step$parent = step.parent) === null || _step$parent === void 0 ? void 0 : _step$parent.title) === BEFORE_HOOKS_ROOT_STEP_TITLE || ((_step$parent2 = step.parent) === null || _step$parent2 === void 0 ? void 0 : _step$parent2.title) === AFTER_HOOKS_ROOT_STEP_TITLE) && step.category === "hook";