@azure/playwright 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/browser/common/constants.d.ts +2 -4
  2. package/dist/browser/common/constants.d.ts.map +1 -1
  3. package/dist/browser/common/constants.js +2 -4
  4. package/dist/browser/common/constants.js.map +1 -1
  5. package/dist/browser/common/entraIdAccessToken.d.ts +6 -0
  6. package/dist/browser/common/entraIdAccessToken.d.ts.map +1 -1
  7. package/dist/browser/common/entraIdAccessToken.js +24 -0
  8. package/dist/browser/common/entraIdAccessToken.js.map +1 -1
  9. package/dist/browser/common/types.d.ts +0 -4
  10. package/dist/browser/common/types.d.ts.map +1 -1
  11. package/dist/browser/common/types.js.map +1 -1
  12. package/dist/browser/core/playwrightServiceEntra.d.ts.map +1 -1
  13. package/dist/browser/core/playwrightServiceEntra.js +1 -0
  14. package/dist/browser/core/playwrightServiceEntra.js.map +1 -1
  15. package/dist/browser/reporter/playwrightReporter.d.ts +0 -1
  16. package/dist/browser/reporter/playwrightReporter.d.ts.map +1 -1
  17. package/dist/browser/reporter/playwrightReporter.js +3 -17
  18. package/dist/browser/reporter/playwrightReporter.js.map +1 -1
  19. package/dist/browser/utils/PlaywrightServiceClient.d.ts +1 -2
  20. package/dist/browser/utils/PlaywrightServiceClient.d.ts.map +1 -1
  21. package/dist/browser/utils/PlaywrightServiceClient.js +1 -26
  22. package/dist/browser/utils/PlaywrightServiceClient.js.map +1 -1
  23. package/dist/browser/utils/utils.d.ts +2 -3
  24. package/dist/browser/utils/utils.d.ts.map +1 -1
  25. package/dist/browser/utils/utils.js +8 -21
  26. package/dist/browser/utils/utils.js.map +1 -1
  27. package/dist/commonjs/common/constants.d.ts +2 -4
  28. package/dist/commonjs/common/constants.d.ts.map +1 -1
  29. package/dist/commonjs/common/constants.js +3 -5
  30. package/dist/commonjs/common/constants.js.map +1 -1
  31. package/dist/commonjs/common/entraIdAccessToken.d.ts +6 -0
  32. package/dist/commonjs/common/entraIdAccessToken.d.ts.map +1 -1
  33. package/dist/commonjs/common/entraIdAccessToken.js +24 -0
  34. package/dist/commonjs/common/entraIdAccessToken.js.map +1 -1
  35. package/dist/commonjs/common/types.d.ts +0 -4
  36. package/dist/commonjs/common/types.d.ts.map +1 -1
  37. package/dist/commonjs/common/types.js.map +1 -1
  38. package/dist/commonjs/core/playwrightServiceEntra.d.ts.map +1 -1
  39. package/dist/commonjs/core/playwrightServiceEntra.js +1 -0
  40. package/dist/commonjs/core/playwrightServiceEntra.js.map +1 -1
  41. package/dist/commonjs/reporter/playwrightReporter.d.ts +0 -1
  42. package/dist/commonjs/reporter/playwrightReporter.d.ts.map +1 -1
  43. package/dist/commonjs/reporter/playwrightReporter.js +2 -16
  44. package/dist/commonjs/reporter/playwrightReporter.js.map +1 -1
  45. package/dist/commonjs/tsdoc-metadata.json +1 -1
  46. package/dist/commonjs/utils/PlaywrightServiceClient.d.ts +1 -2
  47. package/dist/commonjs/utils/PlaywrightServiceClient.d.ts.map +1 -1
  48. package/dist/commonjs/utils/PlaywrightServiceClient.js +0 -25
  49. package/dist/commonjs/utils/PlaywrightServiceClient.js.map +1 -1
  50. package/dist/commonjs/utils/utils.d.ts +2 -3
  51. package/dist/commonjs/utils/utils.d.ts.map +1 -1
  52. package/dist/commonjs/utils/utils.js +8 -22
  53. package/dist/commonjs/utils/utils.js.map +1 -1
  54. package/dist/esm/common/constants.d.ts +2 -4
  55. package/dist/esm/common/constants.d.ts.map +1 -1
  56. package/dist/esm/common/constants.js +93 -96
  57. package/dist/esm/common/constants.js.map +1 -7
  58. package/dist/esm/common/customerConfig.js +11 -11
  59. package/dist/esm/common/customerConfig.js.map +1 -7
  60. package/dist/esm/common/entraIdAccessToken.d.ts +6 -0
  61. package/dist/esm/common/entraIdAccessToken.d.ts.map +1 -1
  62. package/dist/esm/common/entraIdAccessToken.js +101 -85
  63. package/dist/esm/common/entraIdAccessToken.js.map +1 -7
  64. package/dist/esm/common/environmentVariables.js +19 -19
  65. package/dist/esm/common/environmentVariables.js.map +1 -7
  66. package/dist/esm/common/executor.js +58 -51
  67. package/dist/esm/common/executor.js.map +1 -7
  68. package/dist/esm/common/httpService.js +29 -34
  69. package/dist/esm/common/httpService.js.map +1 -7
  70. package/dist/esm/common/logger.js +4 -4
  71. package/dist/esm/common/logger.js.map +1 -7
  72. package/dist/esm/common/messages.js +166 -166
  73. package/dist/esm/common/messages.js.map +1 -7
  74. package/dist/esm/common/playwrightServiceConfig.js +91 -91
  75. package/dist/esm/common/playwrightServiceConfig.js.map +1 -7
  76. package/dist/esm/common/state.js +7 -7
  77. package/dist/esm/common/state.js.map +1 -7
  78. package/dist/esm/common/types.d.ts +0 -4
  79. package/dist/esm/common/types.d.ts.map +1 -1
  80. package/dist/esm/common/types.js +4 -0
  81. package/dist/esm/common/types.js.map +1 -7
  82. package/dist/esm/core/global/playwright-service-global-setup.js +17 -17
  83. package/dist/esm/core/global/playwright-service-global-setup.js.map +1 -7
  84. package/dist/esm/core/global/playwright-service-global-teardown.js +13 -16
  85. package/dist/esm/core/global/playwright-service-global-teardown.js.map +1 -7
  86. package/dist/esm/core/initializePlaywrightServiceTestRun.js +21 -13
  87. package/dist/esm/core/initializePlaywrightServiceTestRun.js.map +1 -7
  88. package/dist/esm/core/playwrightService.js +200 -149
  89. package/dist/esm/core/playwrightService.js.map +1 -7
  90. package/dist/esm/core/playwrightServiceEntra.d.ts.map +1 -1
  91. package/dist/esm/core/playwrightServiceEntra.js +43 -44
  92. package/dist/esm/core/playwrightServiceEntra.js.map +1 -7
  93. package/dist/esm/core/playwrightServiceUtils.js +8 -6
  94. package/dist/esm/core/playwrightServiceUtils.js.map +1 -7
  95. package/dist/esm/index.js +9 -7
  96. package/dist/esm/index.js.map +1 -7
  97. package/dist/esm/reporter/index.js +11 -4
  98. package/dist/esm/reporter/index.js.map +1 -7
  99. package/dist/esm/reporter/playwrightReporter.d.ts +0 -1
  100. package/dist/esm/reporter/playwrightReporter.d.ts.map +1 -1
  101. package/dist/esm/reporter/playwrightReporter.js +193 -202
  102. package/dist/esm/reporter/playwrightReporter.js.map +1 -7
  103. package/dist/esm/utils/PlaywrightServiceClient.d.ts +1 -2
  104. package/dist/esm/utils/PlaywrightServiceClient.d.ts.map +1 -1
  105. package/dist/esm/utils/PlaywrightServiceClient.js +61 -121
  106. package/dist/esm/utils/PlaywrightServiceClient.js.map +1 -7
  107. package/dist/esm/utils/cIInfoProvider.js +71 -58
  108. package/dist/esm/utils/cIInfoProvider.js.map +1 -7
  109. package/dist/esm/utils/getPackageVersion.js +17 -12
  110. package/dist/esm/utils/getPackageVersion.js.map +1 -7
  111. package/dist/esm/utils/getPlaywrightVersion.js +13 -15
  112. package/dist/esm/utils/getPlaywrightVersion.js.map +1 -7
  113. package/dist/esm/utils/packageManager.js +37 -37
  114. package/dist/esm/utils/packageManager.js.map +1 -7
  115. package/dist/esm/utils/parseJwt.js +14 -15
  116. package/dist/esm/utils/parseJwt.js.map +1 -7
  117. package/dist/esm/utils/playwrightReporterStorageManager.js +333 -358
  118. package/dist/esm/utils/playwrightReporterStorageManager.js.map +1 -7
  119. package/dist/esm/utils/utils.d.ts +2 -3
  120. package/dist/esm/utils/utils.d.ts.map +1 -1
  121. package/dist/esm/utils/utils.js +338 -380
  122. package/dist/esm/utils/utils.js.map +1 -7
  123. package/dist/react-native/common/constants.d.ts +2 -4
  124. package/dist/react-native/common/constants.d.ts.map +1 -1
  125. package/dist/react-native/common/constants.js +2 -4
  126. package/dist/react-native/common/constants.js.map +1 -1
  127. package/dist/react-native/common/entraIdAccessToken.d.ts +6 -0
  128. package/dist/react-native/common/entraIdAccessToken.d.ts.map +1 -1
  129. package/dist/react-native/common/entraIdAccessToken.js +24 -0
  130. package/dist/react-native/common/entraIdAccessToken.js.map +1 -1
  131. package/dist/react-native/common/types.d.ts +0 -4
  132. package/dist/react-native/common/types.d.ts.map +1 -1
  133. package/dist/react-native/common/types.js.map +1 -1
  134. package/dist/react-native/core/playwrightServiceEntra.d.ts.map +1 -1
  135. package/dist/react-native/core/playwrightServiceEntra.js +1 -0
  136. package/dist/react-native/core/playwrightServiceEntra.js.map +1 -1
  137. package/dist/react-native/reporter/playwrightReporter.d.ts +0 -1
  138. package/dist/react-native/reporter/playwrightReporter.d.ts.map +1 -1
  139. package/dist/react-native/reporter/playwrightReporter.js +3 -17
  140. package/dist/react-native/reporter/playwrightReporter.js.map +1 -1
  141. package/dist/react-native/utils/PlaywrightServiceClient.d.ts +1 -2
  142. package/dist/react-native/utils/PlaywrightServiceClient.d.ts.map +1 -1
  143. package/dist/react-native/utils/PlaywrightServiceClient.js +1 -26
  144. package/dist/react-native/utils/PlaywrightServiceClient.js.map +1 -1
  145. package/dist/react-native/utils/utils.d.ts +2 -3
  146. package/dist/react-native/utils/utils.d.ts.map +1 -1
  147. package/dist/react-native/utils/utils.js +8 -21
  148. package/dist/react-native/utils/utils.js.map +1 -1
  149. package/package.json +6 -6
