@azure/playwright 1.0.0-beta.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/common/constants.js +1 -1
  3. package/dist/browser/common/constants.js.map +1 -1
  4. package/dist/browser/common/messages.js +3 -3
  5. package/dist/browser/common/messages.js.map +1 -1
  6. package/dist/browser/common/playwrightServiceConfig.d.ts +1 -1
  7. package/dist/browser/common/playwrightServiceConfig.d.ts.map +1 -1
  8. package/dist/browser/common/playwrightServiceConfig.js +4 -4
  9. package/dist/browser/common/playwrightServiceConfig.js.map +1 -1
  10. package/dist/browser/common/types.d.ts +3 -3
  11. package/dist/browser/common/types.d.ts.map +1 -1
  12. package/dist/browser/common/types.js.map +1 -1
  13. package/dist/browser/core/initializePlaywrightServiceTestRun.d.ts +1 -1
  14. package/dist/browser/core/initializePlaywrightServiceTestRun.js +1 -1
  15. package/dist/browser/core/initializePlaywrightServiceTestRun.js.map +1 -1
  16. package/dist/browser/core/playwrightService.d.ts +10 -8
  17. package/dist/browser/core/playwrightService.d.ts.map +1 -1
  18. package/dist/browser/core/playwrightService.js +23 -21
  19. package/dist/browser/core/playwrightService.js.map +1 -1
  20. package/dist/browser/index.d.ts +2 -2
  21. package/dist/browser/index.d.ts.map +1 -1
  22. package/dist/browser/index.js +2 -2
  23. package/dist/browser/index.js.map +1 -1
  24. package/dist/browser/utils/playwrightServiceApicall.d.ts +1 -1
  25. package/dist/browser/utils/playwrightServiceApicall.js +1 -1
  26. package/dist/browser/utils/playwrightServiceApicall.js.map +1 -1
  27. package/dist/commonjs/common/constants.js +1 -1
  28. package/dist/commonjs/common/constants.js.map +1 -1
  29. package/dist/commonjs/common/messages.js +3 -3
  30. package/dist/commonjs/common/messages.js.map +1 -1
  31. package/dist/commonjs/common/playwrightServiceConfig.d.ts +1 -1
  32. package/dist/commonjs/common/playwrightServiceConfig.d.ts.map +1 -1
  33. package/dist/commonjs/common/playwrightServiceConfig.js +4 -4
  34. package/dist/commonjs/common/playwrightServiceConfig.js.map +1 -1
  35. package/dist/commonjs/common/types.d.ts +3 -3
  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/initializePlaywrightServiceTestRun.d.ts +1 -1
  39. package/dist/commonjs/core/initializePlaywrightServiceTestRun.js +1 -1
  40. package/dist/commonjs/core/initializePlaywrightServiceTestRun.js.map +1 -1
  41. package/dist/commonjs/core/playwrightService.d.ts +10 -8
  42. package/dist/commonjs/core/playwrightService.d.ts.map +1 -1
  43. package/dist/commonjs/core/playwrightService.js +24 -22
  44. package/dist/commonjs/core/playwrightService.js.map +1 -1
  45. package/dist/commonjs/index.d.ts +2 -2
  46. package/dist/commonjs/index.d.ts.map +1 -1
  47. package/dist/commonjs/index.js +2 -2
  48. package/dist/commonjs/index.js.map +1 -1
  49. package/dist/commonjs/tsdoc-metadata.json +1 -1
  50. package/dist/commonjs/utils/playwrightServiceApicall.d.ts +1 -1
  51. package/dist/commonjs/utils/playwrightServiceApicall.js +1 -1
  52. package/dist/commonjs/utils/playwrightServiceApicall.js.map +1 -1
  53. package/dist/esm/common/constants.js +1 -1
  54. package/dist/esm/common/constants.js.map +1 -1
  55. package/dist/esm/common/messages.js +3 -3
  56. package/dist/esm/common/messages.js.map +1 -1
  57. package/dist/esm/common/playwrightServiceConfig.d.ts +1 -1
  58. package/dist/esm/common/playwrightServiceConfig.d.ts.map +1 -1
  59. package/dist/esm/common/playwrightServiceConfig.js +4 -4
  60. package/dist/esm/common/playwrightServiceConfig.js.map +1 -1
  61. package/dist/esm/common/types.d.ts +3 -3
  62. package/dist/esm/common/types.d.ts.map +1 -1
  63. package/dist/esm/common/types.js.map +1 -1
  64. package/dist/esm/core/initializePlaywrightServiceTestRun.d.ts +1 -1
  65. package/dist/esm/core/initializePlaywrightServiceTestRun.js +1 -1
  66. package/dist/esm/core/initializePlaywrightServiceTestRun.js.map +1 -1
  67. package/dist/esm/core/playwrightService.d.ts +10 -8
  68. package/dist/esm/core/playwrightService.d.ts.map +1 -1
  69. package/dist/esm/core/playwrightService.js +23 -21
  70. package/dist/esm/core/playwrightService.js.map +1 -1
  71. package/dist/esm/index.d.ts +2 -2
  72. package/dist/esm/index.d.ts.map +1 -1
  73. package/dist/esm/index.js +2 -2
  74. package/dist/esm/index.js.map +1 -1
  75. package/dist/esm/utils/playwrightServiceApicall.d.ts +1 -1
  76. package/dist/esm/utils/playwrightServiceApicall.js +1 -1
  77. package/dist/esm/utils/playwrightServiceApicall.js.map +1 -1
  78. package/dist/react-native/common/constants.js +1 -1
  79. package/dist/react-native/common/constants.js.map +1 -1
  80. package/dist/react-native/common/messages.js +3 -3
  81. package/dist/react-native/common/messages.js.map +1 -1
  82. package/dist/react-native/common/playwrightServiceConfig.d.ts +1 -1
  83. package/dist/react-native/common/playwrightServiceConfig.d.ts.map +1 -1
  84. package/dist/react-native/common/playwrightServiceConfig.js +4 -4
  85. package/dist/react-native/common/playwrightServiceConfig.js.map +1 -1
  86. package/dist/react-native/common/types.d.ts +3 -3
  87. package/dist/react-native/common/types.d.ts.map +1 -1
  88. package/dist/react-native/common/types.js.map +1 -1
  89. package/dist/react-native/core/initializePlaywrightServiceTestRun.d.ts +1 -1
  90. package/dist/react-native/core/initializePlaywrightServiceTestRun.js +1 -1
  91. package/dist/react-native/core/initializePlaywrightServiceTestRun.js.map +1 -1
  92. package/dist/react-native/core/playwrightService.d.ts +10 -8
  93. package/dist/react-native/core/playwrightService.d.ts.map +1 -1
  94. package/dist/react-native/core/playwrightService.js +23 -21
  95. package/dist/react-native/core/playwrightService.js.map +1 -1
  96. package/dist/react-native/index.d.ts +2 -2
  97. package/dist/react-native/index.d.ts.map +1 -1
  98. package/dist/react-native/index.js +2 -2
  99. package/dist/react-native/index.js.map +1 -1
  100. package/dist/react-native/utils/playwrightServiceApicall.d.ts +1 -1
  101. package/dist/react-native/utils/playwrightServiceApicall.js +1 -1
  102. package/dist/react-native/utils/playwrightServiceApicall.js.map +1 -1
  103. package/package.json +5 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Azure Playwright preview
