@azure/playwright 1.0.1-alpha.20251231.2 → 1.0.1-alpha.20260105.1

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 (57) hide show
  1. package/dist/browser/common/entraIdAccessToken.js +1 -1
  2. package/dist/browser/common/entraIdAccessToken.js.map +1 -1
  3. package/dist/browser/common/messages.d.ts +9 -1
  4. package/dist/browser/common/messages.d.ts.map +1 -1
  5. package/dist/browser/common/messages.js +26 -18
  6. package/dist/browser/common/messages.js.map +1 -1
  7. package/dist/browser/core/playwrightService.js +1 -1
  8. package/dist/browser/core/playwrightService.js.map +1 -1
  9. package/dist/browser/reporter/playwrightReporter.d.ts.map +1 -1
  10. package/dist/browser/reporter/playwrightReporter.js +21 -1
  11. package/dist/browser/reporter/playwrightReporter.js.map +1 -1
  12. package/dist/browser/utils/utils.d.ts.map +1 -1
  13. package/dist/browser/utils/utils.js +3 -4
  14. package/dist/browser/utils/utils.js.map +1 -1
  15. package/dist/commonjs/common/entraIdAccessToken.js +1 -1
  16. package/dist/commonjs/common/entraIdAccessToken.js.map +1 -1
  17. package/dist/commonjs/common/messages.d.ts +9 -1
  18. package/dist/commonjs/common/messages.d.ts.map +1 -1
  19. package/dist/commonjs/common/messages.js +26 -18
  20. package/dist/commonjs/common/messages.js.map +1 -1
  21. package/dist/commonjs/core/playwrightService.js +1 -1
  22. package/dist/commonjs/core/playwrightService.js.map +1 -1
  23. package/dist/commonjs/reporter/playwrightReporter.d.ts.map +1 -1
  24. package/dist/commonjs/reporter/playwrightReporter.js +20 -0
  25. package/dist/commonjs/reporter/playwrightReporter.js.map +1 -1
  26. package/dist/commonjs/utils/utils.d.ts.map +1 -1
  27. package/dist/commonjs/utils/utils.js +3 -4
  28. package/dist/commonjs/utils/utils.js.map +1 -1
  29. package/dist/esm/common/entraIdAccessToken.js +1 -1
  30. package/dist/esm/common/entraIdAccessToken.js.map +1 -1
  31. package/dist/esm/common/messages.d.ts +9 -1
  32. package/dist/esm/common/messages.d.ts.map +1 -1
  33. package/dist/esm/common/messages.js +26 -18
  34. package/dist/esm/common/messages.js.map +1 -1
  35. package/dist/esm/core/playwrightService.js +1 -1
  36. package/dist/esm/core/playwrightService.js.map +1 -1
  37. package/dist/esm/reporter/playwrightReporter.d.ts.map +1 -1
  38. package/dist/esm/reporter/playwrightReporter.js +21 -1
  39. package/dist/esm/reporter/playwrightReporter.js.map +1 -1
  40. package/dist/esm/utils/utils.d.ts.map +1 -1
  41. package/dist/esm/utils/utils.js +3 -4
  42. package/dist/esm/utils/utils.js.map +1 -1
  43. package/dist/react-native/common/entraIdAccessToken.js +1 -1
  44. package/dist/react-native/common/entraIdAccessToken.js.map +1 -1
  45. package/dist/react-native/common/messages.d.ts +9 -1
  46. package/dist/react-native/common/messages.d.ts.map +1 -1
  47. package/dist/react-native/common/messages.js +26 -18
  48. package/dist/react-native/common/messages.js.map +1 -1
  49. package/dist/react-native/core/playwrightService.js +1 -1
  50. package/dist/react-native/core/playwrightService.js.map +1 -1
  51. package/dist/react-native/reporter/playwrightReporter.d.ts.map +1 -1
  52. package/dist/react-native/reporter/playwrightReporter.js +21 -1
  53. package/dist/react-native/reporter/playwrightReporter.js.map +1 -1
  54. package/dist/react-native/utils/utils.d.ts.map +1 -1
  55. package/dist/react-native/utils/utils.js +3 -4
  56. package/dist/react-native/utils/utils.js.map +1 -1
  57. package/package.json +3 -3
@@ -42,7 +42,7 @@ export class EntraIdAccessToken {
42
42
  catch (err) {
43
43
  coreLogger.error(err);
44
44
  process.env[InternalEnvironmentVariables.MPT_SETUP_FATAL_ERROR] = "true";
45
- throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);
45
+ throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_ENTRA_TOKEN.message);
46
46
  }
47
47
  };