@@ -1,66 +1,73 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
1
3
  import { basename } from "node:path";
2
4
  import fs from "node:fs";
3
5
  import url from "url";
4
6
  import path from "node:path";
5
7
  import { ServiceErrorMessageConstants } from "./messages.js";
6
8
  const getPackageJsonPath = (folderPath) => {
7
- const packageJsonPath = path.join(folderPath, "package.json");
8
- if (fs.existsSync(packageJsonPath)) {
9
- return packageJsonPath;
10
- }
11
- const parentFolder = path.dirname(folderPath);
12
- if (folderPath === parentFolder) {
13
- return "";
14
- }
15
- const result = getPackageJsonPath(parentFolder);
16
- return result;
9
+ const packageJsonPath = path.join(folderPath, "package.json");
10
+ if (fs.existsSync(packageJsonPath)) {
11
+ return packageJsonPath;
12
+ }
13
+ const parentFolder = path.dirname(folderPath);
14
+ if (folderPath === parentFolder) {
15
+ return "";
16
+ }
17
+ const result = getPackageJsonPath(parentFolder);
18
+ return result;
17
19
  };
18
20
  const folderIsModule = (folder) => {
19
- const packageJsonPath = getPackageJsonPath(folder);
20
- if (!packageJsonPath) return false;
21
- return require(packageJsonPath).type === "module";
21
+ const packageJsonPath = getPackageJsonPath(folder);
22
+ if (!packageJsonPath)
23
+ return false;
24
+ // Rely on `require` internal caching logic.
25
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
26
+ return require(packageJsonPath).type === "module";
22
27
  };