1
+ # Azure Playwright
2
2
 
3
- Azure Playwright is a fully managed Azure service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality. The service also enables you to publish test results and related artifacts to the service and view them in the service portal enabling faster and easier troubleshooting. With Azure Playwright service, you can release features faster and more confidently.
3
+ Azure Playwright is a fully managed Azure service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality. With Playwright workspaces, you can release features faster and more confidently.
4
4
 
5
5
  Ready to get started? Jump into our [quickstart guide](#get-started)!
6
6
 
@@ -72,7 +72,7 @@ Installing the service package will create a service config file named `playwrig
72
72
 
73
73
  The service configuration serves to:
74
74
 
75
- - Direct and authenticate Playwright to the Azure Playwright service.
75
+ - Direct and authenticate Playwright to the Playwright Workspaces.
76
76
  - Override timeouts for service operations, if needed.
77
77
 
78
78
  > Make sure your project uses @playwright/test version 1.47 or above.
@@ -55,7 +55,7 @@ export const Constants = {
55
55
  SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,
56
56
  OneDayInMS: 24 * 60 * 60 * 1000,
57
57
  MinimumSupportedPlaywrightVersion: "1.47.0",
58
- LatestAPIVersion: "2025-07-01-preview",
58
+ LatestAPIVersion: "2025-09-01",
59
59
  HTTP_CALL_TIMEOUT: 10000,
60
60
  };
61
61
  export const InternalEnvironmentVariables = {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,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AE,KAAK;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,oBAAoB,EAAE,uBAAuB;IAC7C,eAAe,EAAE,kBAAkB;IACnC,kBAAkB,EAAE,qBAAqB;IACzC,6BAA6B,EAAE,gCAAgC;IAC/D,cAAc,EAAE,iBAAiB;IACjC,uBAAuB,EAAE,0BAA0B;IACnD,oBAAoB,EAAE,uBAAuB;CAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Azure Playwright cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Azure Playwright\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Azure Playwright\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n};\n\nexport const GitHubActionsConstants = {\n GIT_VERSION_COMMAND: \"git --version\",\n GIT_REV_PARSE: \"git rev-parse --is-inside-work-tree\",\n GIT_COMMIT_MESSAGE_COMMAND: 'git log -1 --pretty=format:\"%s\"',\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n DEFAULT_SERVICE_AUTH_TYPE: ServiceAuth.ENTRA_ID,\n};\n\nexport const SDKLanguage = {\n JAVASCRIPT: \"JAVASCRIPT\",\n TYPESCRIPT: \"TYPESCRIPT\",\n CSHARP: \"CSHARP\",\n};\n\nexport const RunConfigConstants = {\n TEST_FRAMEWORK_NAME: \"PLAYWRIGHT\",\n TEST_SDK_LANGUAGE: SDKLanguage.JAVASCRIPT,\n TEST_FRAMEWORK_RUNNERNAME: \"PLAYWRIGHT\",\n};\n\nexport const Constants = {\n SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,\n OneDayInMS: 24 * 60 * 60 * 1000,\n MinimumSupportedPlaywrightVersion: \"1.47.0\",\n LatestAPIVersion: \"2025-07-01-preview\",\n HTTP_CALL_TIMEOUT: 10000,\n};\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_SERVICE_RUN_NAME: \"_MPT_SERVICE_RUN_NAME\",\n MPT_API_VERSION: \"_MPT_API_VERSION\",\n MPT_SERVICE_RUN_ID: \"_MPT_SERVICE_RUN_ID\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n MPT_SERVICE_OS: \"_MPT_SERVICE_OS\",\n ONE_TIME_OPERATION_FLAG: \"_ONE_TIME_OPERATION_FLAG\",\n USING_SERVICE_CONFIG: \"_USING_SERVICE_CONFIG\",\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;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GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,oBAAoB,EAAE,uBAAuB;IAC7C,eAAe,EAAE,kBAAkB;IACnC,kBAAkB,EAAE,qBAAqB;IACzC,6BAA6B,EAAE,gCAAgC;IAC/D,cAAc,EAAE,iBAAiB;IACjC,uBAAuB,EAAE,0BAA0B;IACnD,oBAAoB,EAAE,uBAAuB;CAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Azure Playwright cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Azure Playwright\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Azure Playwright\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n};\n\nexport const GitHubActionsConstants = {\n GIT_VERSION_COMMAND: \"git --version\",\n GIT_REV_PARSE: \"git rev-parse --is-inside-work-tree\",\n GIT_COMMIT_MESSAGE_COMMAND: 'git log -1 --pretty=format:\"%s\"',\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n DEFAULT_SERVICE_AUTH_TYPE: ServiceAuth.ENTRA_ID,\n};\n\nexport const SDKLanguage = {\n JAVASCRIPT: \"JAVASCRIPT\",\n TYPESCRIPT: \"TYPESCRIPT\",\n CSHARP: \"CSHARP\",\n};\n\nexport const RunConfigConstants = {\n TEST_FRAMEWORK_NAME: \"PLAYWRIGHT\",\n TEST_SDK_LANGUAGE: SDKLanguage.JAVASCRIPT,\n TEST_FRAMEWORK_RUNNERNAME: \"PLAYWRIGHT\",\n};\n\nexport const Constants = {\n SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,\n OneDayInMS: 24 * 60 * 60 * 1000,\n MinimumSupportedPlaywrightVersion: \"1.47.0\",\n LatestAPIVersion: \"2025-09-01\",\n HTTP_CALL_TIMEOUT: 10000,\n};\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_SERVICE_RUN_NAME: \"_MPT_SERVICE_RUN_NAME\",\n MPT_API_VERSION: \"_MPT_API_VERSION\",\n MPT_SERVICE_RUN_ID: \"_MPT_SERVICE_RUN_ID\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n MPT_SERVICE_OS: \"_MPT_SERVICE_OS\",\n ONE_TIME_OPERATION_FLAG: \"_ONE_TIME_OPERATION_FLAG\",\n USING_SERVICE_CONFIG: \"_USING_SERVICE_CONFIG\",\n};\n"]}
@@ -39,12 +39,12 @@ export const ServiceErrorMessageConstants = {
39
39
  },
40
40
  FAILED_TO_CREATE_TEST_RUN: {
41
41
  key: "FailedToCreateTestRun",
42
- message: "Failed to create the test run in the Playwright service. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.",
43
- formatWithErrorDetails: (errorDetails) => `Failed to create the test run in the Playwright service. Error: ${errorDetails}. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.`,
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.`,
44
44
  },
