@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
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceApicall.js","sourceRoot":"","sources":["../../../src/utils/playwrightServiceApicall.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IAC3B,WAAW,CAAc;IAEjC,YAAY,WAAyB;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,WAAW,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAA6B;QACjD,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,OAAO,CAAC;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,WAAW,GAAG,8BAA8B,CAAC;QACnD,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAC7C,MAAM,EACN,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,CACd,CAAC;QACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;YACrE,sBAAsB,CAAC,4BAA4B,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport {\n getTestRunApiUrl,\n getAccessToken,\n extractErrorMessage,\n exitWithFailureMessage,\n} from \"./utils.js\";\nimport { HttpService } from \"../common/httpService.js\";\nimport { TestRunCreatePayload } from \"../common/types.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { Constants } from \"../common/constants.js\";\n\n/**\n * Makes a PATCH call to the Playwright Service Test Run API to create or update a test run.\n *\n * @param payload - The request payload (displayName, config, ciConfig, etc.).\n * @returns The parsed JSON response from the API.\n * @throws If the API call fails (non-2xx response).\n */\nexport class PlaywrightServiceApiCall {\n private httpService: HttpService;\n\n constructor(httpService?: HttpService) {\n this.httpService = httpService ?? new HttpService();\n }\n\n async patchTestRunAPI(payload: TestRunCreatePayload): Promise<any> {\n const baseUrl = getTestRunApiUrl();\n const token = getAccessToken();\n if (!token) {\n throw new Error(\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN environment variable is not set.\");\n }\n const url = new URL(baseUrl);\n url.searchParams.set(\"api-version\", Constants.LatestAPIVersion);\n const method = \"PATCH\";\n const data = JSON.stringify(payload);\n const contentType = \"application/merge-patch+json\";\n const correlationId = crypto.randomUUID();\n\n const response = await this.httpService.callAPI(\n method,\n url.toString(),\n data,\n token,\n contentType,\n correlationId,\n );\n if (response.status !== 200) {\n const errorMessage = extractErrorMessage(response?.bodyAsText ?? \"\");\n exitWithFailureMessage(ServiceErrorMessageConstants.FAILED_TO_CREATE_TEST_RUN, errorMessage);\n }\n console.log(\"Test run created successfully.\");\n return response.bodyAsText ? JSON.parse(response.bodyAsText) : {};\n }\n}\n"]}
1
+ {"version":3,"file":"playwrightServiceApicall.js","sourceRoot":"","sources":["../../../src/utils/playwrightServiceApicall.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IAC3B,WAAW,CAAc;IAEjC,YAAY,WAAyB;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,WAAW,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAA6B;QACjD,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,OAAO,CAAC;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,WAAW,GAAG,8BAA8B,CAAC;QACnD,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAC7C,MAAM,EACN,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,CACd,CAAC;QACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;YACrE,sBAAsB,CAAC,4BAA4B,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport {\n getTestRunApiUrl,\n getAccessToken,\n extractErrorMessage,\n exitWithFailureMessage,\n} from \"./utils.js\";\nimport { HttpService } from \"../common/httpService.js\";\nimport { TestRunCreatePayload } from \"../common/types.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { Constants } from \"../common/constants.js\";\n\n/**\n * Makes a PATCH call to the Playwright workspaces Test Run API to create or update a test run.\n *\n * @param payload - The request payload (displayName, config, ciConfig, etc.).\n * @returns The parsed JSON response from the API.\n * @throws If the API call fails (non-2xx response).\n */\nexport class PlaywrightServiceApiCall {\n private httpService: HttpService;\n\n constructor(httpService?: HttpService) {\n this.httpService = httpService ?? new HttpService();\n }\n\n async patchTestRunAPI(payload: TestRunCreatePayload): Promise<any> {\n const baseUrl = getTestRunApiUrl();\n const token = getAccessToken();\n if (!token) {\n throw new Error(\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN environment variable is not set.\");\n }\n const url = new URL(baseUrl);\n url.searchParams.set(\"api-version\", Constants.LatestAPIVersion);\n const method = \"PATCH\";\n const data = JSON.stringify(payload);\n const contentType = \"application/merge-patch+json\";\n const correlationId = crypto.randomUUID();\n\n const response = await this.httpService.callAPI(\n method,\n url.toString(),\n data,\n token,\n contentType,\n correlationId,\n );\n if (response.status !== 200) {\n const errorMessage = extractErrorMessage(response?.bodyAsText ?? \"\");\n exitWithFailureMessage(ServiceErrorMessageConstants.FAILED_TO_CREATE_TEST_RUN, errorMessage);\n }\n console.log(\"Test run created successfully.\");\n return response.bodyAsText ? JSON.parse(response.bodyAsText) : {};\n }\n}\n"]}
@@ -58,7 +58,7 @@ exports.Constants = {
58
58
  SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,
59
59
  OneDayInMS: 24 * 60 * 60 * 1000,
60
60
  MinimumSupportedPlaywrightVersion: "1.47.0",
61
- LatestAPIVersion: "2025-07-01-preview",
61
+ LatestAPIVersion: "2025-09-01",
62
62
  HTTP_CALL_TIMEOUT: 10000,
63
63
  };