23
- const fileIsModule = (file2) => {
24
- if (file2.endsWith(".mjs") || file2.endsWith(".mts")) return true;
25
- if (file2.endsWith(".cjs") || file2.endsWith(".cts")) return false;
26
- const folder = path.dirname(file2);
27
- return folderIsModule(folder);
28
+ const fileIsModule = (file) => {
29
+ if (file.endsWith(".mjs") || file.endsWith(".mts"))
30
+ return true;
31
+ if (file.endsWith(".cjs") || file.endsWith(".cts"))
32
+ return false;
33
+ const folder = path.dirname(file);
34
+ return folderIsModule(folder);
28
35
  };
29
36
  const resolveFile = (id, rootDir) => {
30
- if (!id) {
31
- return void 0;
32
- }
33
- const localPath = path.resolve(rootDir, id);
34
- if (fs.existsSync(localPath)) {
35
- return localPath;
36
- }
37
- return require.resolve(id, { paths: [rootDir] });
37
+ if (!id) {
38
+ return undefined;
39
+ }
40
+ const localPath = path.resolve(rootDir, id);
41
+ if (fs.existsSync(localPath)) {
42
+ return localPath;
43
+ }
44
+ return require.resolve(id, { paths: [rootDir] });
38
45
  };
39
46
  const requireOrImportDefaultFunction = async (file) => {
40
- const fileName = basename(file);
41
- const isModule = fileIsModule(file);
42
- let func;
43
- if (isModule) func = await eval(`import(${JSON.stringify(url.pathToFileURL(file))})`);
44
- else func = require(file);
45
- if (func && typeof func === "object" && "default" in func) {
46
- func = func.default;
47
- }
48
- if (typeof func !== "function") {
49
- const error = new Error(
50
- `${fileName}: ${ServiceErrorMessageConstants.INVALID_GLOBAL_FUNCTION.message}`
51
- );
52
- error.stack = "";
53
- throw error;
54
- }
55
- return func;
47
+ const fileName = basename(file);
48
+ const isModule = fileIsModule(file);
49
+ let func;
50
+ if (isModule)
51
+ func = await eval(`import(${JSON.stringify(url.pathToFileURL(file))})`);
52
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
53
+ else
54
+ func = require(file);
55
+ if (func && typeof func === "object" && "default" in func) {
56
+ func = func.default;
57
+ }
58
+ if (typeof func !== "function") {
59
+ // match playwright's error style
60
+ const error = new Error(`${fileName}: ${ServiceErrorMessageConstants.INVALID_GLOBAL_FUNCTION.message}`);
61
+ error.stack = "";
62
+ throw error;
63
+ }
64
+ return func;
56
65
  };
57
- const loadCustomerGlobalFunction = (rootDir, customerFunctionFileName) => {
58
- if (!customerFunctionFileName) {
59
- return null;
60
- }
61
- const file2 = path.resolve(rootDir, resolveFile(customerFunctionFileName, rootDir) ?? "");
62
- return requireOrImportDefaultFunction(file2);
63
- };
64
- export {
65
- loadCustomerGlobalFunction
66
+ export const loadCustomerGlobalFunction = (rootDir, customerFunctionFileName) => {
67
+ if (!customerFunctionFileName) {
68
+ return null;
69
+ }
70
+ const file = path.resolve(rootDir, resolveFile(customerFunctionFileName, rootDir) ?? "");
71
+ return requireOrImportDefaultFunction(file);
66
72
  };
73
+ //# sourceMappingURL=executor.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["/mnt/vss/_work/1/s/sdk/loadtesting/playwright/src/common/executor.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { basename } from \"node:path\";\nimport fs from \"node:fs\";\nimport url from \"url\";\nimport path from \"node:path\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nconst getPackageJsonPath = (folderPath: string): string => {\n const packageJsonPath = path.join(folderPath, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n\n const parentFolder = path.dirname(folderPath);\n if (folderPath === parentFolder) {\n return \"\";\n }\n\n const result = getPackageJsonPath(parentFolder);\n return result;\n};\n\nconst folderIsModule = (folder: string): boolean => {\n const packageJsonPath = getPackageJsonPath(folder);\n if (!packageJsonPath) return false;\n // Rely on `require` internal caching logic.\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(packageJsonPath).type === \"module\";\n};\n\nconst fileIsModule = (file: string): boolean => {\n if (file.endsWith(\".mjs\") || file.endsWith(\".mts\")) return true;\n if (file.endsWith(\".cjs\") || file.endsWith(\".cts\")) return false;\n const folder = path.dirname(file);\n return folderIsModule(folder);\n};\n\nconst resolveFile = (id: string | undefined, rootDir: string): string | undefined => {\n if (!id) {\n return undefined;\n }\n const localPath = path.resolve(rootDir, id);\n if (fs.existsSync(localPath)) {\n return localPath;\n }\n return require.resolve(id, { paths: [rootDir] });\n};\n\nconst requireOrImportDefaultFunction = async (file: string): Promise<any> => {\n const fileName = basename(file);\n const isModule = fileIsModule(file);\n let func: any;\n if (isModule) func = await eval(`import(${JSON.stringify(url.pathToFileURL(file))})`);\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n else func = require(file);\n if (func && typeof func === \"object\" && \"default\" in func) {\n func = func.default;\n }\n if (typeof func !== \"function\") {\n // match playwright's error style\n const error = new Error(\n `${fileName}: ${ServiceErrorMessageConstants.INVALID_GLOBAL_FUNCTION.message}`,\n );\n error.stack = \"\";\n throw error;\n }\n return func;\n};\n\nexport const loadCustomerGlobalFunction = (\n rootDir: string,\n customerFunctionFileName?: string,\n): any => {\n if (!customerFunctionFileName) {\n return null;\n }\n const file = path.resolve(rootDir, resolveFile(customerFunctionFileName, rootDir) ?? \"\");\n return requireOrImportDefaultFunction(file);\n};\n"],
5
- "mappings": "AAGA,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAS,oCAAoC;AAE7C,MAAM,qBAAqB,CAAC,eAA+B;AACzD,QAAM,kBAAkB,KAAK,KAAK,YAAY,cAAc;AAC5D,MAAI,GAAG,WAAW,eAAe,GAAG;AAClC,WAAO;AAAA,EACT;AAEA,QAAM,eAAe,KAAK,QAAQ,UAAU;AAC5C,MAAI,eAAe,cAAc;AAC/B,WAAO;AA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;IAC1B,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QAC1D,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,iCAAiC;QACjC,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,GAAG,QAAQ,KAAK,4BAA4B,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAC/E,CAAC;QACF,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,OAAe,EACf,wBAAiC,EAC5B,EAAE;IACP,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACzF,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { basename } from \"node:path\";\nimport fs from \"node:fs\";\nimport url from \"url\";\nimport path from \"node:path\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nconst getPackageJsonPath = (folderPath: string): string => {\n const packageJsonPath = path.join(folderPath, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n return packageJsonPath;\n }\n\n const parentFolder = path.dirname(folderPath);\n if (folderPath === parentFolder) {\n return \"\";\n }\n\n const result = getPackageJsonPath(parentFolder);\n return result;\n};\n\nconst folderIsModule = (folder: string): boolean => {\n const packageJsonPath = getPackageJsonPath(folder);\n if (!packageJsonPath) return false;\n // Rely on `require` internal caching logic.\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(packageJsonPath).type === \"module\";\n};\n\nconst fileIsModule = (file: string): boolean => {\n if (file.endsWith(\".mjs\") || file.endsWith(\".mts\")) return true;\n if (file.endsWith(\".cjs\") || file.endsWith(\".cts\")) return false;\n const folder = path.dirname(file);\n return folderIsModule(folder);\n};\n\nconst resolveFile = (id: string | undefined, rootDir: string): string | undefined => {\n if (!id) {\n return undefined;\n }\n const localPath = path.resolve(rootDir, id);\n if (fs.existsSync(localPath)) {\n return localPath;\n }\n return require.resolve(id, { paths: [rootDir] });\n};\n\nconst requireOrImportDefaultFunction = async (file: string): Promise<any> => {\n const fileName = basename(file);\n const isModule = fileIsModule(file);\n let func: any;\n if (isModule) func = await eval(`import(${JSON.stringify(url.pathToFileURL(file))})`);\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n else func = require(file);\n if (func && typeof func === \"object\" && \"default\" in func) {\n func = func.default;\n }\n if (typeof func !== \"function\") {\n // match playwright's error style\n const error = new Error(\n `${fileName}: ${ServiceErrorMessageConstants.INVALID_GLOBAL_FUNCTION.message}`,\n );\n error.stack = \"\";\n throw error;\n }\n return func;\n};\n\nexport const loadCustomerGlobalFunction = (\n rootDir: string,\n customerFunctionFileName?: string,\n): any => {\n if (!customerFunctionFileName) {\n return null;\n }\n const file = path.resolve(rootDir, resolveFile(customerFunctionFileName, rootDir) ?? \"\");\n return requireOrImportDefaultFunction(file);\n};\n"]}
@@ -1,39 +1,34 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
1
3
  import { randomUUID } from "crypto";