45
45
  INVALID_PARAM_WITH_SERVICE_CONFIG: {
46
46
  key: "InvalidParamWithServiceConfig",
47
- message: `Remove serviceAuth, runId, and runName from getConnectOptions when using getServiceConfig. Configure these options through getServiceConfig instead.`,
47
+ message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,
48
48
  },
49
49
  INVALID_RUN_ID_FORMAT: {
50
50
  key: "InvalidRunIdFormat",
@@ -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,uHAAuH;KAC1H;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,8EAA8E;KACxF;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,4DAA4D;KACtE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,sBAAsB;QAC3B,OAAO,EACL,8IAA8I;KACjJ;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EACL,wIAAwI;QAC1I,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,mEAAmE,YAAY,iFAAiF;KACnK;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EAAE,sJAAsJ;KAChK;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,qFAAqF;KAC/F;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,sBAAsB;QAC3B,OAAO,EAAE,oFAAoF;KAC9F;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 service. 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 service. 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 getServiceConfig. Configure these options through getServiceConfig 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};\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;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,uHAAuH;KAC1H;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,8EAA8E;KACxF;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,4DAA4D;KACtE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,sBAAsB;QAC3B,OAAO,EACL,8IAA8I;KACjJ;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EACL,2IAA2I;QAC7I,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,sEAAsE,YAAY,iFAAiF;KACtK;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EAAE,4KAA4K;KACtL;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,qFAAqF;KAC/F;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,sBAAsB;QAC3B,OAAO,EAAE,oFAAoF;KAC9F;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};\n"]}
@@ -2,7 +2,7 @@ import type { PlaywrightServiceAdditionalOptions, OsType } from "./types.js";
2
2
  declare class PlaywrightServiceConfig {
3
3
  serviceOs: OsType;
4
4
  runId: string;
5
- timeout: number;
5
+ connectTimeout: number;
6
6
  slowMo: number;
7
7
  exposeNetwork: string;
8
8
  runName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceConfig.d.ts","sourceRoot":"","sources":["../../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAM7E,cAAM,uBAAuB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,gBAAgB,CAAgC;;IAcxD,WAAkB,QAAQ,IAAI,uBAAuB,CAKpD;IAED,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,eAAe,CAAC,KAAK,EAAE,MAAM,EAEvC;IAEY,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxC,eAAe,GAAI,UAAU,kCAAkC,KAAG,IAAI,CAYpE;IAEF,UAAU,GACR,UAAU,kCAAkC,EAC5C,sBAAqB,OAAe,KACnC,IAAI,CAqCL;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"playwrightServiceConfig.d.ts","sourceRoot":"","sources":["../../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAM7E,cAAM,uBAAuB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,gBAAgB,CAAgC;;IAcxD,WAAkB,QAAQ,IAAI,uBAAuB,CAKpD;IAED,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,eAAe,CAAC,KAAK,EAAE,MAAM,EAEvC;IAEY,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxC,eAAe,GAAI,UAAU,kCAAkC,KAAG,IAAI,CAYpE;IAEF,UAAU,GACR,UAAU,kCAAkC,EAC5C,sBAAqB,OAAe,KACnC,IAAI,CAqCL;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -8,7 +8,7 @@ import { ServiceErrorMessageConstants } from "./messages.js";
8
8
  class PlaywrightServiceConfig {
9
9
  serviceOs;
10
10
  runId;
11
- timeout;
11
+ connectTimeout;
12
12
  slowMo;
13
13
  exposeNetwork;
14
14
  runName;
@@ -19,7 +19,7 @@ class PlaywrightServiceConfig {
19
19
  DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS);
20
20
  this.runName = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] || "";
21
21
  this.runId = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] || "";
22
- this.timeout = DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;
22
+ this.connectTimeout = DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;
23
23
  this.slowMo = DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;
24
24
  this.exposeNetwork = DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;
25
25
  this.apiVersion =
@@ -89,8 +89,8 @@ class PlaywrightServiceConfig {
89
89
  if (options?.slowMo) {
90
90
  this.slowMo = options.slowMo;
91
91
  }
92
- if (options?.timeout) {
93
- this.timeout = options.timeout;
92
+ if (options?.connectTimeout) {
93
+ this.connectTimeout = options.connectTimeout;
94
94
  }
95
95
  };
96
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceConfig.js","sourceRoot":"","sources":["../../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,SAAS,EACT,8BAA8B,EAC9B,4BAA4B,EAC5B,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,MAAM,uBAAuB;IACpB,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,aAAa,CAAS;IACtB,OAAO,CAAS;IAChB,UAAU,CAAS;IAClB,gBAAgB,GAAW,WAAW,CAAC,QAAQ,CAAC;IAExD;QACE,IAAI,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,cAAc,CAAC;YACxE,8BAA8B,CAAC,kBAAkB,CAAW,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAChF,IAAI,CAAC,OAAO,GAAG,8BAA8B,CAAC,eAAe,CAAC;QAC9D,IAAI,CAAC,MAAM,GAAG,8BAA8B,CAAC,eAAe,CAAC;QAC7D,IAAI,CAAC,aAAa,GAAG,8BAA8B,CAAC,sBAAsB,CAAC;QAC3E,IAAI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,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5E,CAAC;QACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC/B,CAAC;QACD,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n Constants,\n DefaultConnectOptionsConstants,\n InternalEnvironmentVariables,\n ServiceAuth,\n} from \"./constants.js\";\nimport type { PlaywrightServiceAdditionalOptions, OsType } from \"./types.js\";\nimport { getAndSetRunId, getRunName, ValidateRunID } from \"../utils/utils.js\";\nimport { CIInfoProvider } from \"../utils/cIInfoProvider.js\";\nimport { state } from \"./state.js\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nclass PlaywrightServiceConfig {\n public serviceOs: OsType;\n public runId: string;\n public timeout: number;\n public slowMo: number;\n public exposeNetwork: string;\n public runName: string;\n public apiVersion: string;\n private _serviceAuthType: string = ServiceAuth.ENTRA_ID;\n\n constructor() {\n this.serviceOs = (process.env[InternalEnvironmentVariables.MPT_SERVICE_OS] ||\n DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS) as OsType;\n this.runName = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] || \"\";\n this.runId = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] || \"\";\n this.timeout = DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;\n this.slowMo = DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;\n this.exposeNetwork = DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;\n this.apiVersion =\n process.env[InternalEnvironmentVariables.MPT_API_VERSION] || Constants.LatestAPIVersion;\n }\n\n public static get instance(): PlaywrightServiceConfig {\n if (!state.playwrightServiceConfig) {\n state.playwrightServiceConfig = new PlaywrightServiceConfig();\n }\n return state.playwrightServiceConfig;\n }\n\n public get serviceAuthType(): string {\n return this._serviceAuthType;\n }\n\n public set serviceAuthType(value: string) {\n this._serviceAuthType = value;\n }\n\n public async initialize(): Promise<void> {\n if (!this.runName) {\n const ciConfigInfo = CIInfoProvider.getCIInfo();\n this.runName = await getRunName(ciConfigInfo);\n }\n }\n\n validateOptions = (options?: PlaywrightServiceAdditionalOptions): void => {\n if (!options) return;\n\n const isUsingServiceConfig =\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === \"true\";\n if (isUsingServiceConfig) {\n if (options.serviceAuthType || options.runId || options.runName) {\n const errorMessage = ServiceErrorMessageConstants.INVALID_PARAM_WITH_SERVICE_CONFIG.message;\n throw new Error(errorMessage);\n }\n return;\n }\n };\n\n setOptions = (\n options?: PlaywrightServiceAdditionalOptions,\n isGetConnectOptions: boolean = false,\n ): void => {\n if (isGetConnectOptions) {\n this.validateOptions(options);\n }\n\n if (options?.exposeNetwork) {\n this.exposeNetwork = options.exposeNetwork;\n }\n if (options?.apiVersion) {\n if (!process.env[InternalEnvironmentVariables.MPT_API_VERSION]) {\n process.env[InternalEnvironmentVariables.MPT_API_VERSION] = options.apiVersion;\n }\n this.apiVersion = options.apiVersion;\n }\n if (!process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID]) {\n if (options?.runId) {\n ValidateRunID(options.runId);\n this.runId = options.runId;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = this.runId;\n } else {\n this.runId = getAndSetRunId();\n }\n }\n if (!process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] && options?.runName) {\n this.runName = options.runName;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] = this.runName;\n }\n if (options?.os) {\n this.serviceOs = options.os;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_OS] = this.serviceOs;\n }\n if (options?.slowMo) {\n this.slowMo = options.slowMo;\n }\n if (options?.timeout) {\n this.timeout = options.timeout;\n }\n };\n}\n\nexport { PlaywrightServiceConfig };\n"]}
1
+ {"version":3,"file":"playwrightServiceConfig.js","sourceRoot":"","sources":["../../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,SAAS,EACT,8BAA8B,EAC9B,4BAA4B,EAC5B,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,MAAM,uBAAuB;IACpB,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,cAAc,CAAS;IACvB,MAAM,CAAS;IACf,aAAa,CAAS;IACtB,OAAO,CAAS;IAChB,UAAU,CAAS;IAClB,gBAAgB,GAAW,WAAW,CAAC,QAAQ,CAAC;IAExD;QACE,IAAI,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,cAAc,CAAC;YACxE,8BAA8B,CAAC,kBAAkB,CAAW,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;QACpF,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAChF,IAAI,CAAC,cAAc,GAAG,8BAA8B,CAAC,eAAe,CAAC;QACrE,IAAI,CAAC,MAAM,GAAG,8BA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;QAChF,CAAC;QACD,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5E,CAAC;QACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC/B,CAAC;QACD,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;YAC5B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n Constants,\n DefaultConnectOptionsConstants,\n InternalEnvironmentVariables,\n ServiceAuth,\n} from \"./constants.js\";\nimport type { PlaywrightServiceAdditionalOptions, OsType } from \"./types.js\";\nimport { getAndSetRunId, getRunName, ValidateRunID } from \"../utils/utils.js\";\nimport { CIInfoProvider } from \"../utils/cIInfoProvider.js\";\nimport { state } from \"./state.js\";\nimport { ServiceErrorMessageConstants } from \"./messages.js\";\n\nclass PlaywrightServiceConfig {\n public serviceOs: OsType;\n public runId: string;\n public connectTimeout: number;\n public slowMo: number;\n public exposeNetwork: string;\n public runName: string;\n public apiVersion: string;\n private _serviceAuthType: string = ServiceAuth.ENTRA_ID;\n\n constructor() {\n this.serviceOs = (process.env[InternalEnvironmentVariables.MPT_SERVICE_OS] ||\n DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS) as OsType;\n this.runName = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] || \"\";\n this.runId = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] || \"\";\n this.connectTimeout = DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;\n this.slowMo = DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;\n this.exposeNetwork = DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;\n this.apiVersion =\n process.env[InternalEnvironmentVariables.MPT_API_VERSION] || Constants.LatestAPIVersion;\n }\n\n public static get instance(): PlaywrightServiceConfig {\n if (!state.playwrightServiceConfig) {\n state.playwrightServiceConfig = new PlaywrightServiceConfig();\n }\n return state.playwrightServiceConfig;\n }\n\n public get serviceAuthType(): string {\n return this._serviceAuthType;\n }\n\n public set serviceAuthType(value: string) {\n this._serviceAuthType = value;\n }\n\n public async initialize(): Promise<void> {\n if (!this.runName) {\n const ciConfigInfo = CIInfoProvider.getCIInfo();\n this.runName = await getRunName(ciConfigInfo);\n }\n }\n\n validateOptions = (options?: PlaywrightServiceAdditionalOptions): void => {\n if (!options) return;\n\n const isUsingServiceConfig =\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === \"true\";\n if (isUsingServiceConfig) {\n if (options.serviceAuthType || options.runId || options.runName) {\n const errorMessage = ServiceErrorMessageConstants.INVALID_PARAM_WITH_SERVICE_CONFIG.message;\n throw new Error(errorMessage);\n }\n return;\n }\n };\n\n setOptions = (\n options?: PlaywrightServiceAdditionalOptions,\n isGetConnectOptions: boolean = false,\n ): void => {\n if (isGetConnectOptions) {\n this.validateOptions(options);\n }\n\n if (options?.exposeNetwork) {\n this.exposeNetwork = options.exposeNetwork;\n }\n if (options?.apiVersion) {\n if (!process.env[InternalEnvironmentVariables.MPT_API_VERSION]) {\n process.env[InternalEnvironmentVariables.MPT_API_VERSION] = options.apiVersion;\n }\n this.apiVersion = options.apiVersion;\n }\n if (!process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID]) {\n if (options?.runId) {\n ValidateRunID(options.runId);\n this.runId = options.runId;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = this.runId;\n } else {\n this.runId = getAndSetRunId();\n }\n }\n if (!process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] && options?.runName) {\n this.runName = options.runName;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] = this.runName;\n }\n if (options?.os) {\n this.serviceOs = options.os;\n process.env[InternalEnvironmentVariables.MPT_SERVICE_OS] = this.serviceOs;\n }\n if (options?.slowMo) {\n this.slowMo = options.slowMo;\n }\n if (options?.connectTimeout) {\n this.connectTimeout = options.connectTimeout;\n }\n };\n}\n\nexport { PlaywrightServiceConfig };\n"]}
@@ -80,7 +80,7 @@ export type PlaywrightServiceAdditionalOptions = {
80
80
  *
81
81
  * @defaultValue `30000`
82
82
  */
83
- timeout?: number;
83
+ connectTimeout?: number;
84
84
  /**
85
85
  * @public
86
86
  *
@@ -118,9 +118,9 @@ export type PlaywrightServiceAdditionalOptions = {
118
118
  *
119
119
  * API Version
120
120
  *
121
- * @defaultValue `2025-07-01-preview`
121
+ * @defaultValue `2025-09-01`
122
122
  */
123
- apiVersion?: "2025-07-01-preview";
123
+ apiVersion?: "2025-09-01";
124
124
  };