48
48
  doesEntraIdAccessTokenNeedRotation() {
@@ -1 +1 @@
1
- {"version":3,"file":"entraIdAccessToken.js","sourceRoot":"","sources":["../../../src/common/ent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C7C,CAAC;QACF,OAAO,6BAA6B,CAAC;IACvC,CAAC;IAEO,oCAAoC,GAAG,GAAS,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,+BAA+B,CAAC,CAAC;YACtF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,QAAQ,CAA6B,KAAK,CAAC,CAAC;YAC3D,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAChB,OAAO;YACT,CAAC,CAAC,UAAU;YACZ,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAI,GAAG,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;QACT,CAAC;IACH,CAAC,CAAC;CACH;AAED,MAAM,UAAU,wBAAwB,CAAC,UAA4B;IACnE,OAAO,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { coreLogger } from \"./logger.js\";\nimport {\n EntraIdAccessTokenConstants,\n InternalEnvironmentVariables,\n ServiceEnvironmentVariable,\n} from \"./constants.js\";\nimport type { AccessTokenClaims } from \"./types.js\";\nimport { parseJwt } from \"../utils/parseJwt.js\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nexport class EntraIdAccessToken {\n public token?: string;\n private _expiryTimestamp?: number; // in milliseconds\n private _credential?: TokenCredential;\n private _noOpFlag = false;\n\n constructor(credential?: TokenCredential) {\n this._credential = credential;\n if (!this._credential) {\n this._noOpFlag = true;\n return;\n }\n this.setEntraIdAccessTokenFromEnvironment();\n }\n\n public fetchEntraIdAccessToken = async (): Promise<void> => {\n if (this._noOpFlag) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n try {\n coreLogger.info(\"Fetching entra id access token\");\n const accessToken = await this._credential!.getToken(EntraIdAccessTokenConstants.SCOPE);\n if (!accessToken) {\n throw new Error(\"Entra id access token is null\");\n }\n if (accessToken.token === this.token) {\n // azure identity library can fetch the same token again from cache. 10 mins before expiry, it allows token refresh\n coreLogger.info(\"Cached access token is returned, will be retried again.\");\n return;\n }\n this.token = accessToken.token;\n this._expiryTimestamp = accessToken.expiresOnTimestamp;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN] = this.token!;\n coreLogger.info(\"Entra id access token fetched and set in environment variable\");\n coreLogger.info(\n \"Entra id access token expiry:\",\n new Date(this._expiryTimestamp!).toISOString(),\n );\n return;\n } catch (err) {\n coreLogger.error(err);\n process.env[InternalEnvironmentVariables.MPT_SETUP_FATAL_ERROR] = \"true\";\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);\n }\n };\n\n public doesEntraIdAccessTokenNeedRotation(): boolean {\n if (this._noOpFlag) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n if (!this.token) {\n coreLogger.info(\"Entra id access token not found, needs rotation\");\n return true;\n }\n const lifetimeLeft = this._expiryTimestamp! - new Date().getTime();\n const doesEntraTokenRequireRotation =\n lifetimeLeft <\n EntraIdAccessTokenConstants.LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION * 60 * 1000;\n coreLogger.info(\n \"Entra id access token requires rotation:\",\n doesEntraTokenRequireRotation ? \"Yes\" : \"No\",\n );\n return doesEntraTokenRequireRotation;\n }\n\n private setEntraIdAccessTokenFromEnvironment = (): void => {\n try {\n const token = process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN];\n if (!token) {\n return;\n }\n const claims = parseJwt<Partial<AccessTokenClaims>>(token);\n if (claims.pwid) {\n return;\n } // mpt PAT\n const expiry = new Date(claims.exp! * 1000);\n this.token = token;\n this._expiryTimestamp = expiry.getTime();\n } catch (_) {\n return;\n }\n };\n}\n\nexport function createEntraIdAccessToken(credential?: TokenCredential): EntraIdAccessToken {\n return new EntraIdAccessToken(credential);\n}\n"]}
1
+ {"version":3,"file":"entraIdAccessToken.js","sourceRoot":"","sources":["../../../src/common/entraIdAccessToken.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,MAAM,OAAO,kBAAkB;IACtB,KAAK,CAAU;IACd,gBAAgB,CAAU,CAAC,kBAAkB;IAC7C,WAAW,CAAmB;IAC9B,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,UAA4B;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,oCAAoC,EAAE,CAAC;IAC9C,CAAC;IAEM,uBAAuB,GAAG,KAAK,IAAmB,EAAE;QACzD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,CAAC;YACH,UAAU,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAClD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WA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C;QACd,CAAC;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAiB,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QACnE,MAAM,6BAA6B,GACjC,YAAY;YACZ,2BAA2B,CAAC,+CAA+C,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1F,UAAU,CAAC,IAAI,CACb,0CAA0C,EAC1C,6BAA6B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAC7C,CAAC;QACF,OAAO,6BAA6B,CAAC;IACvC,CAAC;IAEO,oCAAoC,GAAG,GAAS,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,+BAA+B,CAAC,CAAC;YACtF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,QAAQ,CAA6B,KAAK,CAAC,CAAC;YAC3D,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAChB,OAAO;YACT,CAAC,CAAC,UAAU;YACZ,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAI,GAAG,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;QACT,CAAC;IACH,CAAC,CAAC;CACH;AAED,MAAM,UAAU,wBAAwB,CAAC,UAA4B;IACnE,OAAO,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { coreLogger } from \"./logger.js\";\nimport {\n EntraIdAccessTokenConstants,\n InternalEnvironmentVariables,\n ServiceEnvironmentVariable,\n} from \"./constants.js\";\nimport type { AccessTokenClaims } from \"./types.js\";\nimport { parseJwt } from \"../utils/parseJwt.js\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nexport class EntraIdAccessToken {\n public token?: string;\n private _expiryTimestamp?: number; // in milliseconds\n private _credential?: TokenCredential;\n private _noOpFlag = false;\n\n constructor(credential?: TokenCredential) {\n this._credential = credential;\n if (!this._credential) {\n this._noOpFlag = true;\n return;\n }\n this.setEntraIdAccessTokenFromEnvironment();\n }\n\n public fetchEntraIdAccessToken = async (): Promise<void> => {\n if (this._noOpFlag) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n try {\n coreLogger.info(\"Fetching entra id access token\");\n const accessToken = await this._credential!.getToken(EntraIdAccessTokenConstants.SCOPE);\n if (!accessToken) {\n throw new Error(\"Entra id access token is null\");\n }\n if (accessToken.token === this.token) {\n // azure identity library can fetch the same token again from cache. 10 mins before expiry, it allows token refresh\n coreLogger.info(\"Cached access token is returned, will be retried again.\");\n return;\n }\n this.token = accessToken.token;\n this._expiryTimestamp = accessToken.expiresOnTimestamp;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN] = this.token!;\n coreLogger.info(\"Entra id access token fetched and set in environment variable\");\n coreLogger.info(\n \"Entra id access token expiry:\",\n new Date(this._expiryTimestamp!).toISOString(),\n );\n return;\n } catch (err) {\n coreLogger.error(err);\n process.env[InternalEnvironmentVariables.MPT_SETUP_FATAL_ERROR] = \"true\";\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_ENTRA_TOKEN.message);\n }\n };\n\n public doesEntraIdAccessTokenNeedRotation(): boolean {\n if (this._noOpFlag) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n if (!this.token) {\n coreLogger.info(\"Entra id access token not found, needs rotation\");\n return true;\n }\n const lifetimeLeft = this._expiryTimestamp! - new Date().getTime();\n const doesEntraTokenRequireRotation =\n lifetimeLeft <\n EntraIdAccessTokenConstants.LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION * 60 * 1000;\n coreLogger.info(\n \"Entra id access token requires rotation:\",\n doesEntraTokenRequireRotation ? \"Yes\" : \"No\",\n );\n return doesEntraTokenRequireRotation;\n }\n\n private setEntraIdAccessTokenFromEnvironment = (): void => {\n try {\n const token = process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN];\n if (!token) {\n return;\n }\n const claims = parseJwt<Partial<AccessTokenClaims>>(token);\n if (claims.pwid) {\n return;\n } // mpt PAT\n const expiry = new Date(claims.exp! * 1000);\n this.token = token;\n this._expiryTimestamp = expiry.getTime();\n } catch (_) {\n return;\n }\n };\n}\n\nexport function createEntraIdAccessToken(credential?: TokenCredential): EntraIdAccessToken {\n return new EntraIdAccessToken(credential);\n}\n"]}
@@ -11,6 +11,10 @@ export declare const ServiceErrorMessageConstants: {
11
11
  key: string;
12
12
  message: string;
13
13
  };
14
+ PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING: {
15
+ key: string;
16
+ message: string;
17
+ };
14
18
  MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {
15
19
  key: string;
16
20
  message: string;
@@ -19,7 +23,11 @@ export declare const ServiceErrorMessageConstants: {
19
23
  key: string;
20
24
  message: string;
21
25
  };
22
- NO_AUTH_ERROR: {
26
+ NO_AUTH_ERROR_PAT_TOKEN: {
27
+ key: string;
28
+ message: string;
29
+ };
30
+ NO_AUTH_ERROR_ENTRA_TOKEN: {
23
31
  key: string;
24
32
  message: string;
25
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA+CE,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;+CAkBf,MAAM,KAAG,MAAM;;;;;;;;;uDAWP,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;kCA8BpC,MAAM,KAAG,MAAM;;;;;uCAMV,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;6BA0BzB,MAAM,KAAG,MAAM;;;;;4CAKA,MAAM,aAAa,MAAM,UAAU,MAAM,KAAG,MAAM;;;;;iCAM7D,MAAM,KAAG,MAAM;;;;;+CAKD,MAAM,KAAG,MAAM;;;;;;;;;;CAYzD,CAAC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA0DE,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;+CAkBf,MAAM,KAAG,MAAM;;;;;;;;;uDAWP,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;kCA8BpC,MAAM,KAAG,MAAM;;;;;uCAMV,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;6BA0BzB,MAAM,KAAG,MAAM;;;;;4CAKA,MAAM,aAAa,MAAM,UAAU,MAAM,KAAG,MAAM;;;;;iCAM7D,MAAM,KAAG,MAAM;;;;;+CAKD,MAAM,KAAG,MAAM;;;;;;;;;;CAYzD,CAAC"}
@@ -13,6 +13,10 @@ export const ServiceErrorMessageConstants = {
13
13
  key: "InvalidPlaywrightVersionError",
14
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
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
+ },
16
20
  MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {
17
21
  key: "MultipleSetupFilePlaywrightVersionError",
18
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.",
@@ -21,26 +25,30 @@ export const ServiceErrorMessageConstants = {
21
25
  key: "InvalidAccessToken",
22
26
  message: "The provided access token does not match the specified workspace URL. Please verify that both values are correct.",
23
27
  },
24
- NO_AUTH_ERROR: {
25
- key: "NoAuthError",
26
- message: "Could not authenticate with the service. Please refer to https://aka.ms/pww/docs/authentication for more information.",
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",
27
35
  },
28
36
  INVALID_MPT_PAT_ERROR: {
29
37
  key: "InvalidMptPatError",
30
- message: "The authentication token provided is invalid. Check the token and try again.",
38
+ message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided is invalid. Please make sure to set a valid token.",
31
39
  },
32
40
  EXPIRED_MPT_PAT_ERROR: {
33
41
  key: "ExpiredMptPatError",
34
- message: "Your authentication token has expired. Create a new token.",
42
+ message: "The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided has expired. Create a new token.",
35
43
  },
36
44
  NO_CRED_ENTRA_AUTH_ERROR: {
37
45
  key: "NoCredEntraAuthError",
38
- message: "Azure credentials not found when using Entra ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.",
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.",
39
47
  },
40
48
  FAILED_TO_CREATE_TEST_RUN: {
41
49
  key: "FailedToCreateTestRun",
42
- message: "Failed to create the test run in the Playwright workspaces. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.",
43
- formatWithErrorDetails: (errorDetails) => `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.`,
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`,
44
52
  },
45
53
  INVALID_PARAM_WITH_SERVICE_CONFIG: {
46
54
  key: "InvalidParamWithServiceConfig",
@@ -65,8 +73,8 @@ export const ServiceErrorMessageConstants = {
65
73
  },
66
74
  STORAGE_AUTHORIZATION_FAILED: {
67
75
  key: "StorageAuthorizationFailed",
68
- 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. Refer to https://aka.ms/pww-reporting",
69
- 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}. Refer to https://aka.ms/pww-reporting`,
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`,
70
78
  },
71
79
  UNABLE_TO_EXTRACT_WORKSPACE_ID: {
72
80
  key: "UnableToExtractWorkspaceId",
@@ -74,11 +82,11 @@ export const ServiceErrorMessageConstants = {
74
82
  },
75
83
  REPORTER_REQUIRES_ENTRA_AUTH: {
76
84
  key: "ReporterRequiresEntraAuth",
77
- message: "Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.",
85
+ message: "Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. For more information, see https://aka.ms/pww/docs/authentication",
78
86
  },
79
87
  HTML_REPORTER_REQUIRED: {
80
88
  key: "HtmlReporterRequired",
81
- 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']]",
89
+ 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",
82
90
  },
83
91
  WORKSPACE_METADATA_FETCH_FAILED: {
84
92
  key: "WorkspaceMetadataFetchFailed",
@@ -86,7 +94,7 @@ export const ServiceErrorMessageConstants = {
86
94
  },
87
95
  WORKSPACE_REPORTING_DISABLED: {
88
96
  key: "WorkspaceReportingDisabled",
89
- 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, refer to https://aka.ms/pww-reporting ",
97
+ 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, For more information, see https://aka.ms/pww-reporting",
90
98
  },
91
99
  UPLOAD_FAILED_FILES: {
92
100
  key: "UploadFailedFiles",
@@ -96,7 +104,7 @@ export const ServiceErrorMessageConstants = {
96
104
  PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {
97
105
  key: "PlaywrightTestReportNotFound",
98
106
  message: "Playwright test report not found",
99
- formatWithFolder: (folderName) => `Playwright test report not found: ${folderName}`,
107
+ formatWithFolder: (folderName) => `Playwright test report not found: ${folderName}. For more information, see https://aka.ms/pww-reporting`,
100
108
  },
101
109
  REPORTING_ENABLED: {
102
110
  key: "ReportingEnabled",
@@ -108,15 +116,15 @@ export const ServiceErrorMessageConstants = {
108
116
  },
109
117
  REPORTING_STATUS_SUCCESS: {
110
118
  key: "ReportingStatusSuccess",
111
- message: "Reporting status: SUCCESS",
119
+ message: "Reporting upload status: SUCCESS",
112
120
  },
113
121
  REPORTING_STATUS_PARTIAL: {
114
122
  key: "ReportingStatusPartial",
115
- message: "Reporting status: Partially Uploaded",
123
+ message: "Reporting upload status: Partially Uploaded",
116
124
  },
117
125
  REPORTING_STATUS_FAILED: {
118
126
  key: "ReportingStatusFailed",
119
- message: "Reporting status: FAILED",
127
+ message: "Reporting upload status: FAILED",
120
128
  },
121
129
  TEST_REPORT_VIEW_URL: {
122
130
  key: "TestReportViewUrl",
@@ -144,7 +152,7 @@ export const ServiceErrorMessageConstants = {
144
152
  },
145
153
  REPORTER_REQUIRES_SERVICE_CONFIG: {
146
154
  key: "ReporterRequiresServiceConfig",
147
- message: "Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig.",
155
+ message: "Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig. For more information, see https://aka.ms/pww-reporting.",
148
156
  },
149
157
  };
150
158
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,qCAAqC;KAC/C;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,0IAA0I;KAC7I;IACD,4CAA4C,EAAE;QAC5C,GAAG,EAAE,yCAAyC;QAC9C,OAAO,EACL,4IAA4I;KAC/I;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EACL,mHAAmH;KACtH;IACD,aAAa,EAAE;QACb,GAAG,EAAE,aAAa;QAClB,OAAO,EACL,uHA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AM,EAAE;KACnH;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,8BAA8B;QACnC,OAAO,EAAE,kCAAkC;QAC3C,eAAe,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK;KAClD;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,0DAA0D;QACnE,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,qCAAqC,YAAY,iCAAiC;KACrF;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,wCAAwC;KAClD;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,2GAA2G;KAC9G;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions.\",\n },\n MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {\n key: \"MultipleSetupFilePlaywrightVersionError\",\n message:\n \"The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR: {\n key: \"NoAuthError\",\n message:\n \"Could not authenticate with the service. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message: \"The authentication token provided is invalid. Check the token and try again.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"Your authentication token has expired. Create a new token.\",\n },\n NO_CRED_ENTRA_AUTH_ERROR: {\n key: \"NoCredEntraAuthError\",\n message:\n \"Azure credentials not found when using Entra ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n FAILED_TO_CREATE_TEST_RUN: {\n key: \"FailedToCreateTestRun\",\n message:\n \"Failed to create the test run in the Playwright workspaces. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.`,\n },\n INVALID_PARAM_WITH_SERVICE_CONFIG: {\n key: \"InvalidParamWithServiceConfig\",\n message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,\n },\n INVALID_RUN_ID_FORMAT: {\n key: \"InvalidRunIdFormat\",\n message: \"The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID.\",\n },\n INVALID_AUTH_TYPE_ERROR: {\n key: \"InvalidAuthTypeError\",\n message: \"Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN.\",\n },\n FAILED_TO_GET_WORKSPACE_DETAILS: {\n key: \"FailedToGetWorkspaceDetails\",\n message: \"Failed to retrieve workspace details from the Playwright service.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`,\n },\n STORAGE_URI_NOT_FOUND: {\n key: \"StorageUriNotFound\",\n message: \"Storage Account is not linked with this Playwright Workspace.\",\n },\n STORAGE_AUTHORIZATION_FAILED: {\n key: \"StorageAuthorizationFailed\",\n message:\n \"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. Refer to https://aka.ms/pww-reporting\",\n formatWithStorageAccount: (storageAccountName: string): string =>\n `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}. Refer to https://aka.ms/pww-reporting`,\n },\n UNABLE_TO_EXTRACT_WORKSPACE_ID: {\n key: \"UnableToExtractWorkspaceId\",\n message: \"Unable to extract workspace ID from service URL\",\n },\n REPORTER_REQUIRES_ENTRA_AUTH: {\n key: \"ReporterRequiresEntraAuth\",\n message:\n \"Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n HTML_REPORTER_REQUIRED: {\n key: \"HtmlReporterRequired\",\n message:\n \"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']]\",\n },\n WORKSPACE_METADATA_FETCH_FAILED: {\n key: \"WorkspaceMetadataFetchFailed\",\n message:\n \"Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL.\",\n },\n WORKSPACE_REPORTING_DISABLED: {\n key: \"WorkspaceReportingDisabled\",\n message:\n \"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, refer to https://aka.ms/pww-reporting \",\n },\n UPLOAD_FAILED_FILES: {\n key: \"UploadFailedFiles\",\n message: \"Upload failed: files could not be uploaded\",\n formatWithCount: (failed: number): string =>\n `Upload failed: ${failed} files could not be uploaded`,\n },\n PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {\n key: \"PlaywrightTestReportNotFound\",\n message: \"Playwright test report not found\",\n formatWithFolder: (folderName: string): string =>\n `Playwright test report not found: ${folderName}`,\n },\n REPORTING_ENABLED: {\n key: \"ReportingEnabled\",\n message: \"Playwright Workspaces reporting: ENABLED\",\n },\n COLLECTING_ARTIFACTS: {\n key: \"CollectingArtifacts\",\n message: \"Collecting artifacts: screenshots, videos, traces.\",\n },\n REPORTING_STATUS_SUCCESS: {\n key: \"ReportingStatusSuccess\",\n message: \"Reporting status: SUCCESS\",\n },\n REPORTING_STATUS_PARTIAL: {\n key: \"ReportingStatusPartial\",\n message: \"Reporting status: Partially Uploaded\",\n },\n REPORTING_STATUS_FAILED: {\n key: \"ReportingStatusFailed\",\n message: \"Reporting status: FAILED\",\n },\n TEST_REPORT_VIEW_URL: {\n key: \"TestReportViewUrl\",\n message: \"Published report URL: \",\n formatWithUrl: (url: string): string => `Published report URL: ${url}`,\n },\n UPLOADING_ARTIFACTS: {\n key: \"UploadingArtifacts\",\n message: \"Uploading artifacts to storage\",\n formatWithDetails: (storageAccount: string, container: string, folder: string): string =>\n `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`,\n },\n FAILED_TO_GET_WORKSPACE_METADATA: {\n key: \"FailedToGetWorkspaceMetadata\",\n message: \"Failed to get workspace metadata\",\n formatWithError: (error: string): string => error,\n },\n TEST_RUN_CREATION_FAILED: {\n key: \"TestRunCreationFailed\",\n message: \"Failed to create test run. Test execution will continue.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`,\n },\n REPORTING_TEST_RUN_FAILED: {\n key: \"ReportingTestRunFailed\",\n message: \"Test run creation failed during setup.\",\n },\n REPORTER_REQUIRES_SERVICE_CONFIG: {\n key: \"ReporterRequiresServiceConfig\",\n message:\n \"Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig.\",\n },\n};\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;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AC7B,OAAO,EAAE,kCAAkC;KAC5C;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,6CAA6C;KACvD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,iCAAiC;KAC3C;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EAAE,wBAAwB;QACjC,aAAa,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,yBAAyB,GAAG,EAAE;KACvE;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,gCAAgC;QACzC,iBAAiB,EAAE,CAAC,cAAsB,EAAE,SAAiB,EAAE,MAAc,EAAU,EAAE,CACvF,4CAA4C,cAAc,wBAAwB,SAAS,aAAa,MAAM,EAAE;KACnH;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,8BAA8B;QACnC,OAAO,EAAE,kCAAkC;QAC3C,eAAe,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK;KAClD;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,0DAA0D;QACnE,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,qCAAqC,YAAY,iCAAiC;KACrF;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,wCAAwC;KAClD;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,mKAAmK;KACtK;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions.\",\n },\n PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING: {\n key: \"PlaywrightVersionTooOldForReporting\",\n message:\n \"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.\",\n },\n MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {\n key: \"MultipleSetupFilePlaywrightVersionError\",\n message:\n \"The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR_PAT_TOKEN: {\n key: \"NoAuthErrorPatToken\",\n message:\n \"Please set PLAYWRIGHT_SERVICE_ACCESS_TOKEN env variable when using ACCESS_TOKEN authentication. For more information, see https://aka.ms/pww/docs/authentication\",\n },\n NO_AUTH_ERROR_ENTRA_TOKEN: {\n key: \"NoAuthErrorEntraToken\",\n message:\n \"Could not authenticate with the service. For more information, see https://aka.ms/pww/docs/authentication\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message:\n \"The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided is invalid. Please make sure to set a valid token.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"The PLAYWRIGHT_SERVICE_ACCESS_TOKEN provided has expired. Create a new token.\",\n },\n NO_CRED_ENTRA_AUTH_ERROR: {\n key: \"NoCredEntraAuthError\",\n message:\n \"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.\",\n },\n FAILED_TO_CREATE_TEST_RUN: {\n key: \"FailedToCreateTestRun\",\n message:\n \"Failed to create the test run in the Playwright workspaces. For more information, see https://aka.ms/pww/docs/troubleshooting\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. For more information, see https://aka.ms/pww/docs/troubleshooting`,\n },\n INVALID_PARAM_WITH_SERVICE_CONFIG: {\n key: \"InvalidParamWithServiceConfig\",\n message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,\n },\n INVALID_RUN_ID_FORMAT: {\n key: \"InvalidRunIdFormat\",\n message: \"The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID.\",\n },\n INVALID_AUTH_TYPE_ERROR: {\n key: \"InvalidAuthTypeError\",\n message: \"Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN.\",\n },\n FAILED_TO_GET_WORKSPACE_DETAILS: {\n key: \"FailedToGetWorkspaceDetails\",\n message: \"Failed to retrieve workspace details from the Playwright service.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`,\n },\n STORAGE_URI_NOT_FOUND: {\n key: \"StorageUriNotFound\",\n message: \"Storage Account is not linked with this Playwright Workspace.\",\n },\n STORAGE_AUTHORIZATION_FAILED: {\n key: \"StorageAuthorizationFailed\",\n message:\n \"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\",\n formatWithStorageAccount: (storageAccountName: string): string =>\n `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`,\n },\n UNABLE_TO_EXTRACT_WORKSPACE_ID: {\n key: \"UnableToExtractWorkspaceId\",\n message: \"Unable to extract workspace ID from service URL\",\n },\n REPORTER_REQUIRES_ENTRA_AUTH: {\n key: \"ReporterRequiresEntraAuth\",\n message:\n \"Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. For more information, see https://aka.ms/pww/docs/authentication\",\n },\n HTML_REPORTER_REQUIRED: {\n key: \"HtmlReporterRequired\",\n message:\n \"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\",\n },\n WORKSPACE_METADATA_FETCH_FAILED: {\n key: \"WorkspaceMetadataFetchFailed\",\n message:\n \"Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL.\",\n },\n WORKSPACE_REPORTING_DISABLED: {\n key: \"WorkspaceReportingDisabled\",\n message:\n \"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, For more information, see https://aka.ms/pww-reporting\",\n },\n UPLOAD_FAILED_FILES: {\n key: \"UploadFailedFiles\",\n message: \"Upload failed: files could not be uploaded\",\n formatWithCount: (failed: number): string =>\n `Upload failed: ${failed} files could not be uploaded`,\n },\n PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {\n key: \"PlaywrightTestReportNotFound\",\n message: \"Playwright test report not found\",\n formatWithFolder: (folderName: string): string =>\n `Playwright test report not found: ${folderName}. For more information, see https://aka.ms/pww-reporting`,\n },\n REPORTING_ENABLED: {\n key: \"ReportingEnabled\",\n message: \"Playwright Workspaces reporting: ENABLED\",\n },\n COLLECTING_ARTIFACTS: {\n key: \"CollectingArtifacts\",\n message: \"Collecting artifacts: screenshots, videos, traces.\",\n },\n REPORTING_STATUS_SUCCESS: {\n key: \"ReportingStatusSuccess\",\n message: \"Reporting upload status: SUCCESS\",\n },\n REPORTING_STATUS_PARTIAL: {\n key: \"ReportingStatusPartial\",\n message: \"Reporting upload status: Partially Uploaded\",\n },\n REPORTING_STATUS_FAILED: {\n key: \"ReportingStatusFailed\",\n message: \"Reporting upload status: FAILED\",\n },\n TEST_REPORT_VIEW_URL: {\n key: \"TestReportViewUrl\",\n message: \"Published report URL: \",\n formatWithUrl: (url: string): string => `Published report URL: ${url}`,\n },\n UPLOADING_ARTIFACTS: {\n key: \"UploadingArtifacts\",\n message: \"Uploading artifacts to storage\",\n formatWithDetails: (storageAccount: string, container: string, folder: string): string =>\n `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`,\n },\n FAILED_TO_GET_WORKSPACE_METADATA: {\n key: \"FailedToGetWorkspaceMetadata\",\n message: \"Failed to get workspace metadata\",\n formatWithError: (error: string): string => error,\n },\n TEST_RUN_CREATION_FAILED: {\n key: \"TestRunCreationFailed\",\n message: \"Failed to create test run. Test execution will continue.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`,\n },\n REPORTING_TEST_RUN_FAILED: {\n key: \"ReportingTestRunFailed\",\n message: \"Test run creation failed during setup.\",\n },\n REPORTER_REQUIRES_SERVICE_CONFIG: {\n key: \"ReporterRequiresServiceConfig\",\n message:\n \"Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig. For more information, see https://aka.ms/pww-reporting.\",\n },\n};\n"]}
@@ -194,7 +194,7 @@ const getConnectOptions = async (options) => {
194
194
  throw new Error(ServiceErrorMessageConstants.INVALID_AUTH_TYPE_ERROR.message);
195
195
  }
196
196
  if (!token) {
197
- throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);
197
+ throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN.message);
198
198
  }
199
199
  return {
200
200
  wsEndpoint: getServiceWSEndpoint(playwrightServiceConfig.runId, playwrightServiceConfig.serviceOs, playwrightServiceConfig.apiVersion),
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightService.js","sourceRoot":"","sources":["../../../src/core/playwrightService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,O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AC,OAAO,CAAC,CAAC;QACjF,CAAC;QACD,sBAAsB,CAAC,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;QAC/D,KAAK,GAAG,MAAM,0BAA0B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/D,CAAC;SAAM,IAAI,uBAAuB,CAAC,eAAe,KAAK,WAAW,CAAC,YAAY,EAAE,CAAC;QAChF,cAAc,CAAC,4BAA4B,CAAC,CAAC;QAC7C,KAAK,GAAG,cAAc,EAAE,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,UAAU,EAAE,oBAAoB,CAC9B,uBAAuB,CAAC,KAAK,EAC7B,uBAAuB,CAAC,SAAS,EACjC,uBAAuB,CAAC,UAAU,CACnC;QACD,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,sBAAsB,EAAE,qBAAqB,iBAAiB,EAAE,EAAE;aACnE;YACD,OAAO,EAAE,uBAAuB,CAAC,cAAc;YAC/C,aAAa,EAAE,uBAAuB,CAAC,aAAa;YACpD,MAAM,EAAE,uBAAuB,CAAC,MAAM;SACvC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DefaultConnectOptionsConstants,\n InternalEnvironmentVariables,\n ServiceAuth,\n} from \"../common/constants.js\";\nimport customerConfig from \"../common/customerConfig.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport playwrightServiceEntra from \"./playwrightServiceEntra.js\";\nimport type { PlaywrightServiceAdditionalOptions, BrowserConnectOptions } from \"../common/types.js\";\nimport {\n fetchOrValidateAccessToken,\n getAccessToken,\n getServiceWSEndpoint,\n validateMptPAT,\n validatePlaywrightVersion,\n validateServiceUrl,\n exitWithFailureMessage,\n getPlaywrightVersion,\n getVersionInfo,\n throwErrorWithFailureMessage,\n getPackageVersion,\n warnIfAccessTokenCloseToExpiry,\n} from \"../utils/utils.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport type { PlaywrightTestConfig } from \"@playwright/test\";\nimport { globalPaths } from \"./playwrightServiceUtils.js\";\n\nconst performOneTimeOperation = (options?: PlaywrightServiceAdditionalOptions): void => {\n const oneTimeOperationFlag =\n process.env[InternalEnvironmentVariables.ONE_TIME_OPERATION_FLAG] === \"true\";\n if (oneTimeOperationFlag) return;\n process.env[InternalEnvironmentVariables.ONE_TIME_OPERATION_FLAG] = \"true\";\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n warnIfAccessTokenCloseToExpiry();\n }\n};\n\n/**\n * @public\n *\n * Generate playwright configuration integrated with Azure Playwright.\n *\n * @param baseConfig - base playwright configuration\n * @param options - additional options for the service\n * @returns PlaywrightConfig\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { createAzurePlaywrightConfig } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));\n * ```\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n * import { DefaultAzureCredential } from '@azure/identity';\n *\n * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {\n * credential: new DefaultAzureCredential(),\n * serviceAuthType: ServiceAuth.ENTRA_ID,\n * os: ServiceOS.WINDOWS\n * }));\n * ```\n */\nconst createAzurePlaywrightConfig = (\n baseConfig: PlaywrightTestConfig,\n options?: PlaywrightServiceAdditionalOptions,\n): PlaywrightTestConfig => {\n validatePlaywrightVersion();\n validateServiceUrl();\n\n // Set environment variable to indicate user is using service config\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] = \"true\";\n const playwrightVersionInfo = getVersionInfo(getPlaywrightVersion());\n const isMultipleGlobalFileSupported =\n playwrightVersionInfo.major >= 1 && playwrightVersionInfo.minor >= 49;\n if (options?.credential) {\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n }\n\n // if global setup/teardown is string -\n // 1. if multiple global file is supported, convert it to array\n // 2. wrap playwright-service global setup/teardown with customer provided global setup/teardown\n\n // if global setup/teardown is array -\n // 1. if multiple global file is not supported, throw error\n // 2. append playwright-service global setup/teardown with customer provided global setup/teardown\n if (baseConfig && baseConfig.globalSetup) {\n if (typeof baseConfig.globalSetup === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalSetup = [baseConfig.globalSetup];\n } else {\n customerConfig.globalSetup = baseConfig.globalSetup;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalSetup = baseConfig.globalSetup;\n }\n }\n\n if (baseConfig && baseConfig.globalTeardown) {\n if (typeof baseConfig.globalTeardown === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalTeardown = [baseConfig.globalTeardown];\n } else {\n customerConfig.globalTeardown = baseConfig.globalTeardown;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalTeardown = baseConfig.globalTeardown;\n }\n }\n\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n playwrightServiceConfig.setOptions(options);\n playwrightServiceConfig.serviceAuthType =\n options?.serviceAuthType || DefaultConnectOptionsConstants.DEFAULT_SERVICE_AUTH_TYPE;\n\n const globalFunctions: any = {};\n\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n // mpt PAT requested and set by the customer, no need to setup entra lifecycle handlers\n validateMptPAT(exitWithFailureMessage);\n }\n // If multiple global file is supported, append playwright-service global setup/teardown with customer provided global setup/teardown\n if (isMultipleGlobalFileSupported) {\n globalFunctions.globalSetup = [] as string[];\n globalFunctions.globalTeardown = [] as string[];\n if (customerConfig.globalSetup) {\n globalFunctions.globalSetup.push(...(customerConfig.globalSetup as string[]));\n }\n if (customerConfig.globalTeardown) {\n globalFunctions.globalTeardown.push(...(customerConfig.globalTeardown as string[]));\n }\n globalFunctions.globalSetup.push(globalPaths.setup);\n globalFunctions.globalTeardown.push(globalPaths.teardown);\n } else {\n // If multiple global file is not supported, wrap playwright-service global setup/teardown with customer provided global setup/teardown\n globalFunctions.globalSetup = globalPaths.setup;\n globalFunctions.globalTeardown = globalPaths.teardown;\n }\n\n performOneTimeOperation(options);\n\n if (!process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = \"true\";\n console.log(\"\\nRunning tests using Playwright workspaces.\");\n }\n\n return {\n use: {\n connectOptions: {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n playwrightServiceConfig.apiVersion,\n ),\n headers: {\n Authorization: `Bearer ${getAccessToken()}`,\n \"x-ms-package-version\": `@azure/playwright/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.connectTimeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n },\n ...globalFunctions,\n };\n};\n\n/**\n * @public\n *\n * Get connect options required to connect to Azure Playwright's cloud hosted browsers.\n *\n * @param options - additional options for the service\n * @returns BrowserConnectOptions\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions } from \"@azure/playwright\";\n *\n * test('has title', async ({ browserName }) => {\n * const { wsEndpoint, options } = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto('https://playwright.dev/');\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nconst getConnectOptions = async (\n options?: PlaywrightServiceAdditionalOptions,\n): Promise<BrowserConnectOptions> => {\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n\n playwrightServiceConfig.setOptions(options, true);\n performOneTimeOperation(options);\n playwrightServiceConfig.serviceAuthType =\n options?.serviceAuthType || DefaultConnectOptionsConstants.DEFAULT_SERVICE_AUTH_TYPE;\n\n let token: string | undefined;\n if (playwrightServiceConfig.serviceAuthType === ServiceAuth.ENTRA_ID) {\n if (!options?.credential) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n token = await fetchOrValidateAccessToken(options.credential);\n } else if (playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n validateMptPAT(throwErrorWithFailureMessage);\n token = getAccessToken();\n } else {\n throw new Error(ServiceErrorMessageConstants.INVALID_AUTH_TYPE_ERROR.message);\n }\n\n if (!token) {\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);\n }\n\n return {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n playwrightServiceConfig.apiVersion,\n ),\n options: {\n headers: {\n Authorization: `Bearer ${token}`,\n \"x-ms-package-version\": `@azure/playwright/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.connectTimeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n };\n};\n\nexport { createAzurePlaywrightConfig, getConnectOptions };\n"]}
1
+ {"version":3,"file":"playwrightService.js","sourceRoot":"","sources":["../../../src/core/playwrightService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,4BAA4B,EAC5B,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,uBAAuB,GAAG,CAAC,OAA4C,EAAQ,EAAE;IACrF,MAAM,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,uBAAuB,CAAC,KAAK,MAAM,CAAC;IAC/E,IAAI,oBAAoB;QAAE,OAAO;IACjC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC;IAC3E,IAAI,OAAO,EAAE,eAAe,KAAK,WAAW,CAAC,YAAY,EAAE,CAAC;QAC1D,8BAA8B,EAAE,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,2BAA2B,GAAG,CAClC,UAAgC,EAChC,OAA4C,EACtB,EAAE;IACxB,yBAAyB,EAAE,CAAC;IAC5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ed under the MIT License.\n\nimport {\n DefaultConnectOptionsConstants,\n InternalEnvironmentVariables,\n ServiceAuth,\n} from \"../common/constants.js\";\nimport customerConfig from \"../common/customerConfig.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport playwrightServiceEntra from \"./playwrightServiceEntra.js\";\nimport type { PlaywrightServiceAdditionalOptions, BrowserConnectOptions } from \"../common/types.js\";\nimport {\n fetchOrValidateAccessToken,\n getAccessToken,\n getServiceWSEndpoint,\n validateMptPAT,\n validatePlaywrightVersion,\n validateServiceUrl,\n exitWithFailureMessage,\n getPlaywrightVersion,\n getVersionInfo,\n throwErrorWithFailureMessage,\n getPackageVersion,\n warnIfAccessTokenCloseToExpiry,\n} from \"../utils/utils.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport type { PlaywrightTestConfig } from \"@playwright/test\";\nimport { globalPaths } from \"./playwrightServiceUtils.js\";\n\nconst performOneTimeOperation = (options?: PlaywrightServiceAdditionalOptions): void => {\n const oneTimeOperationFlag =\n process.env[InternalEnvironmentVariables.ONE_TIME_OPERATION_FLAG] === \"true\";\n if (oneTimeOperationFlag) return;\n process.env[InternalEnvironmentVariables.ONE_TIME_OPERATION_FLAG] = \"true\";\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n warnIfAccessTokenCloseToExpiry();\n }\n};\n\n/**\n * @public\n *\n * Generate playwright configuration integrated with Azure Playwright.\n *\n * @param baseConfig - base playwright configuration\n * @param options - additional options for the service\n * @returns PlaywrightConfig\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { createAzurePlaywrightConfig } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));\n * ```\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n * import { DefaultAzureCredential } from '@azure/identity';\n *\n * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {\n * credential: new DefaultAzureCredential(),\n * serviceAuthType: ServiceAuth.ENTRA_ID,\n * os: ServiceOS.WINDOWS\n * }));\n * ```\n */\nconst createAzurePlaywrightConfig = (\n baseConfig: PlaywrightTestConfig,\n options?: PlaywrightServiceAdditionalOptions,\n): PlaywrightTestConfig => {\n validatePlaywrightVersion();\n validateServiceUrl();\n\n // Set environment variable to indicate user is using service config\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] = \"true\";\n const playwrightVersionInfo = getVersionInfo(getPlaywrightVersion());\n const isMultipleGlobalFileSupported =\n playwrightVersionInfo.major >= 1 && playwrightVersionInfo.minor >= 49;\n if (options?.credential) {\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n }\n\n // if global setup/teardown is string -\n // 1. if multiple global file is supported, convert it to array\n // 2. wrap playwright-service global setup/teardown with customer provided global setup/teardown\n\n // if global setup/teardown is array -\n // 1. if multiple global file is not supported, throw error\n // 2. append playwright-service global setup/teardown with customer provided global setup/teardown\n if (baseConfig && baseConfig.globalSetup) {\n if (typeof baseConfig.globalSetup === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalSetup = [baseConfig.globalSetup];\n } else {\n customerConfig.globalSetup = baseConfig.globalSetup;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalSetup = baseConfig.globalSetup;\n }\n }\n\n if (baseConfig && baseConfig.globalTeardown) {\n if (typeof baseConfig.globalTeardown === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalTeardown = [baseConfig.globalTeardown];\n } else {\n customerConfig.globalTeardown = baseConfig.globalTeardown;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalTeardown = baseConfig.globalTeardown;\n }\n }\n\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n playwrightServiceConfig.setOptions(options);\n playwrightServiceConfig.serviceAuthType =\n options?.serviceAuthType || DefaultConnectOptionsConstants.DEFAULT_SERVICE_AUTH_TYPE;\n\n const globalFunctions: any = {};\n\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n // mpt PAT requested and set by the customer, no need to setup entra lifecycle handlers\n validateMptPAT(exitWithFailureMessage);\n }\n // If multiple global file is supported, append playwright-service global setup/teardown with customer provided global setup/teardown\n if (isMultipleGlobalFileSupported) {\n globalFunctions.globalSetup = [] as string[];\n globalFunctions.globalTeardown = [] as string[];\n if (customerConfig.globalSetup) {\n globalFunctions.globalSetup.push(...(customerConfig.globalSetup as string[]));\n }\n if (customerConfig.globalTeardown) {\n globalFunctions.globalTeardown.push(...(customerConfig.globalTeardown as string[]));\n }\n globalFunctions.globalSetup.push(globalPaths.setup);\n globalFunctions.globalTeardown.push(globalPaths.teardown);\n } else {\n // If multiple global file is not supported, wrap playwright-service global setup/teardown with customer provided global setup/teardown\n globalFunctions.globalSetup = globalPaths.setup;\n globalFunctions.globalTeardown = globalPaths.teardown;\n }\n\n performOneTimeOperation(options);\n\n if (!process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = \"true\";\n console.log(\"\\nRunning tests using Playwright workspaces.\");\n }\n\n return {\n use: {\n connectOptions: {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n playwrightServiceConfig.apiVersion,\n ),\n headers: {\n Authorization: `Bearer ${getAccessToken()}`,\n \"x-ms-package-version\": `@azure/playwright/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.connectTimeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n },\n ...globalFunctions,\n };\n};\n\n/**\n * @public\n *\n * Get connect options required to connect to Azure Playwright's cloud hosted browsers.\n *\n * @param options - additional options for the service\n * @returns BrowserConnectOptions\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions } from \"@azure/playwright\";\n *\n * test('has title', async ({ browserName }) => {\n * const { wsEndpoint, options } = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto('https://playwright.dev/');\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nconst getConnectOptions = async (\n options?: PlaywrightServiceAdditionalOptions,\n): Promise<BrowserConnectOptions> => {\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n\n playwrightServiceConfig.setOptions(options, true);\n performOneTimeOperation(options);\n playwrightServiceConfig.serviceAuthType =\n options?.serviceAuthType || DefaultConnectOptionsConstants.DEFAULT_SERVICE_AUTH_TYPE;\n\n let token: string | undefined;\n if (playwrightServiceConfig.serviceAuthType === ServiceAuth.ENTRA_ID) {\n if (!options?.credential) {\n throw new Error(ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message);\n }\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n token = await fetchOrValidateAccessToken(options.credential);\n } else if (playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n validateMptPAT(throwErrorWithFailureMessage);\n token = getAccessToken();\n } else {\n throw new Error(ServiceErrorMessageConstants.INVALID_AUTH_TYPE_ERROR.message);\n }\n\n if (!token) {\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN.message);\n }\n\n return {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n playwrightServiceConfig.apiVersion,\n ),\n options: {\n headers: {\n Authorization: `Bearer ${token}`,\n \"x-ms-package-version\": `@azure/playwright/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.connectTimeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n };\n};\n\nexport { createAzurePlaywrightConfig, getConnectOptions };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightReporter.d.ts","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAUtE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,QAAQ;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,kBAAkB,CAAS;IAEnC;;;;OAIG;IAEG,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA8DhD;;OAEG;IAEG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAiCd,gBAAgB;IAsB9B,OAAO,CAAC,iCAAiC;CAuC1C"}
1
+ {"version":3,"file":"playwrightReporter.d.ts","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAetE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,QAAQ;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,kBAAkB,CAAS;IAEnC;;;;OAIG;IAEG,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAsFhD;;OAEG;IAEG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAiCd,gBAAgB;IAsB9B,OAAO,CAAC,iCAAiC;CAuC1C"}
@@ -1,10 +1,11 @@
1
1
  import { PlaywrightReporterStorageManager } from "../utils/playwrightReporterStorageManager.js";
2
- import { getHtmlReporterOutputFolder, getPortalTestRunUrl } from "../utils/utils.js";
2
+ import { getHtmlReporterOutputFolder, getPortalTestRunUrl, getVersionInfo, } from "../utils/utils.js";
3
3
  import { coreLogger } from "../common/logger.js";
4
4
  import { PlaywrightServiceConfig } from "../common/playwrightServiceConfig.js";
5
5
  import { ServiceAuth, InternalEnvironmentVariables } from "../common/constants.js";
6
6
  import { ServiceErrorMessageConstants } from "../common/messages.js";
7
7
  import { PlaywrightServiceClient } from "../utils/PlaywrightServiceClient.js";
8
+ import { getPlaywrightVersion } from "../utils/getPlaywrightVersion.js";
8
9
  /**
9
10
  * Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.
10
11
  */
@@ -20,6 +21,25 @@ export default class PlaywrightReporter {
20
21
  async onBegin(config) {
21
22
  coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);
22
23
  this.config = config;
24
+ // Check Playwright version for reporting feature compatibility
25
+ try {
26
+ const playwrightVersion = getPlaywrightVersion();
27
+ const playwrightVersionInfo = getVersionInfo(playwrightVersion);
28
+ // Check if version is < 1.57
29
+ const isReportingSupportedVersion = playwrightVersionInfo.major > 1 ||
30
+ (playwrightVersionInfo.major === 1 && playwrightVersionInfo.minor >= 57);
31
+ if (!isReportingSupportedVersion) {
32
+ console.error(ServiceErrorMessageConstants.PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING.message);
33
+ this.isReportingEnabled = false;
34
+ return;
35
+ }
36
+ }
37
+ catch (error) {
38
+ coreLogger.error(`Failed to get Playwright version: ${error}`);
39
+ console.error(ServiceErrorMessageConstants.PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING.message);
40
+ this.isReportingEnabled = false;
41
+ return;
42
+ }
23
43
  // Check if using service config
24
44
  const usingServiceConfig = process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === "true";
25
45
  coreLogger.info(`Using service config: ${usingServiceConfig}`);
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightReporter.js","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC7B,MAAM,CAAyB;IAC/B,iBAAiB,GAA6B,IAAI,CAAC;IACnD,kBAAkB,GAAG,KAAK,CAAC;IAEnC;;;;OAIG;IAEH,KAAK,CAAC,OAAO,CAAC,MAAkB;QAC9B,UAAU,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAEvF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,gCAAgC;QAChC,MAAM,kBAAkB,GACtB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,oBAAoB,CAAC,KAAK,MAAM,CAAC;QAC5E,UAAU,CAAC,IAAI,CAAC,yBAAyB,kBAAkB,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,C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CAAC,UAAU,CAAC,CAClC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,gCAAgC;QAChC,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,gFAAgF;QAChF,IAAI,kBAAkB,KAAK,CAAC,CAAC,IAAI,iBAAiB,GAAG,kBAAkB,EAAE,CAAC;YACxE,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { FullConfig, Reporter } from \"@playwright/test/reporter\";\nimport { PlaywrightReporterStorageManager } from \"../utils/playwrightReporterStorageManager.js\";\nimport { getHtmlReporterOutputFolder, getPortalTestRunUrl } from \"../utils/utils.js\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { ServiceAuth, InternalEnvironmentVariables } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { PlaywrightServiceClient } from \"../utils/PlaywrightServiceClient.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\n/**\n * Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.\n */\n\nexport default class PlaywrightReporter implements Reporter {\n private config: FullConfig | undefined;\n private workspaceMetadata: WorkspaceMetaData | null = null;\n private isReportingEnabled = false;\n\n /**\n * Called when test run begins. Stores configuration for later use and validates serviceAuthType and\n * retrieves workspace metadata.\n * @param config - Playwright test configuration\n */\n\n async onBegin(config: FullConfig): Promise<void> {\n coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);\n\n this.config = config;\n\n // Check if using service config\n const usingServiceConfig =\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === \"true\";\n coreLogger.info(`Using service config: ${usingServiceConfig}`);\n if (!usingServiceConfig) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_SERVICE_CONFIG.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check if test run creation was successful\n const testRunCreationSuccess =\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] === \"true\";\n if (!testRunCreationSuccess) {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n console.error(ServiceErrorMessageConstants.REPORTING_TEST_RUN_FAILED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check authentication\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n coreLogger.info(`Current authentication type: ${playwrightServiceConfig.serviceAuthType}`);\n const isUsingAccessToken = playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN;\n if (isUsingAccessToken) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_ENTRA_AUTH.message);\n this.isReportingEnabled = false;\n return;\n }\n coreLogger.info(\"Authentication validation passed - using ENTRA_ID\");\n\n // Get workspace metadata for later use\n try {\n const playwrightServiceApiClient = new PlaywrightServiceClient();\n this.workspaceMetadata = await playwrightServiceApiClient.getWorkspaceMetadata();\n\n if (!this.workspaceMetadata?.storageUri) {\n console.error(ServiceErrorMessageConstants.WORKSPACE_REPORTING_DISABLED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n this.isReportingEnabled = true;\n\n this.validateHtmlReporterConfiguration(config);\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.REPORTING_ENABLED.message);\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\n `${ServiceErrorMessageConstants.WORKSPACE_METADATA_FETCH_FAILED.message}Error: ${errorMessage} `,\n );\n this.isReportingEnabled = false;\n }\n }\n\n /**\n * Called when test run ends. Uploads Playwright test report to Azure Storage if reporting is enabled.\n */\n\n async onEnd(): Promise<void> {\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.COLLECTING_ARTIFACTS.message);\n const uploadResult = await this.uploadHtmlReport();\n\n if (uploadResult.success) {\n if (\n uploadResult.partialSuccess &&\n uploadResult.failedFileDetails &&\n uploadResult.failedFileDetails.length > 0\n ) {\n console.log(\"Warning: Failed to upload the following files:\");\n uploadResult.failedFileDetails.forEach((fileDetail) => {\n console.log(` - ${fileDetail.fileName}, ERROR: ${fileDetail.error}`);\n });\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_PARTIAL.message);\n } else {\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_SUCCESS.message);\n }\n // Display portal URL for both full and partial success\n if (this.workspaceMetadata) {\n const portalUrl = getPortalTestRunUrl(this.workspaceMetadata);\n console.log(ServiceErrorMessageConstants.TEST_REPORT_VIEW_URL.formatWithUrl(portalUrl));\n }\n } else {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n if (uploadResult.errorMessage) {\n console.error(`Error: ${uploadResult.errorMessage}`);\n }\n }\n }\n }\n\n private async uploadHtmlReport(): Promise<UploadResult> {\n try {\n const outputFolder = getHtmlReporterOutputFolder(this.config);\n coreLogger.info(`Resolved Playwright test report output folder: ${outputFolder}`);\n const storageManager = new PlaywrightReporterStorageManager();\n coreLogger.info(\"Starting Playwright test report upload process\");\n const uploadResult = await storageManager.uploadPlaywrightHtmlReportAfterTests(\n outputFolder,\n this.workspaceMetadata,\n );\n\n if (uploadResult.success) {\n coreLogger.info(`Playwright Test report uploaded successfully to Azure Storage.`);\n }\n return uploadResult;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n private validateHtmlReporterConfiguration(config: FullConfig): void {\n if (!config.reporter || !Array.isArray(config.reporter)) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n const htmlReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return reporterName === \"html\";\n });\n\n const azureReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return (\n typeof reporterName === \"string\" &&\n reporterName.includes(\"playwright\") &&\n reporterName.includes(\"reporter\")\n );\n });\n\n // Validate HTML reporter exists\n if (htmlReporterIndex === -1) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Validate HTML reporter comes before Azure reporter (if Azure reporter exists)\n if (azureReporterIndex !== -1 && htmlReporterIndex > azureReporterIndex) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n coreLogger.info(\n \"HTML reporter validation passed - HTML reporter is configured and properly ordered\",\n );\n }\n}\n"]}
1
+ {"version":3,"file":"playwrightReporter.js","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCA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AC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7E,OAAO,CACL,OAAO,YAAY,KAAK,QAAQ;gBAChC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC;gBACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAClC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,gCAAgC;QAChC,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,gFAAgF;QAChF,IAAI,kBAAkB,KAAK,CAAC,CAAC,IAAI,iBAAiB,GAAG,kBAAkB,EAAE,CAAC;YACxE,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { FullConfig, Reporter } from \"@playwright/test/reporter\";\nimport { PlaywrightReporterStorageManager } from \"../utils/playwrightReporterStorageManager.js\";\nimport {\n getHtmlReporterOutputFolder,\n getPortalTestRunUrl,\n getVersionInfo,\n} from \"../utils/utils.js\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { ServiceAuth, InternalEnvironmentVariables } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { PlaywrightServiceClient } from \"../utils/PlaywrightServiceClient.js\";\nimport { getPlaywrightVersion } from \"../utils/getPlaywrightVersion.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\n/**\n * Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.\n */\n\nexport default class PlaywrightReporter implements Reporter {\n private config: FullConfig | undefined;\n private workspaceMetadata: WorkspaceMetaData | null = null;\n private isReportingEnabled = false;\n\n /**\n * Called when test run begins. Stores configuration for later use and validates serviceAuthType and\n * retrieves workspace metadata.\n * @param config - Playwright test configuration\n */\n\n async onBegin(config: FullConfig): Promise<void> {\n coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);\n\n this.config = config;\n\n // Check Playwright version for reporting feature compatibility\n try {\n const playwrightVersion = getPlaywrightVersion();\n const playwrightVersionInfo = getVersionInfo(playwrightVersion);\n\n // Check if version is < 1.57\n const isReportingSupportedVersion =\n playwrightVersionInfo.major > 1 ||\n (playwrightVersionInfo.major === 1 && playwrightVersionInfo.minor >= 57);\n\n if (!isReportingSupportedVersion) {\n console.error(\n ServiceErrorMessageConstants.PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING.message,\n );\n this.isReportingEnabled = false;\n return;\n }\n } catch (error) {\n coreLogger.error(`Failed to get Playwright version: ${error}`);\n console.error(ServiceErrorMessageConstants.PLAYWRIGHT_VERSION_TOO_OLD_FOR_REPORTING.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check if using service config\n const usingServiceConfig =\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === \"true\";\n coreLogger.info(`Using service config: ${usingServiceConfig}`);\n if (!usingServiceConfig) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_SERVICE_CONFIG.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check if test run creation was successful\n const testRunCreationSuccess =\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] === \"true\";\n if (!testRunCreationSuccess) {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n console.error(ServiceErrorMessageConstants.REPORTING_TEST_RUN_FAILED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check authentication\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n coreLogger.info(`Current authentication type: ${playwrightServiceConfig.serviceAuthType}`);\n const isUsingAccessToken = playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN;\n if (isUsingAccessToken) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_ENTRA_AUTH.message);\n this.isReportingEnabled = false;\n return;\n }\n coreLogger.info(\"Authentication validation passed - using ENTRA_ID\");\n\n // Get workspace metadata for later use\n try {\n const playwrightServiceApiClient = new PlaywrightServiceClient();\n this.workspaceMetadata = await playwrightServiceApiClient.getWorkspaceMetadata();\n\n if (!this.workspaceMetadata?.storageUri) {\n console.error(ServiceErrorMessageConstants.WORKSPACE_REPORTING_DISABLED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n this.isReportingEnabled = true;\n\n this.validateHtmlReporterConfiguration(config);\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.REPORTING_ENABLED.message);\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\n `${ServiceErrorMessageConstants.WORKSPACE_METADATA_FETCH_FAILED.message}Error: ${errorMessage} `,\n );\n this.isReportingEnabled = false;\n }\n }\n\n /**\n * Called when test run ends. Uploads Playwright test report to Azure Storage if reporting is enabled.\n */\n\n async onEnd(): Promise<void> {\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.COLLECTING_ARTIFACTS.message);\n const uploadResult = await this.uploadHtmlReport();\n\n if (uploadResult.success) {\n if (\n uploadResult.partialSuccess &&\n uploadResult.failedFileDetails &&\n uploadResult.failedFileDetails.length > 0\n ) {\n console.log(\"Warning: Failed to upload the following files:\");\n uploadResult.failedFileDetails.forEach((fileDetail) => {\n console.log(` - ${fileDetail.fileName}, ERROR: ${fileDetail.error}`);\n });\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_PARTIAL.message);\n } else {\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_SUCCESS.message);\n }\n // Display portal URL for both full and partial success\n if (this.workspaceMetadata) {\n const portalUrl = getPortalTestRunUrl(this.workspaceMetadata);\n console.log(ServiceErrorMessageConstants.TEST_REPORT_VIEW_URL.formatWithUrl(portalUrl));\n }\n } else {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n if (uploadResult.errorMessage) {\n console.error(`Error: ${uploadResult.errorMessage}`);\n }\n }\n }\n }\n\n private async uploadHtmlReport(): Promise<UploadResult> {\n try {\n const outputFolder = getHtmlReporterOutputFolder(this.config);\n coreLogger.info(`Resolved Playwright test report output folder: ${outputFolder}`);\n const storageManager = new PlaywrightReporterStorageManager();\n coreLogger.info(\"Starting Playwright test report upload process\");\n const uploadResult = await storageManager.uploadPlaywrightHtmlReportAfterTests(\n outputFolder,\n this.workspaceMetadata,\n );\n\n if (uploadResult.success) {\n coreLogger.info(`Playwright Test report uploaded successfully to Azure Storage.`);\n }\n return uploadResult;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n private validateHtmlReporterConfiguration(config: FullConfig): void {\n if (!config.reporter || !Array.isArray(config.reporter)) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n const htmlReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return reporterName === \"html\";\n });\n\n const azureReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return (\n typeof reporterName === \"string\" &&\n reporterName.includes(\"playwright\") &&\n reporterName.includes(\"reporter\")\n );\n });\n\n // Validate HTML reporter exists\n if (htmlReporterIndex === -1) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Validate HTML reporter comes before Azure reporter (if Azure reporter exists)\n if (azureReporterIndex !== -1 && htmlReporterIndex > azureReporterIndex) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n coreLogger.info(\n \"HTML reporter validation passed - HTML reporter is configured and properly ordered\",\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,WAAW,EAEX,SAAS,EACT,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAgB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,iBAAiB,QAAO,MAapC,CAAC;AAIF,eAAO,MAAM,sBAAsB,GACjC,OAAO;IACL,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3D,EACD,eAAe,MAAM,KACpB,KAUF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,OAAO;IACL,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3D,EACD,eAAe,MAAM,KACpB,KASF,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAAO;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf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version";
33
33
  };