2
- import {
3
- createDefaultHttpClient,
4
- createHttpHeaders,
5
- createPipelineRequest,
6
- createPipelineFromOptions
7
- } from "@azure/core-rest-pipeline";
4
+ import { createDefaultHttpClient, createHttpHeaders, createPipelineRequest, createPipelineFromOptions, } from "@azure/core-rest-pipeline";
8
5
  import { coreLogger } from "../common/logger.js";
9
6
  import { Constants } from "./constants.js";
10
- class HttpService {
11
- async callAPI(method, url, data, token, contentType, correlationId) {
12
- const pipeline = createPipelineFromOptions({
13
- loggingOptions: {
14
- logger: coreLogger.info
15
- },
16
- retryOptions: {}
17
- });
18
- const httpClient = createDefaultHttpClient();
19
- const request = createPipelineRequest({
20
- url,
21
- method,
22
- headers: createHttpHeaders({
23
- "Content-Type": contentType,
24
- Accept: "*/*",
25
- Authorization: `Bearer ${token}`,
26
- "x-ms-client-request-id": `${randomUUID()}`,
27
- "x-correlation-id": correlationId
28
- }),
29
- timeout: Constants.HTTP_CALL_TIMEOUT
30
- });
31
- if (data) {
32
- request.body = data;
7
+ export class HttpService {
8
+ async callAPI(method, url, data, token, contentType, correlationId) {
9
+ const pipeline = createPipelineFromOptions({
10
+ loggingOptions: {
11
+ logger: coreLogger.info,
12
+ },
13
+ retryOptions: {},
14
+ });
15
+ const httpClient = createDefaultHttpClient();
16
+ const request = createPipelineRequest({
17
+ url,
18
+ method,
19
+ headers: createHttpHeaders({
20
+ "Content-Type": contentType,
21
+ Accept: "*/*",
22
+ Authorization: `Bearer ${token}`,
23
+ "x-ms-client-request-id": `${randomUUID()}`,
24
+ "x-correlation-id": correlationId,
25
+ }),
26
+ timeout: Constants.HTTP_CALL_TIMEOUT,
27
+ });
28
+ if (data) {
29
+ request.body = data;
30
+ }
31
+ return pipeline.sendRequest(httpClient, request);
33
32
  }
34
- return pipeline.sendRequest(httpClient, request);
35
- }
36
33
  }
37
- export {
38
- HttpService
39
- };
34
+ //# sourceMappingURL=httpService.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["/mnt/vss/_work/1/s/sdk/loadtesting/playwright/src/common/httpService.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { randomUUID } from \"crypto\";\nimport type { PipelineResponse, HttpMethods } from \"@azure/core-rest-pipeline\";\nimport {\n createDefaultHttpClient,\n createHttpHeaders,\n createPipelineRequest,\n createPipelineFromOptions,\n} from \"@azure/core-rest-pipeline\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { Constants } from \"./constants.js\";\n\nexport class HttpService {\n public async callAPI(\n method: HttpMethods,\n url: string,\n data: any | null,\n token: string,\n contentType: string,\n correlationId: string,\n ): Promise<PipelineResponse> {\n const pipeline = createPipelineFromOptions({\n loggingOptions: {\n logger: coreLogger.info,\n },\n retryOptions: {},\n });\n\n const httpClient = createDefaultHttpClient();\n const request = createPipelineRequest({\n url,\n method,\n headers: createHttpHeaders({\n \"Content-Type\": contentType,\n Accept: \"*/*\",\n Authorization: `Bearer ${token}`,\n \"x-ms-client-request-id\": `${randomUUID()}`,\n \"x-correlation-id\": correlationId,\n }),\n timeout: Constants.HTTP_CALL_TIMEOUT,\n });\n\n if (data) {\n request.body = data;\n }\n return pipeline.sendRequest(httpClient, request);\n }\n}\n"],
5
- "mappings": "AAGA,SAAS,kBAAkB;AAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAEnB,MAAM,YAAY;AAAA,EACvB,MAAa,QACX,QACA,KACA,MACA,OACA,aACA,eAC2B;AAC3B,UAAM,WAAW,0BAA0B;AAAA,MACzC,gBAAgB;AAAA,QACd,QAAQ,WAAW;AAAA,MACrB;AAAA,MACA,cAAc,CAAC;AAAA,IACjB,CAAC;AAED,UAAM,aAAa,wBAAwB;AAC3C,UAAM,UAAU,sBAAsB;AAAA,MACpC;AAAA,MACA;AAAA,MACA,SAAS,kBAAkB;AAAA,QACzB,gBAAgB;AAAA,QAChB,QAAQ;AAAA,QACR,eAAe,UAAU,KAAK;AAAA,QAC9B,0BAA0B,GAAG,WAAW,CAAC;AAAA,QACzC,oBAAoB;AAAA,MACtB,CAAC;AAAA,MACD,SAAS,UAAU;AAAA,IACrB,CAAC;AAED,QAAI,MAAM;AACR,cAAQ,OAAO;AAAA,IACjB;AACA,WAAO,SAAS,YAAY,YAAY,OAAO;AAAA,EACjD;AACF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"httpService.js","sourceRoot":"","sources":["../../../src/common/httpService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,WAAW;IACf,KAAK,CAAC,OAAO,CAClB,MAAmB,EACnB,GAAW,EACX,IAAgB,EAChB,KAAa,EACb,WAAmB,EACnB,aAAqB;QAErB,MAAM,QAAQ,GAAG,yBAAyB,CAAC;YACzC,cAAc,EAAE;gBACd,MAAM,EAAE,UAAU,CAAC,IAAI;aACxB;YACD,YAAY,EAAE,EAAE;SACjB,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,uBAAuB,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,qBAAqB,CAAC;YACpC,GAAG;YACH,MAAM;YACN,OAAO,EAAE,iBAAiB,CAAC;gBACzB,cAAc,EAAE,WAAW;gBAC3B,MAAM,EAAE,KAAK;gBACb,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,wBAAwB,EAAE,GAAG,UAAU,EAAE,EAAE;gBAC3C,kBAAkB,EAAE,aAAa;aAClC,CAAC;YACF,OAAO,EAAE,SAAS,CAAC,iBAAiB;SACrC,CAAC,CAAC;QAEH,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { randomUUID } from \"crypto\";\nimport type { PipelineResponse, HttpMethods } from \"@azure/core-rest-pipeline\";\nimport {\n createDefaultHttpClient,\n createHttpHeaders,\n createPipelineRequest,\n createPipelineFromOptions,\n} from \"@azure/core-rest-pipeline\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { Constants } from \"./constants.js\";\n\nexport class HttpService {\n public async callAPI(\n method: HttpMethods,\n url: string,\n data: any | null,\n token: string,\n contentType: string,\n correlationId: string,\n ): Promise<PipelineResponse> {\n const pipeline = createPipelineFromOptions({\n loggingOptions: {\n logger: coreLogger.info,\n },\n retryOptions: {},\n });\n\n const httpClient = createDefaultHttpClient();\n const request = createPipelineRequest({\n url,\n method,\n headers: createHttpHeaders({\n \"Content-Type\": contentType,\n Accept: \"*/*\",\n Authorization: `Bearer ${token}`,\n \"x-ms-client-request-id\": `${randomUUID()}`,\n \"x-correlation-id\": correlationId,\n }),\n timeout: Constants.HTTP_CALL_TIMEOUT,\n });\n\n if (data) {\n request.body = data;\n }\n return pipeline.sendRequest(httpClient, request);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
1
3
  import { createClientLogger } from "@azure/logger";
2
- const coreLogger = createClientLogger("playwright");
3
- export {
4
- coreLogger
5
- };
4
+ export const coreLogger = createClientLogger("playwright");
5
+ //# sourceMappingURL=logger.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["/mnt/vss/_work/1/s/sdk/loadtesting/playwright/src/common/logger.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\nexport const coreLogger = createClientLogger(\"playwright\");\n"],
5
- "mappings": "AAGA,SAAS,0BAA0B;AAE5B,MAAM,aAAa,mBAAmB,YAAY;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/common/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\nexport const coreLogger = createClientLogger(\"playwright\");\n"]}
@@ -1,167 +1,167 @@
1
- const ServiceErrorMessageConstants = {
2
- NO_SERVICE_URL_ERROR: {
3
- key: "NoServiceUrlError",
4
- message: "The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again."
5
- },
6
- INVALID_GLOBAL_FUNCTION: {
7
- key: "InvalidGlobalFunction",
8
- message: "File must export a single function."
9
- },
10
- INVALID_PLAYWRIGHT_VERSION_ERROR: {
11
- key: "InvalidPlaywrightVersionError",
12
- message: "The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions."
13
- },
14
- PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING: {
15
- key: "PlaywrightVersionTooOldForReporting",
16
- message: "To use the Playwright Workspaces reporting feature, you need Playwright version 1.57 or later installed. Update the Playwright package to a supported version and try again."
17
- },
18
- MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {
19
- key: "MultipleSetupFilePlaywrightVersionError",
20
- message: "The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher."
21
- },
22
- WORKSPACE_MISMATCH_ERROR: {
23
- key: "InvalidAccessToken",
24
- message: "The provided access token does not match the specified workspace URL. Please verify that both values are correct."
25
- },
26
- NO_AUTH_ERROR_PAT_TOKEN: {
27
- key: "NoAuthErrorPatToken",
28
- message: "Please set PLAYWRIGHT_SERVICE_ACCESS_TOKEN env variable when using ACCESS_TOKEN authentication. For more information, see https://aka.ms/pww/docs/authentication"
29
- },
30
- NO_AUTH_ERROR_ENTRA_TOKEN: {
31
- key: "NoAuthErrorEntraToken",
32
- message: "Could not authenticate with the service. For more information, see https://aka.ms/pww/docs/authentication"
33
- },
34
- INVALID_MPT_PAT_ERROR: {
35
- key: "InvalidMptPatError",
36
- message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided is invalid. Please make sure to set a valid token."
37
- },
38
- EXPIRED_MPT_PAT_ERROR: {
39
- key: "ExpiredMptPatError",
40
- message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided has expired. Create a new token."
41
- },
42
- NO_CRED_ENTRA_AUTH_ERROR: {
43
- key: "NoCredEntraAuthError",
44
- message: "Missing 'credential' parameter which is required when using ENTRA_ID authentication, Azure credential not provided. See https://aka.ms/pww/docs/authentication for more information."
45
- },
46
- FAILED_TO_CREATE_TEST_RUN: {
47
- key: "FailedToCreateTestRun",
48
- message: "Failed to create the test run in the Playwright workspaces. For more information, see https://aka.ms/pww/docs/troubleshooting",
49
- formatWithErrorDetails: (errorDetails) => `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. For more information, see https://aka.ms/pww/docs/troubleshooting`
50
- },
51
- INVALID_PARAM_WITH_SERVICE_CONFIG: {
52
- key: "InvalidParamWithServiceConfig",
53
- message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`
54
- },
55
- INVALID_RUN_ID_FORMAT: {
56
- key: "InvalidRunIdFormat",
57
- message: "The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID."
58
- },
59
- INVALID_AUTH_TYPE_ERROR: {
60
- key: "InvalidAuthTypeError",
61
- message: "Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN."
62
- },
63
- FAILED_TO_GET_WORKSPACE_DETAILS: {
64
- key: "FailedToGetWorkspaceDetails",
65
- message: "Failed to retrieve workspace details from the Playwright service.",
66
- formatWithErrorDetails: (errorDetails) => `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`
67
- },
68
- STORAGE_URI_NOT_FOUND: {
69
- key: "StorageUriNotFound",
70
- message: "Storage Account is not linked with this Playwright Workspace."
71
- },
72
- STORAGE_AUTHORIZATION_FAILED: {
73
- key: "StorageAuthorizationFailed",
74
- message: "The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account. For more information, see https://aka.ms/pww-reporting",
75
- formatWithStorageAccount: (storageAccountName) => `The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account - ${storageAccountName}. For more information, see https://aka.ms/pww-reporting`
76
- },
77
- UNABLE_TO_EXTRACT_WORKSPACE_ID: {
78
- key: "UnableToExtractWorkspaceId",
79
- message: "Unable to extract workspace ID from service URL"
80
- },
81
- STORAGE_ACCOUNT_DELETED: {
82
- key: "StorageAccountDeleted",
83
- message: "The storage account linked to your Playwright Workspace may have been deleted. Please link a different storage account to your Playwright Workspace before trying again. To learn more on how to link a new storage account, refer to https://aka.ms/pww-reporting-migration",
84
- formatWithStorageAccount: (storageAccountName) => `The storage account linked to your Playwright Workspace (${storageAccountName}) may have been deleted. Please link a different storage account to your Playwright Workspace before trying again. To learn more on how to link a new storage account, refer to https://aka.ms/pww-reporting-migration`
85
- },
86
- REPORTER_REQUIRES_ENTRA_AUTH: {
87
- key: "ReporterRequiresEntraAuth",
88
- message: "Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. For more information, see https://aka.ms/pww/docs/authentication"
89
- },
90
- HTML_REPORTER_REQUIRED: {
91
- key: "HtmlReporterRequired",
92
- message: "Playwright Workspaces Reporter requires the 'html' reporter to be configured in your Playwright configuration. Please add the 'html' reporter before playwright workspace reporter to generate test reports that can be uploaded to Azure Storage. Example: reporter: [['html'], ['@azure/playwright/reporter']]. For more information, see https://aka.ms/pww-reporting"
93
- },
94
- WORKSPACE_METADATA_FETCH_FAILED: {
95
- key: "WorkspaceMetadataFetchFailed",
96
- message: "Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL."
97
- },
98
- WORKSPACE_REPORTING_DISABLED: {
99
- key: "WorkspaceReportingDisabled",
100
- message: "Playwright Workspaces reporting: DISABLED. Reporting is not enabled for the Playwright Workspace. To learn more about how to enable reporting and link a storage account, see https://aka.ms/pww-reporting"
101
- },
102
- WORKSPACE_REPORTING_STORAGE_NOT_LINKED: {
103
- key: "WorkspaceReportingStorageNotLinked",
104
- message: "Playwright Workspaces reporting: DISABLED. Reporting is enabled for the Playwright Workspace, but no storage account is linked. Please link a storage account to enable reporting. For more information, see https://aka.ms/pww-reporting"
105
- },
106
- UPLOAD_FAILED_FILES: {
107
- key: "UploadFailedFiles",
108
- message: "Upload failed: files could not be uploaded",
109
- formatWithCount: (failed) => `Upload failed: ${failed} files could not be uploaded`
110
- },
111
- PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {
112
- key: "PlaywrightTestReportNotFound",
113
- message: "Playwright test report not found",
114
- formatWithFolder: (folderName) => `Playwright test report not found: ${folderName}. For more information, see https://aka.ms/pww-reporting`
115
- },
116
- REPORTING_ENABLED: {
117
- key: "ReportingEnabled",
118
- message: "Playwright Workspaces reporting: ENABLED"
119
- },
120
- COLLECTING_ARTIFACTS: {
121
- key: "CollectingArtifacts",
122
- message: "Collecting artifacts: screenshots, videos, traces."
123
- },
124
- REPORTING_STATUS_SUCCESS: {
125
- key: "ReportingStatusSuccess",
126
- message: "Reporting upload status: SUCCESS"
127
- },
128
- REPORTING_STATUS_PARTIAL: {
129
- key: "ReportingStatusPartial",
130
- message: "Reporting upload status: Partially Uploaded"
131
- },
132
- REPORTING_STATUS_FAILED: {
133
- key: "ReportingStatusFailed",
134
- message: "Reporting upload status: FAILED"
135
- },
136
- TEST_REPORT_VIEW_URL: {
137
- key: "TestReportViewUrl",
138
- message: "Published report URL: ",
139
- formatWithUrl: (url) => `Published report URL: ${url}`
140
- },
141
- UPLOADING_ARTIFACTS: {
142
- key: "UploadingArtifacts",
143
- message: "Uploading artifacts to storage",
144
- formatWithDetails: (storageAccount, container, folder) => `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`
145
- },
146
- FAILED_TO_GET_WORKSPACE_METADATA: {
147
- key: "FailedToGetWorkspaceMetadata",
148
- message: "Failed to get workspace metadata",
149
- formatWithError: (error) => error
150
- },
151
- TEST_RUN_CREATION_FAILED: {
152
- key: "TestRunCreationFailed",
153
- message: "Failed to create test run. Test execution will continue.",
154
- formatWithErrorDetails: (errorDetails) => `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`
155
- },
156
- REPORTING_TEST_RUN_FAILED: {
157
- key: "ReportingTestRunFailed",
158
- message: "Test run creation failed during setup."
159
- },
160
- REPORTER_REQUIRES_SERVICE_CONFIG: {
161
- key: "ReporterRequiresServiceConfig",
162
- message: "Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig. For more information, see https://aka.ms/pww-reporting."
163
- }
164
- };
165
- export {
166
- ServiceErrorMessageConstants
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export const ServiceErrorMessageConstants = {
4
+ NO_SERVICE_URL_ERROR: {
5
+ key: "NoServiceUrlError",
6
+ message: "The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.",
7
+ },
8
+ INVALID_GLOBAL_FUNCTION: {
9
+ key: "InvalidGlobalFunction",
10
+ message: "File must export a single function.",
11
+ },
12
+ INVALID_PLAYWRIGHT_VERSION_ERROR: {
13
+ key: "InvalidPlaywrightVersionError",
14
+ message: "The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions.",
15
+ },
16
+ PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING: {
17
+ key: "PlaywrightVersionTooOldForReporting",
18
+ message: "To use the Playwright Workspaces reporting feature, you need Playwright version 1.57 or later installed. Update the Playwright package to a supported version and try again.",
19
+ },
20
+ MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {
21
+ key: "MultipleSetupFilePlaywrightVersionError",
22
+ message: "The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.",
23
+ },
24
+ WORKSPACE_MISMATCH_ERROR: {
25
+ key: "InvalidAccessToken",
26
+ message: "The provided access token does not match the specified workspace URL. Please verify that both values are correct.",
27
+ },
28
+ NO_AUTH_ERROR_PAT_TOKEN: {
29
+ key: "NoAuthErrorPatToken",
30
+ message: "Please set PLAYWRIGHT_SERVICE_ACCESS_TOKEN env variable when using ACCESS_TOKEN authentication. For more information, see https://aka.ms/pww/docs/authentication",
31
+ },
32
+ NO_AUTH_ERROR_ENTRA_TOKEN: {
33
+ key: "NoAuthErrorEntraToken",
34
+ message: "Could not authenticate with the service. For more information, see https://aka.ms/pww/docs/authentication",
35
+ },
36
+ INVALID_MPT_PAT_ERROR: {
37
+ key: "InvalidMptPatError",
38
+ message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided is invalid. Please make sure to set a valid token.",
39
+ },
40
+ EXPIRED_MPT_PAT_ERROR: {
41
+ key: "ExpiredMptPatError",
42
+ message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided has expired. Create a new token.",
43
+ },
44
+ NO_CRED_ENTRA_AUTH_ERROR: {
45
+ key: "NoCredEntraAuthError",
46
+ message: "Missing 'credential' parameter which is required when using ENTRA_ID authentication, Azure credential not provided. See https://aka.ms/pww/docs/authentication for more information.",
47
+ },
48
+ FAILED_TO_CREATE_TEST_RUN: {
49
+ key: "FailedToCreateTestRun",
50
+ message: "Failed to create the test run in the Playwright workspaces. For more information, see https://aka.ms/pww/docs/troubleshooting",
51
+ formatWithErrorDetails: (errorDetails) => `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. For more information, see https://aka.ms/pww/docs/troubleshooting`,
52
+ },
53
+ INVALID_PARAM_WITH_SERVICE_CONFIG: {
54
+ key: "InvalidParamWithServiceConfig",
55
+ message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,
56
+ },
57
+ INVALID_RUN_ID_FORMAT: {
58
+ key: "InvalidRunIdFormat",
59
+ message: "The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID.",
60
+ },
61
+ INVALID_AUTH_TYPE_ERROR: {
62
+ key: "InvalidAuthTypeError",
63
+ message: "Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN.",
64
+ },
65
+ FAILED_TO_GET_WORKSPACE_DETAILS: {
66
+ key: "FailedToGetWorkspaceDetails",
67
+ message: "Failed to retrieve workspace details from the Playwright service.",
68
+ formatWithErrorDetails: (errorDetails) => `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`,
69
+ },
70
+ STORAGE_URI_NOT_FOUND: {
71
+ key: "StorageUriNotFound",
72
+ message: "Storage Account is not linked with this Playwright Workspace.",
73
+ },
74
+ STORAGE_AUTHORIZATION_FAILED: {
75
+ key: "StorageAuthorizationFailed",
76
+ message: "The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account. For more information, see https://aka.ms/pww-reporting",
77
+ formatWithStorageAccount: (storageAccountName) => `The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account - ${storageAccountName}. For more information, see https://aka.ms/pww-reporting`,
78
+ },
79
+ UNABLE_TO_EXTRACT_WORKSPACE_ID: {
80
+ key: "UnableToExtractWorkspaceId",
81
+ message: "Unable to extract workspace ID from service URL",
82
+ },
83
+ STORAGE_ACCOUNT_DELETED: {
84
+ key: "StorageAccountDeleted",
85
+ message: "The storage account linked to your Playwright Workspace may have been deleted. Please link a different storage account to your Playwright Workspace before trying again. To learn more on how to link a new storage account, refer to https://aka.ms/pww-reporting-migration",
86
+ formatWithStorageAccount: (storageAccountName) => `The storage account linked to your Playwright Workspace (${storageAccountName}) may have been deleted. Please link a different storage account to your Playwright Workspace before trying again. To learn more on how to link a new storage account, refer to https://aka.ms/pww-reporting-migration`,
87
+ },
88
+ REPORTER_REQUIRES_ENTRA_AUTH: {
89
+ key: "ReporterRequiresEntraAuth",
90
+ message: "Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. For more information, see https://aka.ms/pww/docs/authentication",
91
+ },
92
+ HTML_REPORTER_REQUIRED: {
93
+ key: "HtmlReporterRequired",
94
+ message: "Playwright Workspaces Reporter requires the 'html' reporter to be configured in your Playwright configuration. Please add the 'html' reporter before playwright workspace reporter to generate test reports that can be uploaded to Azure Storage. Example: reporter: [['html'], ['@azure/playwright/reporter']]. For more information, see https://aka.ms/pww-reporting",
95
+ },
96
+ WORKSPACE_METADATA_FETCH_FAILED: {
97
+ key: "WorkspaceMetadataFetchFailed",
98
+ message: "Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL.",
99
+ },
100
+ WORKSPACE_REPORTING_DISABLED: {
101
+ key: "WorkspaceReportingDisabled",
102
+ message: "Playwright Workspaces reporting: DISABLED. Reporting is not enabled for the Playwright Workspace. To learn more about how to enable reporting and link a storage account, see https://aka.ms/pww-reporting",
103
+ },
104
+ WORKSPACE_REPORTING_STORAGE_NOT_LINKED: {
105
+ key: "WorkspaceReportingStorageNotLinked",
106
+ message: "Playwright Workspaces reporting: DISABLED. Reporting is enabled for the Playwright Workspace, but no storage account is linked. Please link a storage account to enable reporting. For more information, see https://aka.ms/pww-reporting",
107
+ },
108
+ UPLOAD_FAILED_FILES: {
109
+ key: "UploadFailedFiles",
110
+ message: "Upload failed: files could not be uploaded",
111
+ formatWithCount: (failed) => `Upload failed: ${failed} files could not be uploaded`,
112
+ },
113
+ PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {
114
+ key: "PlaywrightTestReportNotFound",
115
+ message: "Playwright test report not found",
116
+ formatWithFolder: (folderName) => `Playwright test report not found: ${folderName}. For more information, see https://aka.ms/pww-reporting`,
117
+ },
118
+ REPORTING_ENABLED: {
119
+ key: "ReportingEnabled",
120
+ message: "Playwright Workspaces reporting: ENABLED",
121
+ },
122
+ COLLECTING_ARTIFACTS: {
123
+ key: "CollectingArtifacts",
124
+ message: "Collecting artifacts: screenshots, videos, traces.",
125
+ },
126
+ REPORTING_STATUS_SUCCESS: {
127
+ key: "ReportingStatusSuccess",
128
+ message: "Reporting upload status: SUCCESS",
129
+ },
130
+ REPORTING_STATUS_PARTIAL: {
131
+ key: "ReportingStatusPartial",
132
+ message: "Reporting upload status: Partially Uploaded",
133
+ },
134
+ REPORTING_STATUS_FAILED: {
135
+ key: "ReportingStatusFailed",
136
+ message: "Reporting upload status: FAILED",
137
+ },
138
+ TEST_REPORT_VIEW_URL: {
139
+ key: "TestReportViewUrl",
140
+ message: "Published report URL: ",
141
+ formatWithUrl: (url) => `Published report URL: ${url}`,
142
+ },
143
+ UPLOADING_ARTIFACTS: {
144
+ key: "UploadingArtifacts",
145
+ message: "Uploading artifacts to storage",
146
+ formatWithDetails: (storageAccount, container, folder) => `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`,
147
+ },
148
+ FAILED_TO_GET_WORKSPACE_METADATA: {
149
+ key: "FailedToGetWorkspaceMetadata",
150
+ message: "Failed to get workspace metadata",
151
+ formatWithError: (error) => error,
152
+ },
153
+ TEST_RUN_CREATION_FAILED: {
154
+ key: "TestRunCreationFailed",
155
+ message: "Failed to create test run. Test execution will continue.",
156
+ formatWithErrorDetails: (errorDetails) => `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`,
157
+ },
158
+ REPORTING_TEST_RUN_FAILED: {
159
+ key: "ReportingTestRunFailed",
160
+ message: "Test run creation failed during setup.",
161
+ },
162
+ REPORTER_REQUIRES_SERVICE_CONFIG: {
163
+ key: "ReporterRequiresServiceConfig",
164
+ message: "Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig. For more information, see https://aka.ms/pww-reporting.",
165
+ },
167
166
  };
167
+ //# sourceMappingURL=messages.js.map