125
125
  /**
126
126
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIpD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG;IACpD,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,M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,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConnectOptions } from \"@playwright/test\";\nimport type { ServiceAuth, ServiceOS, SDKLanguage } from \"./constants.js\";\nimport type { TokenCredential } from \"@azure/identity\";\nimport { CIInfo } from \"../utils/cIInfoProvider.js\";\n\n// Public APIs\n\n/**\n * @public\n *\n * Endpoint options for the service.\n */\nexport type EndpointOptions = {\n /**\n * @public\n *\n * A browser websocket endpoint to connect to.\n */\n wsEndpoint: string;\n};\n\n/**\n * @public\n *\n * Browser connect options for the service. This includes endpoint options and connect options.\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions, BrowserConnectOptions } from \"@azure/playwright\";\n *\n * test(\"has title\", async ({ browserName }) => {\n * const { wsEndpoint, options } : BrowserConnectOptions = 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 */\nexport type BrowserConnectOptions = EndpointOptions & {\n options: ConnectOptions;\n};\n\n/**\n * @public\n *\n * Additional options for the service.\n */\nexport type PlaywrightServiceAdditionalOptions = {\n /**\n * @public\n *\n * Authentication types supported by Azure Playwright.\n *\n * @defaultValue `ENTRA_ID`\n */\n serviceAuthType?: AuthenticationType;\n\n /**\n * @public\n *\n * Operating system types supported by Azure Playwright.\n *\n * @defaultValue `linux`\n */\n os?: OsType;\n\n /**\n * @public\n *\n * Run id for the test run.\n *\n * @defaultValue `current datetime as ISO string`\n */\n runId?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n timeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Custom token credential for Entra ID authentication. Learn more at {@link https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md | Using Azure Identity}.\n *\n * @defaultValue `DefaultAzureCredential`\n */\n credential?: TokenCredential;\n /**\n * @public\n *\n * Run name for the test run.\n *\n * @defaultValue `guid`\n */\n runName?: string;\n\n /**\n * @public\n *\n * API Version\n *\n * @defaultValue `2025-07-01-preview`\n */\n apiVersion?: \"2025-07-01-preview\";\n};\n\n/**\n * @public\n *\n * OS Types supported by Azure Playwright.\n */\nexport type OsType = (typeof ServiceOS)[keyof typeof ServiceOS];\n\n/**\n * @public\n *\n * Authentication types supported by Azure Playwright.\n */\nexport type AuthenticationType = (typeof ServiceAuth)[keyof typeof ServiceAuth];\n\n// Internal APIs\n\nexport type JwtPayload = {\n iss?: string;\n sub?: string;\n aud?: string[] | string;\n exp?: number;\n nbf?: number;\n iat?: number;\n jti?: string;\n};\n\nexport type AccessTokenClaims = JwtPayload & {\n pwid?: string;\n};\n\nexport type VersionInfo = {\n major: number;\n minor: number;\n patch: number;\n};\n\nexport type PackageManager = {\n runCommand: (command: string, args: string) => string;\n getVersionFromStdout: (stdout: string) => string;\n};\n\nexport type RunConfig = {\n framework?: RunFramework;\n sdkLanguage?: (typeof SDKLanguage)[keyof typeof SDKLanguage];\n maxWorkers?: number;\n};\n\nexport type RunFramework = {\n name?: string;\n version?: string;\n runnerName?: string;\n};\n\nexport type TestRunCreatePayload = {\n displayName: string;\n config?: RunConfig;\n ciConfig?: CIInfo;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConnectOptions } from \"@playwright/test\";\nimport type { ServiceAuth, ServiceOS, SDKLanguage } from \"./constants.js\";\nimport type { TokenCredential } from \"@azure/identity\";\nimport { CIInfo } from \"../utils/cIInfoProvider.js\";\n\n// Public APIs\n\n/**\n * @public\n *\n * Endpoint options for the service.\n */\nexport type EndpointOptions = {\n /**\n * @public\n *\n * A browser websocket endpoint to connect to.\n */\n wsEndpoint: string;\n};\n\n/**\n * @public\n *\n * Browser connect options for the service. This includes endpoint options and connect options.\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions, BrowserConnectOptions } from \"@azure/playwright\";\n *\n * test(\"has title\", async ({ browserName }) => {\n * const { wsEndpoint, options } : BrowserConnectOptions = 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 */\nexport type BrowserConnectOptions = EndpointOptions & {\n options: ConnectOptions;\n};\n\n/**\n * @public\n *\n * Additional options for the service.\n */\nexport type PlaywrightServiceAdditionalOptions = {\n /**\n * @public\n *\n * Authentication types supported by Azure Playwright.\n *\n * @defaultValue `ENTRA_ID`\n */\n serviceAuthType?: AuthenticationType;\n\n /**\n * @public\n *\n * Operating system types supported by Azure Playwright.\n *\n * @defaultValue `linux`\n */\n os?: OsType;\n\n /**\n * @public\n *\n * Run id for the test run.\n *\n * @defaultValue `current datetime as ISO string`\n */\n runId?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n connectTimeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Custom token credential for Entra ID authentication. Learn more at {@link https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md | Using Azure Identity}.\n *\n * @defaultValue `DefaultAzureCredential`\n */\n credential?: TokenCredential;\n /**\n * @public\n *\n * Run name for the test run.\n *\n * @defaultValue `guid`\n */\n runName?: string;\n\n /**\n * @public\n *\n * API Version\n *\n * @defaultValue `2025-09-01`\n */\n apiVersion?: \"2025-09-01\";\n};\n\n/**\n * @public\n *\n * OS Types supported by Azure Playwright.\n */\nexport type OsType = (typeof ServiceOS)[keyof typeof ServiceOS];\n\n/**\n * @public\n *\n * Authentication types supported by Azure Playwright.\n */\nexport type AuthenticationType = (typeof ServiceAuth)[keyof typeof ServiceAuth];\n\n// Internal APIs\n\nexport type JwtPayload = {\n iss?: string;\n sub?: string;\n aud?: string[] | string;\n exp?: number;\n nbf?: number;\n iat?: number;\n jti?: string;\n};\n\nexport type AccessTokenClaims = JwtPayload & {\n pwid?: string;\n};\n\nexport type VersionInfo = {\n major: number;\n minor: number;\n patch: number;\n};\n\nexport type PackageManager = {\n runCommand: (command: string, args: string) => string;\n getVersionFromStdout: (stdout: string) => string;\n};\n\nexport type RunConfig = {\n framework?: RunFramework;\n sdkLanguage?: (typeof SDKLanguage)[keyof typeof SDKLanguage];\n maxWorkers?: number;\n};\n\nexport type RunFramework = {\n name?: string;\n version?: string;\n runnerName?: string;\n};\n\nexport type TestRunCreatePayload = {\n displayName: string;\n config?: RunConfig;\n ciConfig?: CIInfo;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { FullConfig } from "@playwright/test";
2
2
  /**
3
- * Initializes the Playwright service by setting up authentication and creating a test run.
3
+ * Initializes the Playwright workspaces by setting up authentication and creating a test run.
4
4
  *
5
5
  * @param config - The full Playwright configuration
6
6
  * @returns Promise that resolves when service initialization is complete
@@ -5,7 +5,7 @@ import { PlaywrightServiceConfig } from "../common/playwrightServiceConfig.js";
5
5
  import { getTestRunConfig } from "../utils/utils.js";
6
6
  import { CIInfoProvider } from "../utils/cIInfoProvider.js";
7
7
  /**
8
- * Initializes the Playwright service by setting up authentication and creating a test run.
8
+ * Initializes the Playwright workspaces by setting up authentication and creating a test run.
9
9
  *
10
10
  * @param config - The full Playwright configuration
11
11
  * @returns Promise that resolves when service initialization is complete
@@ -1 +1 @@
1
- {"version":3,"file":"initializePlaywrightServiceTestRun.js","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,MAAkB;IACzE,MAAM,0BAA0B,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAElE,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;IAEhD,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;IAEjE,MAAM,oBAAoB,GAAG;QAC3B,WAAW,EACT,uBAAuB,CAAC,OAAO,KAAK,EAAE;YACpC,CAAC,CAAC,uBAAuB,CAAC,KAAK;YAC/B,CAAC,CAAC,uBAAuB,CAAC,OAAO;QACrC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,YAAY;KACvB,CAAC;IAEF,wCAAwC;IACxC,MAAM,0BAA0B,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;AACzE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FullConfig } from \"@playwright/test\";\nimport { PlaywrightServiceApiCall } from \"../utils/playwrightServiceApicall.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { getTestRunConfig } from \"../utils/utils.js\";\nimport { CIInfoProvider } from \"../utils/cIInfoProvider.js\";\n\n/**\n * Initializes the Playwright service by setting up authentication and creating a test run.\n *\n * @param config - The full Playwright configuration\n * @returns Promise that resolves when service initialization is complete\n */\nexport async function initializePlaywrightServiceTestRun(config: FullConfig): Promise<void> {\n const playwrightServiceApiClient = new PlaywrightServiceApiCall();\n\n const ciConfigInfo = CIInfoProvider.getCIInfo();\n\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n\n const testRunCreatePayload = {\n displayName:\n playwrightServiceConfig.runName === \"\"\n ? playwrightServiceConfig.runId\n : playwrightServiceConfig.runName,\n config: getTestRunConfig(config),\n ciConfig: ciConfigInfo,\n };\n\n // Create/update test run in the service\n await playwrightServiceApiClient.patchTestRunAPI(testRunCreatePayload);\n}\n"]}
1
+ {"version":3,"file":"initializePlaywrightServiceTestRun.js","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,MAAkB;IACzE,MAAM,0BAA0B,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAElE,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;IAEhD,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;IAEjE,MAAM,oBAAoB,GAAG;QAC3B,WAAW,EACT,uBAAuB,CAAC,OAAO,KAAK,EAAE;YACpC,CAAC,CAAC,uBAAuB,CAAC,KAAK;YAC/B,CAAC,CAAC,uBAAuB,CAAC,OAAO;QACrC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,YAAY;KACvB,CAAC;IAEF,wCAAwC;IACxC,MAAM,0BAA0B,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;AACzE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FullConfig } from \"@playwright/test\";\nimport { PlaywrightServiceApiCall } from \"../utils/playwrightServiceApicall.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { getTestRunConfig } from \"../utils/utils.js\";\nimport { CIInfoProvider } from \"../utils/cIInfoProvider.js\";\n\n/**\n * Initializes the Playwright workspaces by setting up authentication and creating a test run.\n *\n * @param config - The full Playwright configuration\n * @returns Promise that resolves when service initialization is complete\n */\nexport async function initializePlaywrightServiceTestRun(config: FullConfig): Promise<void> {\n const playwrightServiceApiClient = new PlaywrightServiceApiCall();\n\n const ciConfigInfo = CIInfoProvider.getCIInfo();\n\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n\n const testRunCreatePayload = {\n displayName:\n playwrightServiceConfig.runName === \"\"\n ? playwrightServiceConfig.runId\n : playwrightServiceConfig.runName,\n config: getTestRunConfig(config),\n ciConfig: ciConfigInfo,\n };\n\n // Create/update test run in the service\n await playwrightServiceApiClient.patchTestRunAPI(testRunCreatePayload);\n}\n"]}
@@ -5,32 +5,34 @@ import type { PlaywrightTestConfig } from "@playwright/test";
5
5
  *