64
64
  exports.InternalEnvironmentVariables = {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;CACp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esContent":["// 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;;;AAErB,QAAA,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX;;;GAGG;AACU,QAAA,0BAA0B,GAAG;IACxC,+BAA+B,EAAE,iCAAiC;IAClE,sBAAsB,EAAE,wBAAwB;CACjD,CAAC;AAEW,QAAA,sBAAsB,GAAG;IACpC,mBAAmB,EAAE,eAAe;IACpC,aAAa,EAAE,qCAAqC;IACpD,0BAA0B,EAAE,iCAAiC;CAC9D,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,YAAY;IACpC,kBAAkB,EAAE,iBAAS,CAAC,KAAK;IACnC,yBAAyB,EAAE,mBAAW,CAAC,QAAQ;CAChD,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,mBAAmB,EAAE,YAAY;IACjC,iBAAiB,EAAE,mBAAW,CAAC,UAAU;IACzC,yBAAyB,EAAE,YAAY;CACxC,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACtC,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAC/B,iCAAiC,EAAE,QAAQ;IAC3C,gBAAgB,EAAE,YAAY;IAC9B,iBAAiB,EAAE,KAAK;CACzB,CAAC;AAEW,QAAA,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-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"]}
@@ -42,12 +42,12 @@ exports.ServiceErrorMessageConstants = {
42
42
  },
43
43
  FAILED_TO_CREATE_TEST_RUN: {
44
44
  key: "FailedToCreateTestRun",
45
- message: "Failed to create the test run in the Playwright service. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.",
46
- 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.`,
45
+ message: "Failed to create the test run in the Playwright workspaces. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.",
46
+ 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.`,
47
47
  },
48
48
  INVALID_PARAM_WITH_SERVICE_CONFIG: {
49
49
  key: "InvalidParamWithServiceConfig",
50
- message: `Remove serviceAuth, runId, and runName from getConnectOptions when using getServiceConfig. Configure these options through getServiceConfig instead.`,
50
+ message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,
51
51
  },
52
52
  INVALID_RUN_ID_FORMAT: {
53
53
  key: "InvalidRunIdFormat",
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,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;;;AAErB,QAAA,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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AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -11,7 +11,7 @@ const messages_js_1 = require("./messages.js");
11
11
  class PlaywrightServiceConfig {
12
12
  serviceOs;
13
13
  runId;
14
- timeout;
14
+ connectTimeout;
15
15
  slowMo;
16
16
  exposeNetwork;
17
17
  runName;
@@ -22,7 +22,7 @@ class PlaywrightServiceConfig {
22
22
  constants_js_1.DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS);
23
23
  this.runName = process.env[constants_js_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_NAME] || "";
24
24
  this.runId = process.env[constants_js_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] || "";
25
- this.timeout = constants_js_1.DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;
25
+ this.connectTimeout = constants_js_1.DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;
26
26
  this.slowMo = constants_js_1.DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;
27
27
  this.exposeNetwork = constants_js_1.DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;
28
28
  this.apiVersion =
@@ -92,8 +92,8 @@ class PlaywrightServiceConfig {
92
92
  if (options?.slowMo) {
93
93
  this.slowMo = options.slowMo;
94
94
  }
95
- if (options?.timeout) {
96
- this.timeout = options.timeout;
95
+ if (options?.connectTimeout) {
96
+ this.connectTimeout = options.connectTimeout;
97
97
  }
98
98
  };
99
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceConfig.js","sourceRoot":"","sources":["../../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,iDAKwB;AAExB,gDAA8E;AAC9E,kEAA4D;AAC5D,yCAAmC;AACnC,+CAA6D;AAE7D,MAAM,uBAAuB;IACpB,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,aAAa,CAAS;IACtB,OAAO,CAAS;IAChB,UAAU,C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AAC;gBAC7B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;gBAC3B,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,GAAG,IAAA,yBAAc,GAAE,CAAC;YAChC,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,oBAAoB,CAAC,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACxF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QAChF,CAAC;QACD,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,2CAA4B,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;AAEQ,0DAAuB","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,iDAKwB;AAExB,gDAA8E;AAC9E,kEAA4D;AAC5D,yCAAmC;AACnC,+CAA6D;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,0BAAW,CAAC,QAAQ,CAAC;IAExD;QACE,IAAI,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,cAAc,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C,KAAK,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,GAAG,IAAA,yBAAc,GAAE,CAAC;YAChC,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,oBAAoB,CAAC,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACxF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QAChF,CAAC;QACD,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,2CAA4B,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;AAEQ,0DAAuB","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,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AAkC","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
@@ -8,7 +8,7 @@ const playwrightServiceConfig_js_1 = require("../common/playwrightServiceConfig.
8
8
  const utils_js_1 = require("../utils/utils.js");
9
9
  const cIInfoProvider_js_1 = require("../utils/cIInfoProvider.js");
10
10
  /**
11
- * Initializes the Playwright service by setting up authentication and creating a test run.
11
+ * Initializes the Playwright workspaces by setting up authentication and creating a test run.
12
12
  *
13
13
  * @param config - The full Playwright configuration
14
14
  * @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;;AAclC,gFAkBC;AA7BD,sFAAgF;AAChF,qFAA+E;AAC/E,gDAAqD;AACrD,kEAA4D;AAE5D;;;;;GAKG;AACI,KAAK,UAAU,kCAAkC,CAAC,MAAkB;IACzE,MAAM,0BAA0B,GAAG,IAAI,sDAAwB,EAAE,CAAC;IAElE,MAAM,YAAY,GAAG,kCAAc,CAAC,SAAS,EAAE,CAAC;IAEhD,MAAM,uBAAuB,GAAG,oDAAuB,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,IAAA,2BAAgB,EAAC,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;;AAclC,gFAkBC;AA7BD,sFAAgF;AAChF,qFAA+E;AAC/E,gDAAqD;AACrD,kEAA4D;AAE5D;;;;;GAKG;AACI,KAAK,UAAU,kCAAkC,CAAC,MAAkB;IACzE,MAAM,0BAA0B,GAAG,IAAI,sDAAwB,EAAE,CAAC;IAElE,MAAM,YAAY,GAAG,kCAAc,CAAC,SAAS,EAAE,CAAC;IAEhD,MAAM,uBAAuB,GAAG,oDAAuB,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,IAAA,2BAAgB,EAAC,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"}
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getConnectOptions = exports.getServiceConfig = void 0;
5
+ exports.getConnectOptions = exports.createAzurePlaywrightConfig = void 0;
6
6
  const tslib_1 = require("tslib");
7
7
  const constants_js_1 = require("../common/constants.js");
8
8
  const customerConfig_js_1 = tslib_1.__importDefault(require("../common/customerConfig.js"));
@@ -25,32 +25,34 @@ const performOneTimeOperation = (options) => {
25
25
  *
26
26
  * Generate playwright configuration integrated with Azure Playwright.
27
27
  *
28
- * @param config - base playwright configuration
28
+ * @param baseConfig - base playwright configuration
29
29
  * @param options - additional options for the service
30
30
  * @returns PlaywrightConfig
31
31
  *
32
32
  * @example
33
33
  * ```
34
34
  * import { defineConfig } from "playwright/test";
35
- * import { getServiceConfig } from "@azure/playwright";
35
+ * import { createAzurePlaywrightConfig } from "@azure/playwright";
36
36
  * import playwrightConfig from "./playwright.config";
37
37
  *
38
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));
38
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));
39
39
  * ```
40
40
  *
41
41
  * @example
42
42
  * ```
43
43
  * import { defineConfig } from "playwright/test";
44
- * import { getServiceConfig, ServiceOS } from "@azure/playwright";
44
+ * import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from "@azure/playwright";
45
45
  * import playwrightConfig from "./playwright.config";
46
+ * import { DefaultAzureCredential } from '@azure/identity';
46
47
  *
47
- * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
48
- * runId: "custom run id",
48
+ * export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {
49
+ * credential: new DefaultAzureCredential(),
50
+ * serviceAuthType: ServiceAuth.ENTRA_ID,
49
51
  * os: ServiceOS.WINDOWS
50
52
  * }));
51
53
  * ```
52
54
  */
53
- const getServiceConfig = (config, options) => {
55
+ const createAzurePlaywrightConfig = (baseConfig, options) => {
54
56
  (0, utils_js_1.validatePlaywrightVersion)();
55
57
  (0, utils_js_1.validateServiceUrl)();
56
58
  // Set environment variable to indicate user is using service config
@@ -66,36 +68,36 @@ const getServiceConfig = (config, options) => {
66
68
  // if global setup/teardown is array -
67
69
  // 1. if multiple global file is not supported, throw error
68
70
  // 2. append playwright-service global setup/teardown with customer provided global setup/teardown
69
- if (config && config.globalSetup) {
70
- if (typeof config.globalSetup === "string") {
71
+ if (baseConfig && baseConfig.globalSetup) {
72
+ if (typeof baseConfig.globalSetup === "string") {
71
73
  if (isMultipleGlobalFileSupported) {
72
- customerConfig_js_1.default.globalSetup = [config.globalSetup];
74
+ customerConfig_js_1.default.globalSetup = [baseConfig.globalSetup];
73
75
  }
74
76
  else {
75
- customerConfig_js_1.default.globalSetup = config.globalSetup;
77
+ customerConfig_js_1.default.globalSetup = baseConfig.globalSetup;
76
78
  }
77
79
  }
78
80
  else {
79
81
  if (!isMultipleGlobalFileSupported) {
80
82
  throw new Error(messages_js_1.ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
81
83
  }
82
- customerConfig_js_1.default.globalSetup = config.globalSetup;
84
+ customerConfig_js_1.default.globalSetup = baseConfig.globalSetup;
83
85
  }
84
86
  }
85
- if (config && config.globalTeardown) {
86
- if (typeof config.globalTeardown === "string") {
87
+ if (baseConfig && baseConfig.globalTeardown) {
88
+ if (typeof baseConfig.globalTeardown === "string") {
87
89
  if (isMultipleGlobalFileSupported) {
88
- customerConfig_js_1.default.globalTeardown = [config.globalTeardown];
90
+ customerConfig_js_1.default.globalTeardown = [baseConfig.globalTeardown];
89
91
  }
90
92
  else {
91
- customerConfig_js_1.default.globalTeardown = config.globalTeardown;
93
+ customerConfig_js_1.default.globalTeardown = baseConfig.globalTeardown;
92
94
  }
93
95
  }
94
96
  else {
95
97
  if (!isMultipleGlobalFileSupported) {
96
98
  throw new Error(messages_js_1.ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
97
99
  }
98
- customerConfig_js_1.default.globalTeardown = config.globalTeardown;
100
+ customerConfig_js_1.default.globalTeardown = baseConfig.globalTeardown;
99
101
  }
100
102
  }
101
103
  const playwrightServiceConfig = playwrightServiceConfig_js_1.PlaywrightServiceConfig.instance;
@@ -128,7 +130,7 @@ const getServiceConfig = (config, options) => {
128
130
  performOneTimeOperation(options);
129
131
  if (!process.env[constants_js_1.InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {
130
132
  process.env[constants_js_1.InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = "true";
131
- console.log("\nRunning tests using Azure Playwright service.");
133
+ console.log("\nRunning tests using Playwright workspaces.");
132
134
  }
133
135
  return {
134
136
  use: {
@@ -138,7 +140,7 @@ const getServiceConfig = (config, options) => {
138
140
  Authorization: `Bearer ${(0, utils_js_1.getAccessToken)()}`,
139
141
  "x-ms-package-version": `@azure/playwright/${(0, utils_js_1.getPackageVersion)()}`,
140
142
  },
141
- timeout: playwrightServiceConfig.timeout,
143
+ timeout: playwrightServiceConfig.connectTimeout,
142
144
  exposeNetwork: playwrightServiceConfig.exposeNetwork,
143
145
  slowMo: playwrightServiceConfig.slowMo,
144
146
  },
@@ -146,7 +148,7 @@ const getServiceConfig = (config, options) => {
146
148
  ...globalFunctions,
147
149
  };
148
150
  };
149
- exports.getServiceConfig = getServiceConfig;
151
+ exports.createAzurePlaywrightConfig = createAzurePlaywrightConfig;
150
152
  /**
151
153
  * @public
152
154
  *
@@ -206,7 +208,7 @@ const getConnectOptions = async (options) => {
206
208
  Authorization: `Bearer ${token}`,
207
209
  "x-ms-package-version": `@azure/playwright/${(0, utils_js_1.getPackageVersion)()}`,
208
210
  },
209
- timeout: playwrightServiceConfig.timeout,
211
+ timeout: playwrightServiceConfig.connectTimeout,
210
212
  exposeNetwork: playwrightServiceConfig.exposeNetwork,
211
213
  slowMo: playwrightServiceConfig.slowMo,
212
214
  },
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightService.js","sourceRoot":"","sources":["../../../src/core/playwrightService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,yDAIgC;AAChC,4FAAyD;AACzD,qFAA+E;AAC/E,oGAAiE;AAEjE,gDAa2B;AAC3B,uDAAqE;AAErE,2EAA0D;AAE1D,MAAM,uBAAuB,GAAG,CAAC,OAA4C,EAAQ,EAAE;IACrF,MAAM,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,uBAAuB,CAAC,KAAK,MAAM,CAAC;IAC/E,IAAI,oBAAoB;QAAE,OAAO;IACjC,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC;IAC3E,IAAI,OAAO,EAAE,eAAe,KAAK,0BAAW,CAAC,YAAY,EAAE,CAAC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UAAU,KAAK,EAAE;gBAChC,sBAAsB,EAAE,qBAAqB,IAAA,4BAAiB,GAAE,EAAE;aACnE;YACD,OAAO,EAAE,uBAAuB,CAAC,OAAO;YACxC,aAAa,EAAE,uBAAuB,CAAC,aAAa;YACpD,MAAM,EAAE,uBAAuB,CAAC,MAAM;SACvC;KACF,CAAC;AACJ,CAAC,CAAC;AAEyB,8CAAiB","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 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,yDAIgC;AAChC,4FAAyD;AACzD,qFAA+E;AAC/E,oGAAiE;AAEjE,gDAa2B;AAC3B,uDAAqE;AAErE,2EAA0D;AAE1D,MAAM,uBAAuB,GAAG,CAAC,OAA4C,EAAQ,EAAE;IACrF,MAAM,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,uBAAuB,CAAC,KAAK,MAAM,CAAC;IAC/E,IAAI,oBAAoB;QAAE,OAAO;IACjC,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC;IAC3E,IAAI,OAAO,EAAE,eAAe,KAAK,0BAAW,CAAC,YAAY,EAAE,CAAC;QAC1D,IAAA,yCAA8B,GAAE,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,2BAA2B,GAAG,CAClC,UAAgC,EAChC,OAA4C,EACtB,EAAE;IACxB,IAAA,oCAAyB,GAAE,CAAC;IAC5B,IAAA,6BAAkB,GAAE,CAAC;IAErB,oEAAoE;IACpE,OAAO,CAAC,GAAG,CAAC,2CAA4B,CAAC,oBAAoB,CAAC,GAAG,MAAM,CAAC;IACxE,M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AAK,0BAAW,CAAC,QAAQ,EAAE,CAAC;QACrE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,0CAA4B,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACjF,CAAC;QACD,mCAAsB,CAAC,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;QAC/D,KAAK,GAAG,MAAM,IAAA,qCAA0B,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/D,CAAC;SAAM,IAAI,uBAAuB,CAAC,eAAe,KAAK,0BAAW,CAAC,YAAY,EAAE,CAAC;QAChF,IAAA,yBAAc,EAAC,uCAA4B,CAAC,CAAC;QAC7C,KAAK,GAAG,IAAA,yBAAc,GAAE,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,0CAA4B,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0CAA4B,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,UAAU,EAAE,IAAA,+BAAoB,EAC9B,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,IAAA,4BAAiB,GAAE,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;AAEoC,8CAAiB","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"]}
@@ -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"}
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ServiceEnvironmentVariable = exports.ServiceAuth = exports.ServiceOS = exports.getConnectOptions = exports.getServiceConfig = void 0;
5
+ exports.ServiceEnvironmentVariable = exports.ServiceAuth = exports.ServiceOS = exports.getConnectOptions = exports.createAzurePlaywrightConfig = void 0;
6
6
  /**
7
7
  * Library for integrating Azure Playwright with existing playwright projects.
8
8
  *
@@ -13,6 +13,6 @@ Object.defineProperty(exports, "ServiceAuth", { enumerable: true, get: function
13
13
  Object.defineProperty(exports, "ServiceOS", { enumerable: true, get: function () { return constants_js_1.ServiceOS; } });
14
14
  Object.defineProperty(exports, "ServiceEnvironmentVariable", { enumerable: true, get: function () { return constants_js_1.ServiceEnvironmentVariable; } });
15
15
  const playwrightService_js_1 = require("./core/playwrightService.js");
16
- Object.defineProperty(exports, "getServiceConfig", { enumerable: true, get: function () { return playwrightService_js_1.getServiceConfig; } });
16
+ Object.defineProperty(exports, "createAzurePlaywrightConfig", { enumerable: true, get: function () { return playwrightService_js_1.createAzurePlaywrightConfig; } });
17
17
  Object.defineProperty(exports, "getConnectOptions", { enumerable: true, get: function () { return playwrightService_js_1.getConnectOptions; } });
18
18
  //# 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,wDAA2F;AAczF,4FAdO,0BAAW,OAcP;AADX,0FAboB,wBAAS,OAapB;AAET,2GAf+B,yCAA0B,OAe/B;AAP5B,sEAAkF;AAGhF,iGAHO,uCAAgB,OAGP;AAChB,kGAJyB,wCAAiB,OAIzB","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,wDAA2F;AAczF,4FAdO,0BAAW,OAcP;AADX,0FAboB,wBAAS,OAapB;AAET,2GAf+B,yCAA0B,OAe/B;AAP5B,sEAA6F;AAG3F,4GAHO,kDAA2B,OAGP;AAC3B,kGAJoC,wCAAiB,OAIpC","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"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.10"
8
+ "packageVersion": "7.52.11"
9
9
  }
10
10
  ]
11
11
  }
@@ -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.