34
- // const playwrightServiceConfig = new PlaywrightServiceConfig();
35
34
  export const exitWithFailureMessage = (error, errorDetails) => {
36
35
  console.log();
37
36
  if (error.formatWithErrorDetails && errorDetails) {
@@ -104,7 +103,7 @@ export const validateMptPAT = (validationFailureCallback) => {
104
103
  const accessToken = getAccessToken();
105
104
  const result = populateValuesFromServiceUrl();
106
105
  if (!accessToken) {
107
- validationFailureCallback(ServiceErrorMessageConstants.NO_AUTH_ERROR);
106
+ validationFailureCallback(ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN);
108
107
  }
109
108
  const claims = parseJwt(accessToken);
110
109
  if (!claims.exp) {
@@ -134,7 +133,7 @@ const warnAboutTokenExpiry = (expirationTime, currentTime) => {
134
133
  export const warnIfAccessTokenCloseToExpiry = () => {
135
134
  const accessToken = getAccessToken();
136
135
  if (!accessToken) {
137
- throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);
136
+ throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN.message);
138
137
  }
139
138
  const claims = parseJwt(accessToken);
140
139
  const currentTime = Date.now();
@@ -150,7 +149,7 @@ export const fetchOrValidateAccessToken = async (credential) => {
150
149
  }
151
150
  const token = getAccessToken();
152
151
  if (!token) {
153
- throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);
152
+ throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR_ENTRA_TOKEN.message);
154
153
  }
155
154
  return token;
156
155
  };