6
6
  * Generate playwright configuration integrated with Azure Playwright.
7
7
  *
8
- * @param config - base playwright configuration
8
+ * @param baseConfig - base playwright configuration
9
9
  * @param options - additional options for the service
10
10
  * @returns PlaywrightConfig
11
11
  *
12
12
  * @example
13
13
  * ```
14
14
  * import { defineConfig } from "playwright/test";
15
- * import { getServiceConfig } from "@azure/playwright";
15
+ * import { createAzurePlaywrightConfig } from "@azure/playwright";
16
16
  * import playwrightConfig from "./playwright.config";
17
17
  *
18
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));
18
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));
19
19
  * ```
20
20
  *
21
21
  * @example
22
22
  * ```
23
23
  * import { defineConfig } from "playwright/test";
24
- * import { getServiceConfig, ServiceOS } from "@azure/playwright";
24
+ * import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from "@azure/playwright";
25
25
  * import playwrightConfig from "./playwright.config";
26
+ * import { DefaultAzureCredential } from '@azure/identity';
26
27
  *
27
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
28
- * runId: "custom run id",
28
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {
29
+ * credential: new DefaultAzureCredential(),
30
+ * serviceAuthType: ServiceAuth.ENTRA_ID,
29
31
  * os: ServiceOS.WINDOWS
30
32
  * }));
31
33
  * ```
32
34
  */
33
- declare const getServiceConfig: (config: PlaywrightTestConfig, options?: PlaywrightServiceAdditionalOptions) => PlaywrightTestConfig;
35
+ declare const createAzurePlaywrightConfig: (baseConfig: PlaywrightTestConfig, options?: PlaywrightServiceAdditionalOptions) => PlaywrightTestConfig;
34
36
  /**
35
37
  * @public
36
38
  *
@@ -60,5 +62,5 @@ declare const getServiceConfig: (config: PlaywrightTestConfig, options?: Playwri
60
62
  * ```
61
63
  */
62
64
  declare const getConnectOptions: (options?: PlaywrightServiceAdditionalOptions) => Promise<BrowserConnectOptions>;
63
- export { getServiceConfig, getConnectOptions };
65
+ export { createAzurePlaywrightConfig, getConnectOptions };
64
66
  //# sourceMappingURL=playwrightService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightService.d.ts","sourceRoot":"","sources":["../../../src/core/playwrightService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kCAAkC,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAgBpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAa7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,QAAA,MAAM,gBAAgB,GACpB,QAAQ,oBAAoB,EAC5B,UAAU,kCAAkC,KAC3C,oBA6GF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,iBAAiB,GACrB,UAAU,kCAAkC,KAC3C,OAAO,CAAC,qBAAqB,CA0C/B,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"playwrightService.d.ts","sourceRoot":"","sources":["../../../src/core/playwrightService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kCAAkC,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAgBpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAa7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,QAAA,MAAM,2BAA2B,GAC/B,YAAY,oBAAoB,EAChC,UAAU,kCAAkC,KAC3C,oBA6GF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,iBAAiB,GACrB,UAAU,kCAAkC,KAC3C,OAAO,CAAC,qBAAqB,CA0C/B,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,CAAC"}
@@ -21,32 +21,34 @@ const performOneTimeOperation = (options) => {
21
21
  *
22
22
  * Generate playwright configuration integrated with Azure Playwright.
23
23
  *
24
- * @param config - base playwright configuration
24
+ * @param baseConfig - base playwright configuration
25
25
  * @param options - additional options for the service
26
26
  * @returns PlaywrightConfig
27
27
  *
28
28
  * @example
29
29
  * ```
30
30
  * import { defineConfig } from "playwright/test";
31
- * import { getServiceConfig } from "@azure/playwright";
31
+ * import { createAzurePlaywrightConfig } from "@azure/playwright";
32
32
  * import playwrightConfig from "./playwright.config";
33
33
  *
34
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));
34
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));
35
35
  * ```
36
36
  *
37
37
  * @example
38
38
  * ```
39
39
  * import { defineConfig } from "playwright/test";
40
- * import { getServiceConfig, ServiceOS } from "@azure/playwright";
40
+ * import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from "@azure/playwright";
41
41
  * import playwrightConfig from "./playwright.config";
42
+ * import { DefaultAzureCredential } from '@azure/identity';
42
43
  *
43
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
44
- * runId: "custom run id",
44
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {
45
+ * credential: new DefaultAzureCredential(),
46
+ * serviceAuthType: ServiceAuth.ENTRA_ID,
45
47
  * os: ServiceOS.WINDOWS
46
48
  * }));
47
49
  * ```
48
50
  */
49
- const getServiceConfig = (config, options) => {
51
+ const createAzurePlaywrightConfig = (baseConfig, options) => {
50
52
  validatePlaywrightVersion();
51
53
  validateServiceUrl();
52
54
  // Set environment variable to indicate user is using service config
@@ -62,36 +64,36 @@ const getServiceConfig = (config, options) => {
62
64
  // if global setup/teardown is array -
63
65
  // 1. if multiple global file is not supported, throw error
64
66
  // 2. append playwright-service global setup/teardown with customer provided global setup/teardown
65
- if (config && config.globalSetup) {
66
- if (typeof config.globalSetup === "string") {
67
+ if (baseConfig && baseConfig.globalSetup) {
68
+ if (typeof baseConfig.globalSetup === "string") {
67
69
  if (isMultipleGlobalFileSupported) {
68
- customerConfig.globalSetup = [config.globalSetup];
70
+ customerConfig.globalSetup = [baseConfig.globalSetup];
69
71
  }
70
72
  else {
71
- customerConfig.globalSetup = config.globalSetup;
73
+ customerConfig.globalSetup = baseConfig.globalSetup;
72
74
  }
73
75
  }
74
76
  else {
75
77
  if (!isMultipleGlobalFileSupported) {
76
78
  throw new Error(ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
77
79
  }
78
- customerConfig.globalSetup = config.globalSetup;
80
+ customerConfig.globalSetup = baseConfig.globalSetup;
79
81
  }
80
82
  }
81
- if (config && config.globalTeardown) {
82
- if (typeof config.globalTeardown === "string") {
83
+ if (baseConfig && baseConfig.globalTeardown) {
84
+ if (typeof baseConfig.globalTeardown === "string") {
83
85
  if (isMultipleGlobalFileSupported) {
84
- customerConfig.globalTeardown = [config.globalTeardown];
86
+ customerConfig.globalTeardown = [baseConfig.globalTeardown];
85
87
  }
86
88
  else {
87
- customerConfig.globalTeardown = config.globalTeardown;
89
+ customerConfig.globalTeardown = baseConfig.globalTeardown;
88
90
  }
89
91
  }
90
92
  else {
91
93
  if (!isMultipleGlobalFileSupported) {
92
94
  throw new Error(ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
93
95
  }
94
- customerConfig.globalTeardown = config.globalTeardown;
96
+ customerConfig.globalTeardown = baseConfig.globalTeardown;
95
97
  }
96
98
  }
97
99
  const playwrightServiceConfig = PlaywrightServiceConfig.instance;
@@ -124,7 +126,7 @@ const getServiceConfig = (config, options) => {
124
126
  performOneTimeOperation(options);
125
127
  if (!process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {
126
128
  process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = "true";
127
- console.log("\nRunning tests using Azure Playwright service.");
129
+ console.log("\nRunning tests using Playwright workspaces.");
128
130
  }
129
131
  return {
130
132
  use: {
@@ -134,7 +136,7 @@ const getServiceConfig = (config, options) => {
134
136
  Authorization: `Bearer ${getAccessToken()}`,
135
137
  "x-ms-package-version": `@azure/playwright/${getPackageVersion()}`,
136
138
  },
137
- timeout: playwrightServiceConfig.timeout,
139
+ timeout: playwrightServiceConfig.connectTimeout,
138
140
  exposeNetwork: playwrightServiceConfig.exposeNetwork,
139
141
  slowMo: playwrightServiceConfig.slowMo,
140
142
  },
@@ -201,11 +203,11 @@ const getConnectOptions = async (options) => {
201
203
  Authorization: `Bearer ${token}`,
202
204
  "x-ms-package-version": `@azure/playwright/${getPackageVersion()}`,
203
205
  },
204
- timeout: playwrightServiceConfig.timeout,
206
+ timeout: playwrightServiceConfig.connectTimeout,
205
207
  exposeNetwork: playwrightServiceConfig.exposeNetwork,
206
208
  slowMo: playwrightServiceConfig.slowMo,
207
209
  },
208
210
  };
209
211
  };
210
- export { getServiceConfig, getConnectOptions };
212
+ export { createAzurePlaywrightConfig, getConnectOptions };
211
213
  //# sourceMappingURL=playwrightService.js.map
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,gBAAgB,GAAG,CACvB,MAA4B,EAC5B,OAA4C,EACtB,EAAE;IACxB,yBAAyB,EAAE,CAAC;IAC5B,kBAAkB,EAA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aultConnectOptionsConstants,\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 config - 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 { getServiceConfig } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));\n * ```\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { getServiceConfig, ServiceOS } from \"@azure/playwright\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {\n * runId: \"custom run id\",\n * os: ServiceOS.WINDOWS\n * }));\n * ```\n */\nconst getServiceConfig = (\n config: 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 (config && config.globalSetup) {\n if (typeof config.globalSetup === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalSetup = [config.globalSetup];\n } else {\n customerConfig.globalSetup = config.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 = config.globalSetup;\n }\n }\n\n if (config && config.globalTeardown) {\n if (typeof config.globalTeardown === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalTeardown = [config.globalTeardown];\n } else {\n customerConfig.globalTeardown = config.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 = config.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 Azure Playwright service.\");\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.timeout,\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.timeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n };\n};\n\nexport { getServiceConfig, 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;IAC5B,kBAAkB,EAAE,CAAC;IAErB,oEA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stants,\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"]}
@@ -5,6 +5,6 @@
5
5
  */
6
6
  import { ServiceAuth, ServiceOS, ServiceEnvironmentVariable } from "./common/constants.js";
7
7
  import type { OsType, AuthenticationType, BrowserConnectOptions, EndpointOptions, PlaywrightServiceAdditionalOptions } from "./common/types.js";
8
- import { getServiceConfig, getConnectOptions } from "./core/playwrightService.js";
9
- export { getServiceConfig, getConnectOptions, ServiceOS, ServiceAuth, ServiceEnvironmentVariable, OsType, AuthenticationType, BrowserConnectOptions, EndpointOptions, PlaywrightServiceAdditionalOptions, };
8
+ import { createAzurePlaywrightConfig, getConnectOptions } from "./core/playwrightService.js";
9
+ export { createAzurePlaywrightConfig, getConnectOptions, ServiceOS, ServiceAuth, ServiceEnvironmentVariable, OsType, AuthenticationType, BrowserConnectOptions, EndpointOptions, PlaywrightServiceAdditionalOptions, };
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kCAAkC,EACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,0BAA0B,EAC1B,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kCAAkC,GACnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kCAAkC,EACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,0BAA0B,EAC1B,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kCAAkC,GACnC,CAAC"}
@@ -6,6 +6,6 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  import { ServiceAuth, ServiceOS, ServiceEnvironmentVariable } from "./common/constants.js";
9
- import { getServiceConfig, getConnectOptions } from "./core/playwrightService.js";
10
- export { getServiceConfig, getConnectOptions, ServiceOS, ServiceAuth, ServiceEnvironmentVariable, };
9
+ import { createAzurePlaywrightConfig, getConnectOptions } from "./core/playwrightService.js";
10
+ export { createAzurePlaywrightConfig, getConnectOptions, ServiceOS, ServiceAuth, ServiceEnvironmentVariable, };
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAQ3F,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,0BAA0B,GAM3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Library for integrating Azure Playwright with existing playwright projects.\n *\n * @packageDocumentation\n */\n\nimport { ServiceAuth, ServiceOS, ServiceEnvironmentVariable } from \"./common/constants.js\";\nimport type {\n OsType,\n AuthenticationType,\n BrowserConnectOptions,\n EndpointOptions,\n PlaywrightServiceAdditionalOptions,\n} from \"./common/types.js\";\nimport { getServiceConfig, getConnectOptions } from \"./core/playwrightService.js\";\n\nexport {\n getServiceConfig,\n getConnectOptions,\n ServiceOS,\n ServiceAuth,\n ServiceEnvironmentVariable,\n OsType,\n AuthenticationType,\n BrowserConnectOptions,\n EndpointOptions,\n PlaywrightServiceAdditionalOptions,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAQ3F,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,0BAA0B,GAM3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Library for integrating Azure Playwright with existing playwright projects.\n *\n * @packageDocumentation\n */\n\nimport { ServiceAuth, ServiceOS, ServiceEnvironmentVariable } from \"./common/constants.js\";\nimport type {\n OsType,\n AuthenticationType,\n BrowserConnectOptions,\n EndpointOptions,\n PlaywrightServiceAdditionalOptions,\n} from \"./common/types.js\";\nimport { createAzurePlaywrightConfig, getConnectOptions } from \"./core/playwrightService.js\";\n\nexport {\n createAzurePlaywrightConfig,\n getConnectOptions,\n ServiceOS,\n ServiceAuth,\n ServiceEnvironmentVariable,\n OsType,\n AuthenticationType,\n BrowserConnectOptions,\n EndpointOptions,\n PlaywrightServiceAdditionalOptions,\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { HttpService } from "../common/httpService.js";
2
2
  import { TestRunCreatePayload } from "../common/types.js";
3
3
  /**
4
- * Makes a PATCH call to the Playwright Service Test Run API to create or update a test run.
4
+ * Makes a PATCH call to the Playwright workspaces Test Run API to create or update a test run.
5
5
  *
6
6
  * @param payload - The request payload (displayName, config, ciConfig, etc.).
7
7
  * @returns The parsed JSON response from the API.
@@ -5,7 +5,7 @@ import { HttpService } from "../common/httpService.js";
5
5
  import { ServiceErrorMessageConstants } from "../common/messages.js";
6
6
  import { Constants } from "../common/constants.js";
7
7
  /**
8
- * Makes a PATCH call to the Playwright Service Test Run API to create or update a test run.
8
+ * Makes a PATCH call to the Playwright workspaces Test Run API to create or update a test run.
9
9
  *
10
10
  * @param payload - The request payload (displayName, config, ciConfig, etc.).
11
11
  * @returns The parsed JSON response from the API.