@azure/microsoft-playwright-testing 1.0.0-alpha.20241015.1 → 1.0.0-alpha.20241016.2

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.
@@ -26,7 +26,6 @@ export declare const ServiceAuth: {
26
26
  */
27
27
  export declare const ServiceEnvironmentVariable: {
28
28
  PLAYWRIGHT_SERVICE_OS: string;
29
- PLAYWRIGHT_SERVICE_RUN_ID: string;
30
29
  PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string;
31
30
  PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string;
32
31
  PLAYWRIGHT_SERVICE_URL: string;
@@ -86,6 +85,7 @@ export declare const TestResultErrorConstants: {
86
85
  export declare const InternalEnvironmentVariables: {
87
86
  MPT_PLAYWRIGHT_VERSION: string;
88
87
  MPT_SETUP_FATAL_ERROR: string;
88
+ MPT_SERVICE_RUN_ID: string;
89
89
  MPT_CLOUD_HOSTED_BROWSER_USED: string;
90
90
  };
91
91
  export declare const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = "1.47.0";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;CAOtC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;CAK1C,CAAC;AAEF,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAKhD,qBAAa,SAAS;IAEpB,gBAAuB,mBAAmB,gBAAgB;IAC1D,gBAAuB,yBAAyB,gBAAgB;IAChE,gBAAuB,SAAS,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AuB,YAAY,EAAE,MAAM,CAAkB;IAC7D,gBAAuB,UAAU,EAAE,MAAM,CAAgB;IACzD,gBAAuB,sBAAsB,EAAE,MAAM,CAA4B;IACjF,gBAAuB,oBAAoB,EAAE,MAAM,CAA0B;IAC7E,gBAAuB,eAAe,EAAE,MAAM,CAAqB;IACnE,gBAAuB,aAAa,EAAE,MAAM,CAAmB;IAC/D,gBAAuB,aAAa,EAAE,eAAe,CAsDnD;CACH;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;GAwEpC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;CAKxC,CAAC;AAEF,eAAO,MAAM,oCAAoC,WAAW,CAAC"}
@@ -28,7 +28,6 @@ exports.ServiceAuth = {
28
28
  */
29
29
  exports.ServiceEnvironmentVariable = {
30
30
  PLAYWRIGHT_SERVICE_OS: "PLAYWRIGHT_SERVICE_OS",
31
- PLAYWRIGHT_SERVICE_RUN_ID: "PLAYWRIGHT_SERVICE_RUN_ID",
32
31
  PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: "PLAYWRIGHT_SERVICE_EXPOSE_NETWORK",
33
32
  PLAYWRIGHT_SERVICE_ACCESS_TOKEN: "PLAYWRIGHT_SERVICE_ACCESS_TOKEN",
34
33
  PLAYWRIGHT_SERVICE_URL: "PLAYWRIGHT_SERVICE_URL",
@@ -216,6 +215,7 @@ exports.TestResultErrorConstants = [
216
215
  exports.InternalEnvironmentVariables = {
217
216
  MPT_PLAYWRIGHT_VERSION: "_MPT_PLAYWRIGHT_VERSION",
218
217
  MPT_SETUP_FATAL_ERROR: "_MPT_SETUP_FATAL_ERROR",
218
+ MPT_SERVICE_RUN_ID: "_MPT_SERVICE_RUN_ID",
219
219
  MPT_CLOUD_HOSTED_BROWSER_USED: "_MPT_CLOUD_HOSTED_BROWSER_USED",
220
220
  };
221
221
  exports.MINIMUM_SUPPORTED_PLAYWRIGHT_VERS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CAAC;AAEW,QAAA,oCAAoC,GAAG,QAAQ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ApiErrorMessage } from \"./types\";\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 Microsoft Playwright Testing 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 Microsoft Playwright Testing\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 Microsoft Playwright Testing\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_OS: \"PLAYWRIGHT_SERVICE_OS\",\n PLAYWRIGHT_SERVICE_RUN_ID: \"PLAYWRIGHT_SERVICE_RUN_ID\",\n PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: \"PLAYWRIGHT_SERVICE_EXPOSE_NETWORK\",\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n PLAYWRIGHT_SERVICE_REPORTING_URL: \"PLAYWRIGHT_SERVICE_REPORTING_URL\",\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};\n\nexport const API_VERSION = \"2023-10-01-preview\";\n\n// Do not put an ending slash for the urls,\n// for example use https://www.microsoft.com/en-in and not https://www.microsoft.com/en-in/\n\nexport class Constants {\n // Config related constants\n public static readonly TEST_FRAMEWORK_NAME = \"PLAYWRIGHT\";\n public static readonly TEST_FRAMEWORK_RUNNERNAME = \"PLAYWRIGHT\";\n public static readonly TEST_TYPE = \"WebTest\";\n public static readonly TEST_SDK_LANGUAGE = \"JAVASCRIPT\";\n // Placeholder version\n public static readonly REPORTER_PACKAGE_VERSION = \"1.0.0-beta.3\";\n public static readonly DEFAULT_DASHBOARD_ENDPOINT = \"https://playwright.microsoft.com\";\n public static readonly DEFAULT_SERVICE_ENDPOINT =\n \"https://{region}.reporting.api.playwright-test.io\";\n public static readonly DEFAULT_REDACTED_MESSAGE = \"***REDACTED***\";\n public static readonly SAS_URI_SEPARATOR = \"?\";\n public static readonly DEFAULT_TEST_RUN_NAME = \"MPTReporterTests\";\n public static readonly TEST_BATCH_SIZE = 50;\n public static readonly UPLOAD_MODE = \"sdk\";\n public static readonly GIT_VERSION_COMMAND = \"git --version\";\n public static readonly GIT_REV_PARSE = \"git rev-parse --is-inside-work-tree\";\n public static readonly GIT_COMMIT_MESSAGE_COMMAND = 'git log -1 --pretty=format:\"%s\"';\n public static readonly ERROR_MESSAGES_MAX_LENGTH = 100;\n public static readonly API_VERSION = \"2024-09-01-preview\";\n public static readonly NON_RETRYABLE_STATUS_CODES = [400, 403, 404, 405, 409];\n public static readonly SupportedRegions: string[] = [\n \"eastus\",\n \"eastasia\",\n \"westeurope\",\n \"westus3\",\n \"centraluseuap\",\n \"eastus2euap\",\n ];\n // Error messages\n public static readonly CONFLICT_409_ERROR_MESSAGE =\n \"Test run with id {runId} already exists. Provide a unique run id.\";\n public static readonly FORBIDDEN_403_ERROR_MESSAGE =\n \"Reporting is not enabled for your workspace {workspaceId}. Enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general\";\n // API Endpoints\n public static readonly testRunsEndpoint: string = \"workspaces/{workspaceId}/test-runs\";\n public static readonly testRunsShardEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:updateShardExecutionStatus\";\n public static readonly storageUriEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:createArtifactsUploadBaseUri\";\n public static readonly testResultsEndpoint: string =\n \"workspaces/{workspaceId}/test-results/upload-batch\";\n public static readonly patchTestRun: string = \"patchTestRun\";\n public static readonly getTestRun: string = \"getTestRun\";\n public static readonly patchTestRunShardStart: string = \"patchTestRunShardStart\";\n public static readonly patchTestRunShardEnd: string = \"patchTestRunShardEnd\";\n public static readonly postTestResults: string = \"postTestResults\";\n public static readonly getStorageUri: string = \"getStorageUri\";\n public static readonly ERROR_MESSAGE: ApiErrorMessage = {\n patchTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardStart: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardEnd: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n postTestResults: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getStorageUri: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n };\n}\n\nexport const TestErrorType = {\n Scalable: \"Scalable\",\n Reporting: \"Reporting\",\n};\n\nexport const TestResultErrorConstants = [\n {\n key: \"401\",\n message: \"The authentication token provided is invalid. Please check the token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*401 Unauthorized)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"NoPermissionOnWorkspace_Scalable\",\n message: `You do not have the required permissions to run tests. This could be because:\n\n a. You do not have the required roles on the workspace. Only Owner and Contributor roles can run tests. Contact the service administrator.\n b. The workspace you are trying to run the tests on is in a different Azure tenant than what you are signed into. Check the tenant id from Azure portal (https://aka.ms/mpt/find-tenant-id) and login using the command 'az login --tenant <TENANT_ID>'.\n `,\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*CheckAccess API call with non successful response)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidWorkspace_Scalable\",\n message: \"The specified workspace does not exist. Please verify your workspace settings.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccountOrSubscriptionState)/i,\n type: TestErrorType.Scalable,\n },\n {\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 pattern: /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccessToken)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessTokenOrUserOrWorkspaceNotFound_Scalable\",\n message:\n \"The data for the user, workspace or access token was not found. Please check the request or create new token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*404 Not Found)(?=[\\s\\S]*NotFound)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessKeyBasedAuthNotSupported_Scalable\",\n message:\n \"Authentication through service access token is disabled for this workspace. Please use Entra ID to authenticate.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*AccessKeyBasedAuthNotSupported)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"503\",\n message: \"The service is currently unavailable. Please check the service status and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*503 Service Unavailable)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"504\",\n message: \"The request to the service timed out. Please try again later.\",\n pattern: /(?=.*browserType\\.connect)(?=.*504 Gateway Timeout)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"QuotaLimitError_Scalable\",\n message:\n \"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded. Check the quota at https://aka.ms/mpt/resource-quota.\",\n pattern: /browserType.connect: Timeout .* exceeded/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"BrowserConnectionError_Scalable\",\n message: \"The service is currently unavailable. Please try again after some time.\",\n pattern: /browserType.connect: Target page, context or browser has been closed/i,\n type: TestErrorType.Scalable,\n },\n];\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n};\n\nexport const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = \"1.47.0\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAIa,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,qBAAqB,EAAE,uBAAuB;IAC9C,sDAAsD,EAAE,mCAAmC;IAC3F,+BAA+B,EAAE,iCAAiC;IAClE,sBAAsB,EAAE,wBAAwB;IAChD,gCAAgC,EAAE,kCAAkC;CACrE,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,YAAY;IACpC,kBAAkB,E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O,EAAE,+DAA+D;QACxE,OAAO,EAAE,sDAAsD;QAC/D,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,0BAA0B;QAC/B,OAAO,EACL,mKAAmK;QACrK,OAAO,EAAE,2CAA2C;QACpD,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,iCAAiC;QACtC,OAAO,EAAE,yEAAyE;QAClF,OAAO,EAAE,uEAAuE;QAChF,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;CACF,CAAC;AAEW,QAAA,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,kBAAkB,EAAE,qBAAqB;IACzC,6BAA6B,EAAE,gCAAgC;CAChE,CAAC;AAEW,QAAA,oCAAoC,GAAG,QAAQ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ApiErrorMessage } from \"./types\";\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 Microsoft Playwright Testing 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 Microsoft Playwright Testing\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 Microsoft Playwright Testing\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_OS: \"PLAYWRIGHT_SERVICE_OS\",\n PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: \"PLAYWRIGHT_SERVICE_EXPOSE_NETWORK\",\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n PLAYWRIGHT_SERVICE_REPORTING_URL: \"PLAYWRIGHT_SERVICE_REPORTING_URL\",\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};\n\nexport const API_VERSION = \"2023-10-01-preview\";\n\n// Do not put an ending slash for the urls,\n// for example use https://www.microsoft.com/en-in and not https://www.microsoft.com/en-in/\n\nexport class Constants {\n // Config related constants\n public static readonly TEST_FRAMEWORK_NAME = \"PLAYWRIGHT\";\n public static readonly TEST_FRAMEWORK_RUNNERNAME = \"PLAYWRIGHT\";\n public static readonly TEST_TYPE = \"WebTest\";\n public static readonly TEST_SDK_LANGUAGE = \"JAVASCRIPT\";\n // Placeholder version\n public static readonly REPORTER_PACKAGE_VERSION = \"1.0.0-beta.3\";\n public static readonly DEFAULT_DASHBOARD_ENDPOINT = \"https://playwright.microsoft.com\";\n public static readonly DEFAULT_SERVICE_ENDPOINT =\n \"https://{region}.reporting.api.playwright-test.io\";\n public static readonly DEFAULT_REDACTED_MESSAGE = \"***REDACTED***\";\n public static readonly SAS_URI_SEPARATOR = \"?\";\n public static readonly DEFAULT_TEST_RUN_NAME = \"MPTReporterTests\";\n public static readonly TEST_BATCH_SIZE = 50;\n public static readonly UPLOAD_MODE = \"sdk\";\n public static readonly GIT_VERSION_COMMAND = \"git --version\";\n public static readonly GIT_REV_PARSE = \"git rev-parse --is-inside-work-tree\";\n public static readonly GIT_COMMIT_MESSAGE_COMMAND = 'git log -1 --pretty=format:\"%s\"';\n public static readonly ERROR_MESSAGES_MAX_LENGTH = 100;\n public static readonly API_VERSION = \"2024-09-01-preview\";\n public static readonly NON_RETRYABLE_STATUS_CODES = [400, 403, 404, 405, 409];\n public static readonly SupportedRegions: string[] = [\n \"eastus\",\n \"eastasia\",\n \"westeurope\",\n \"westus3\",\n \"centraluseuap\",\n \"eastus2euap\",\n ];\n // Error messages\n public static readonly CONFLICT_409_ERROR_MESSAGE =\n \"Test run with id {runId} already exists. Provide a unique run id.\";\n public static readonly FORBIDDEN_403_ERROR_MESSAGE =\n \"Reporting is not enabled for your workspace {workspaceId}. Enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general\";\n // API Endpoints\n public static readonly testRunsEndpoint: string = \"workspaces/{workspaceId}/test-runs\";\n public static readonly testRunsShardEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:updateShardExecutionStatus\";\n public static readonly storageUriEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:createArtifactsUploadBaseUri\";\n public static readonly testResultsEndpoint: string =\n \"workspaces/{workspaceId}/test-results/upload-batch\";\n public static readonly patchTestRun: string = \"patchTestRun\";\n public static readonly getTestRun: string = \"getTestRun\";\n public static readonly patchTestRunShardStart: string = \"patchTestRunShardStart\";\n public static readonly patchTestRunShardEnd: string = \"patchTestRunShardEnd\";\n public static readonly postTestResults: string = \"postTestResults\";\n public static readonly getStorageUri: string = \"getStorageUri\";\n public static readonly ERROR_MESSAGE: ApiErrorMessage = {\n patchTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardStart: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardEnd: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n postTestResults: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getStorageUri: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n };\n}\n\nexport const TestErrorType = {\n Scalable: \"Scalable\",\n Reporting: \"Reporting\",\n};\n\nexport const TestResultErrorConstants = [\n {\n key: \"401\",\n message: \"The authentication token provided is invalid. Please check the token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*401 Unauthorized)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"NoPermissionOnWorkspace_Scalable\",\n message: `You do not have the required permissions to run tests. This could be because:\n\n a. You do not have the required roles on the workspace. Only Owner and Contributor roles can run tests. Contact the service administrator.\n b. The workspace you are trying to run the tests on is in a different Azure tenant than what you are signed into. Check the tenant id from Azure portal (https://aka.ms/mpt/find-tenant-id) and login using the command 'az login --tenant <TENANT_ID>'.\n `,\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*CheckAccess API call with non successful response)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidWorkspace_Scalable\",\n message: \"The specified workspace does not exist. Please verify your workspace settings.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccountOrSubscriptionState)/i,\n type: TestErrorType.Scalable,\n },\n {\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 pattern: /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccessToken)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessTokenOrUserOrWorkspaceNotFound_Scalable\",\n message:\n \"The data for the user, workspace or access token was not found. Please check the request or create new token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*404 Not Found)(?=[\\s\\S]*NotFound)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessKeyBasedAuthNotSupported_Scalable\",\n message:\n \"Authentication through service access token is disabled for this workspace. Please use Entra ID to authenticate.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*AccessKeyBasedAuthNotSupported)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"503\",\n message: \"The service is currently unavailable. Please check the service status and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*503 Service Unavailable)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"504\",\n message: \"The request to the service timed out. Please try again later.\",\n pattern: /(?=.*browserType\\.connect)(?=.*504 Gateway Timeout)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"QuotaLimitError_Scalable\",\n message:\n \"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded. Check the quota at https://aka.ms/mpt/resource-quota.\",\n pattern: /browserType.connect: Timeout .* exceeded/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"BrowserConnectionError_Scalable\",\n message: \"The service is currently unavailable. Please try again after some time.\",\n pattern: /browserType.connect: Target page, context or browser has been closed/i,\n type: TestErrorType.Scalable,\n },\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_ID: \"_MPT_SERVICE_RUN_ID\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n};\n\nexport const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = \"1.47.0\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"environmentVariables.d.ts","sourceRoot":"","sources":["../../src/common/environmentVariables.ts"],"names":[],"mappings":"AAKA,qBAAa,oBAAoB;IAC/B,IAAI,WAAW,IAAI,MAAM,CAExB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;;CAK5B"}
1
+ {"version":3,"file":"environmentVariables.d.ts","sourceRoot":"","sources":["../../src/common/environmentVariables.ts"],"names":[],"mappings":"AAMA,qBAAa,oBAAoB;IAC/B,IAAI,WAAW,IAAI,MAAM,CAExB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;;CAK5B"}
@@ -4,12 +4,13 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.EnvironmentVariables = void 0;
6
6
  const crypto_1 = require("crypto");
7
+ const constants_1 = require("./constants");
7
8
  class EnvironmentVariables {
8
9
  get accessToken() {
9
10
  return process.env["PLAYWRIGHT_SERVICE_ACCESS_TOKEN"];
10
11
  }
11
12
  constructor() {
12
- this.runId = process.env["PLAYWRIGHT_SERVICE_RUN_ID"];
13
+ this.runId = process.env[constants_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID];
13
14
  this.correlationId = (0, crypto_1.randomUUID)();
14
15
  }
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environmentVariables.js","sourceRoot":"","sources":["../../src/common/environmentVariables.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mCAAoC;AAEpC,MAAa,oBAAoB;IAC/B,IAAI,WAAW;QACb,OAAO,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAE,CAAC;IACzD,CAAC;IAQD;QACE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAE,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,IAAA,mBAAU,GAAE,CAAC;IACpC,CAAC;CACF;AAfD,oDAeC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { randomUUID } from \"crypto\";\n\nexport class EnvironmentVariables {\n get accessToken(): string {\n return process.env[\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\"]!;\n }\n runId: string;\n accountId: string | undefined;\n userId: string | undefined;\n userName: string | undefined;\n correlationId: string | undefined;\n shardId: string | undefined;\n region: string | undefined;\n constructor() {\n this.runId = process.env[\"PLAYWRIGHT_SERVICE_RUN_ID\"]!;\n this.correlationId = randomUUID();\n }\n}\n"]}
1
+ {"version":3,"file":"environmentVariables.js","sourceRoot":"","sources":["../../src/common/environmentVariables.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mCAAoC;AACpC,2CAA2D;AAE3D,MAAa,oBAAoB;IAC/B,IAAI,WAAW;QACb,OAAO,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAE,CAAC;IACzD,CAAC;IAQD;QACE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,wCAA4B,CAAC,kBAAkB,CAAE,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,IAAA,mBAAU,GAAE,CAAC;IACpC,CAAC;CACF;AAfD,oDAeC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { randomUUID } from \"crypto\";\nimport { InternalEnvironmentVariables } from \"./constants\";\n\nexport class EnvironmentVariables {\n get accessToken(): string {\n return process.env[\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\"]!;\n }\n runId: string;\n accountId: string | undefined;\n userId: string | undefined;\n userName: string | undefined;\n correlationId: string | undefined;\n shardId: string | undefined;\n region: string | undefined;\n constructor() {\n this.runId = process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID]!;\n this.correlationId = randomUUID();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceConfig.d.ts","sourceRoot":"","sources":["../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGrE,cAAM,uBAAuB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;;IAY7B,UAAU,aAAc,kCAAkC,KAAG,IAAI,CAkB/D;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"playwrightServiceConfig.d.ts","sourceRoot":"","sources":["../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGrE,cAAM,uBAAuB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;;IAW7B,UAAU,aAAc,kCAAkC,KAAG,IAAI,CAsB/D;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -11,9 +11,14 @@ class PlaywrightServiceConfig {
11
11
  if (options === null || options === void 0 ? void 0 : options.exposeNetwork) {
12
12
  this.exposeNetwork = options.exposeNetwork;
13
13
  }
14
- if (options === null || options === void 0 ? void 0 : options.runId) {
15
- this.runId = options.runId;
16
- process.env[constants_1.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] = this.runId;
14
+ if (!process.env[constants_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID]) {
15
+ if (options === null || options === void 0 ? void 0 : options.runId) {
16
+ this.runId = options.runId;
17
+ process.env[constants_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = this.runId;
18
+ }
19
+ else {
20
+ this.runId = (0, utils_1.getAndSetRunId)();
21
+ }
17
22
  }
18
23
  if (options === null || options === void 0 ? void 0 : options.os) {
19
24
  this.serviceOs = options.os;
@@ -28,8 +33,7 @@ class PlaywrightServiceConfig {
28
33
  };
29
34
  this.serviceOs = (process.env[constants_1.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_OS] ||
30
35
  constants_1.DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS);
31
- this.runId =
32
- process.env[constants_1.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] || (0, utils_1.getDefaultRunId)();
36
+ this.runId = process.env[constants_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] || "";
33
37
  this.timeout = constants_1.DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;
34
38
  this.slowMo = constants_1.DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;
35
39
  this.exposeNetwork = constants_1.DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;
@@ -1 +1 @@
1
- {"version":3,"file":"playwrightServiceConfig.js","sourceRoot":"","sources":["../../src/common/playwrightServiceConfig.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,2CAAyF;AAEzF,0CAAiD;AAEjD,MAAM,uBAAuB;IAO3B;QAUA,eAAU,GAAG,CAAC,OAA4C,EAAQ,EAAE;YAClE,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE,CAAC;gBAC3B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC7C,CAAC;YACD,IAAI,OAAO,aAAP,OAAO,uBAAP,OA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ceEnvironmentVariable } from \"./constants\";\nimport { PlaywrightServiceAdditionalOptions, OsType } from \"./types\";\nimport { getDefaultRunId } from \"../utils/utils\";\n\nclass PlaywrightServiceConfig {\n public serviceOs: OsType;\n public runId: string;\n public timeout: number;\n public slowMo: number;\n public exposeNetwork: string;\n\n constructor() {\n this.serviceOs = (process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_OS] ||\n DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS) as OsType;\n this.runId =\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] || getDefaultRunId();\n this.timeout = DefaultConnectOptionsConstants.DEFAULT_TIMEOUT;\n this.slowMo = DefaultConnectOptionsConstants.DEFAULT_SLOW_MO;\n this.exposeNetwork = DefaultConnectOptionsConstants.DEFAULT_EXPOSE_NETWORK;\n }\n\n setOptions = (options?: PlaywrightServiceAdditionalOptions): void => {\n if (options?.exposeNetwork) {\n this.exposeNetwork = options.exposeNetwork;\n }\n if (options?.runId) {\n this.runId = options.runId;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] = this.runId;\n }\n if (options?.os) {\n this.serviceOs = options.os;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_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,2CAIqB;AAErB,0CAAgD;AAEhD,MAAM,uBAAuB;IAO3B;QASA,eAAU,GAAG,CAAC,OAA4C,EAAQ,EAAE;YAClE,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE,CAAC;gBAC3B,IAAI,CAAC,aAAa,GAAG,OAA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,CAAC;QAC9D,IAAI,CAAC,MAAM,GAAG,0CAA8B,CAAC,eAAe,CAAC;QAC7D,IAAI,CAAC,aAAa,GAAG,0CAA8B,CAAC,sBAAsB,CAAC;IAC7E,CAAC;CAyBF;AAEQ,0DAAuB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DefaultConnectOptionsConstants,\n InternalEnvironmentVariables,\n ServiceEnvironmentVariable,\n} from \"./constants\";\nimport { PlaywrightServiceAdditionalOptions, OsType } from \"./types\";\nimport { getAndSetRunId } from \"../utils/utils\";\n\nclass PlaywrightServiceConfig {\n public serviceOs: OsType;\n public runId: string;\n public timeout: number;\n public slowMo: number;\n public exposeNetwork: string;\n\n constructor() {\n this.serviceOs = (process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_OS] ||\n DefaultConnectOptionsConstants.DEFAULT_SERVICE_OS) as OsType;\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 }\n\n setOptions = (options?: PlaywrightServiceAdditionalOptions): void => {\n if (options?.exposeNetwork) {\n this.exposeNetwork = options.exposeNetwork;\n }\n if (!process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID]) {\n if (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 (options?.os) {\n this.serviceOs = options.os;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_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"]}
@@ -12,7 +12,7 @@ export declare const populateValuesFromServiceUrl: () => {
12
12
  export declare const parseJwt: <T = JwtPayload>(token: string) => T;
13
13
  export declare const getAccessToken: () => string | undefined;
14
14
  export declare const getServiceBaseURL: () => string | undefined;
15
- export declare const getDefaultRunId: () => string;
15
+ export declare const getAndSetRunId: () => string;
16
16
  export declare const getServiceWSEndpoint: (runId: string, os: string) => string;
17
17
  export declare const validateServiceUrl: () => void;
18
18
  export declare const validateMptPAT: (validationFailureCallback: (error: {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAU/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMvD,eAAO,MAAM,sBAAsB,UAAW;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KAAG,KAKhF,CAAC;AACF,eAAO,MAAM,eAAe,cAAe,MAAM,KAAG,MAInD,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAAO;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAevF,CAAC;AACF,eAAO,MAAM,QAAQ,GAAI,CAAC,sBAAsB,MAAM,KAAG,CAOxD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,SAE1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,MAAM,GAAG,SAE7C,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,MAIlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,MAAM,MAAM,MAAM,KAAG,MAEhE,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,IAKrC,CAAC;AAEF,eAAO,MAAM,cAAc,8BACE,CAAC,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,O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AM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,KAC3E,IAqBF,CAAC;AAEF,eAAO,MAAM,0BAA0B,gBAAuB,eAAe,KAAG,OAAO,CAAC,MAAM,CAS7F,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,IAUnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,MAcvC,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,WAYhD,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,IAa5C,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.validatePlaywrightVersion = exports.getVersionInfo = exports.getPlaywrightVersion = exports.emitReportingUrl = exports.fetchOrValidateAccessToken = exports.validateMptPAT = exports.validateServiceUrl = exports.getServiceWSEndpoint = exports.getDefaultRunId = exports.getServiceBaseURL = exports.getAccessToken = exports.parseJwt = exports.populateValuesFromServiceUrl = exports.base64UrlDecode = exports.exitWithFailureMessage = void 0;
5
+ exports.validatePlaywrightVersion = exports.getVersionInfo = exports.getPlaywrightVersion = exports.emitReportingUrl = exports.fetchOrValidateAccessToken = exports.validateMptPAT = exports.validateServiceUrl = exports.getServiceWSEndpoint = exports.getAndSetRunId = exports.getServiceBaseURL = exports.getAccessToken = exports.parseJwt = exports.populateValuesFromServiceUrl = exports.base64UrlDecode = exports.exitWithFailureMessage = void 0;
6
6
  const tslib_1 = require("tslib");
7
7
  const constants_1 = require("../common/constants");
8
8
  const messages_1 = require("../common/messages");
@@ -57,12 +57,12 @@ const getServiceBaseURL = () => {
57
57
  return process.env[constants_1.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_URL];
58
58
  };
59
59
  exports.getServiceBaseURL = getServiceBaseURL;
60
- const getDefaultRunId = () => {
60
+ const getAndSetRunId = () => {
61
61
  const runId = reporterUtils_1.default.getRunId(cIInfoProvider_1.CIInfoProvider.getCIInfo());
62
- process.env[constants_1.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] = runId;
62
+ process.env[constants_1.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = runId;
63
63
  return runId;
64
64
  };
65
- exports.getDefaultRunId = getDefaultRunId;
65
+ exports.getAndSetRunId = getAndSetRunId;
66
66
  const getServiceWSEndpoint = (runId, os) => {
67
67
  return `${(0, exports.getServiceBaseURL)()}?runId=${runId}&os=${os}&api-version=${constants_1.API_VERSION}`;
68
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAGlC,mDAK6B;AAC7B,iDAAkE;AAClE,qEAAkE;AAClE,6CAA8C;AAE9C,4EAA4C;AAC5C,qDAAkD;AAClD,qDAAqD;AACrD,iDAAyC;AAElC,MAAM,sBAAsB,GAAG,CAAC,KAAuC,EAAS,EAAE;IACvF,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AACK,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAEK,MAAM,4BAA4B,GAAG,GAAiD,EA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B,CAAC,KAAK,CAAC,CAAC;IACrE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC/B,IAAA,8BAAsB,EAAC,uCAA4B,CAAC,gCAAgC,CAAC,CAAC;IACxF,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { JwtPayload, VersionInfo } from \"../common/types\";\nimport {\n API_VERSION,\n InternalEnvironmentVariables,\n MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION,\n ServiceEnvironmentVariable,\n} from \"../common/constants\";\nimport { ServiceErrorMessageConstants } from \"../common/messages\";\nimport { EntraIdAccessToken } from \"../common/entraIdAccessToken\";\nimport { coreLogger } from \"../common/logger\";\nimport type { TokenCredential } from \"@azure/identity\";\nimport ReporterUtils from \"./reporterUtils\";\nimport { CIInfoProvider } from \"./cIInfoProvider\";\nimport { getPackageManager } from \"./packageManager\";\nimport { execSync } from \"child_process\";\n\nexport const exitWithFailureMessage = (error: { key: string; message: string }): never => {\n console.log();\n console.error(error.message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n};\nexport const base64UrlDecode = (base64Url: string): string => {\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const buffer = Buffer.from(base64, \"base64\");\n return buffer.toString(\"utf-8\");\n};\n\nexport const populateValuesFromServiceUrl = (): { region: string; accountId: string } | null => {\n // Service URL format: wss://<region>.api.playwright.microsoft.com/accounts/<workspace-id>/browsers\n const url = process.env[\"PLAYWRIGHT_SERVICE_URL\"]!;\n if (!ReporterUtils.isNullOrEmpty(url)) {\n const parts = url.split(\"/\");\n\n if (parts.length > 2) {\n const subdomainParts = parts[2]!.split(\".\");\n const region = subdomainParts.length > 0 ? subdomainParts[0] : null;\n const accountId = parts[4];\n\n return { region: region!, accountId: accountId! };\n }\n }\n return null;\n};\nexport const parseJwt = <T = JwtPayload>(token: string): T => {\n const parts = token.split(\".\");\n if (parts.length !== 3) {\n throw new Error(\"Invalid JWT token.\");\n }\n const payload = base64UrlDecode(parts[1]!);\n return JSON.parse(payload) as T;\n};\n\nexport const getAccessToken = (): string | undefined => {\n return process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN];\n};\n\nexport const getServiceBaseURL = (): string | undefined => {\n return process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_URL];\n};\n\nexport const getDefaultRunId = (): string => {\n const runId = ReporterUtils.getRunId(CIInfoProvider.getCIInfo());\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_RUN_ID] = runId;\n return runId;\n};\n\nexport const getServiceWSEndpoint = (runId: string, os: string): string => {\n return `${getServiceBaseURL()}?runId=${runId}&os=${os}&api-version=${API_VERSION}`;\n};\n\nexport const validateServiceUrl = (): void => {\n const serviceUrl = getServiceBaseURL();\n if (!serviceUrl) {\n exitWithFailureMessage(ServiceErrorMessageConstants.NO_SERVICE_URL_ERROR);\n }\n};\n\nexport const validateMptPAT = (\n validationFailureCallback: (error: { key: string; message: string }) => void,\n): void => {\n try {\n const accessToken = getAccessToken();\n const result = populateValuesFromServiceUrl();\n if (!accessToken) {\n validationFailureCallback(ServiceErrorMessageConstants.NO_AUTH_ERROR);\n }\n const claims = parseJwt<JwtPayload>(accessToken!);\n if (!claims.exp) {\n validationFailureCallback(ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);\n }\n if (Date.now() >= claims.exp! * 1000) {\n validationFailureCallback(ServiceErrorMessageConstants.EXPIRED_MPT_PAT_ERROR);\n }\n if (result!.accountId !== claims!.aid) {\n validationFailureCallback(ServiceErrorMessageConstants.WORKSPACE_MISMATCH_ERROR);\n }\n } catch (err) {\n coreLogger.error(err);\n exitWithFailureMessage(ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);\n }\n};\n\nexport const fetchOrValidateAccessToken = async (credential?: TokenCredential): Promise<string> => {\n const entraIdAccessToken = new EntraIdAccessToken(credential);\n if (entraIdAccessToken.token && entraIdAccessToken.doesEntraIdAccessTokenNeedRotation()) {\n await entraIdAccessToken.fetchEntraIdAccessToken();\n }\n if (!getAccessToken()) {\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);\n }\n return getAccessToken()!;\n};\n\nexport const emitReportingUrl = (): void => {\n const regex =\n /wss:\\/\\/([\\w-]+)\\.api\\.(playwright(?:-test|-int)?\\.io|playwright\\.microsoft\\.com)\\//;\n const url = getServiceBaseURL();\n const match = url?.match(regex);\n if (match && match.length >= 3) {\n const [, region, domain] = match;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_REPORTING_URL] =\n `https://${region}.reporting.api.${domain}`;\n }\n};\n\nexport const getPlaywrightVersion = (): string => {\n if (process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]) {\n return process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]!;\n }\n\n const packageManager = getPackageManager();\n const command = packageManager.runCommand(\"playwright\", \"--version\");\n const stdout = execSync(command).toString().trim();\n const version = packageManager.getVersionFromStdout(stdout);\n process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION] = version;\n coreLogger.info(\n `Playwright version being used - ${process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]}`,\n );\n return process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]!;\n};\n\nexport const getVersionInfo = (version: string): VersionInfo => {\n const regex = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?/;\n const match = version.match(regex);\n const versionInfo = {\n major: 0,\n minor: 0,\n patch: 0,\n };\n versionInfo.major = match && match[1] ? parseInt(match[1], 10) : 0;\n versionInfo.minor = match && match[2] ? parseInt(match[2], 10) : 0;\n versionInfo.patch = match && match[3] ? parseInt(match[3], 10) : 0;\n return versionInfo;\n};\n\nexport const validatePlaywrightVersion = (): void => {\n const minimumSupportedVersion = MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION;\n const installedVersion = getPlaywrightVersion();\n\n const minimumSupportedVersionInfo = getVersionInfo(minimumSupportedVersion);\n const installedVersionInfo = getVersionInfo(installedVersion);\n const isInstalledVersionGreater =\n installedVersionInfo.major > minimumSupportedVersionInfo.major ||\n (installedVersionInfo.major === minimumSupportedVersionInfo.major &&\n installedVersionInfo.minor >= minimumSupportedVersionInfo.minor);\n if (!isInstalledVersionGreater) {\n exitWithFailureMessage(ServiceErrorMessageConstants.INVALID_PLAYWRIGHT_VERSION_ERROR);\n }\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAGlC,mDAK6B;AAC7B,iDAAkE;AAClE,qEAAkE;AAClE,6CAA8C;AAE9C,4EAA4C;AAC5C,qDAAkD;AAClD,qDAAqD;AACrD,iDAAyC;AAElC,MAAM,sBAAsB,GAAG,CAAC,KAAuC,EAAS,EAAE;IACvF,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AACK,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAEK,MAAM,4BAA4B,GAAG,GAAiD,EAAE;IAC7F,mGAAmG;IACnG,MAAM,GAAG,G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AC,yBAAyB,EAAE,CAAC;QAC/B,IAAA,8BAAsB,EAAC,uCAA4B,CAAC,gCAAgC,CAAC,CAAC;IACxF,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { JwtPayload, VersionInfo } from \"../common/types\";\nimport {\n API_VERSION,\n InternalEnvironmentVariables,\n MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION,\n ServiceEnvironmentVariable,\n} from \"../common/constants\";\nimport { ServiceErrorMessageConstants } from \"../common/messages\";\nimport { EntraIdAccessToken } from \"../common/entraIdAccessToken\";\nimport { coreLogger } from \"../common/logger\";\nimport type { TokenCredential } from \"@azure/identity\";\nimport ReporterUtils from \"./reporterUtils\";\nimport { CIInfoProvider } from \"./cIInfoProvider\";\nimport { getPackageManager } from \"./packageManager\";\nimport { execSync } from \"child_process\";\n\nexport const exitWithFailureMessage = (error: { key: string; message: string }): never => {\n console.log();\n console.error(error.message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n};\nexport const base64UrlDecode = (base64Url: string): string => {\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const buffer = Buffer.from(base64, \"base64\");\n return buffer.toString(\"utf-8\");\n};\n\nexport const populateValuesFromServiceUrl = (): { region: string; accountId: string } | null => {\n // Service URL format: wss://<region>.api.playwright.microsoft.com/accounts/<workspace-id>/browsers\n const url = process.env[\"PLAYWRIGHT_SERVICE_URL\"]!;\n if (!ReporterUtils.isNullOrEmpty(url)) {\n const parts = url.split(\"/\");\n\n if (parts.length > 2) {\n const subdomainParts = parts[2]!.split(\".\");\n const region = subdomainParts.length > 0 ? subdomainParts[0] : null;\n const accountId = parts[4];\n\n return { region: region!, accountId: accountId! };\n }\n }\n return null;\n};\nexport const parseJwt = <T = JwtPayload>(token: string): T => {\n const parts = token.split(\".\");\n if (parts.length !== 3) {\n throw new Error(\"Invalid JWT token.\");\n }\n const payload = base64UrlDecode(parts[1]!);\n return JSON.parse(payload) as T;\n};\n\nexport const getAccessToken = (): string | undefined => {\n return process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN];\n};\n\nexport const getServiceBaseURL = (): string | undefined => {\n return process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_URL];\n};\n\nexport const getAndSetRunId = (): string => {\n const runId = ReporterUtils.getRunId(CIInfoProvider.getCIInfo());\n process.env[InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = runId;\n return runId;\n};\n\nexport const getServiceWSEndpoint = (runId: string, os: string): string => {\n return `${getServiceBaseURL()}?runId=${runId}&os=${os}&api-version=${API_VERSION}`;\n};\n\nexport const validateServiceUrl = (): void => {\n const serviceUrl = getServiceBaseURL();\n if (!serviceUrl) {\n exitWithFailureMessage(ServiceErrorMessageConstants.NO_SERVICE_URL_ERROR);\n }\n};\n\nexport const validateMptPAT = (\n validationFailureCallback: (error: { key: string; message: string }) => void,\n): void => {\n try {\n const accessToken = getAccessToken();\n const result = populateValuesFromServiceUrl();\n if (!accessToken) {\n validationFailureCallback(ServiceErrorMessageConstants.NO_AUTH_ERROR);\n }\n const claims = parseJwt<JwtPayload>(accessToken!);\n if (!claims.exp) {\n validationFailureCallback(ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);\n }\n if (Date.now() >= claims.exp! * 1000) {\n validationFailureCallback(ServiceErrorMessageConstants.EXPIRED_MPT_PAT_ERROR);\n }\n if (result!.accountId !== claims!.aid) {\n validationFailureCallback(ServiceErrorMessageConstants.WORKSPACE_MISMATCH_ERROR);\n }\n } catch (err) {\n coreLogger.error(err);\n exitWithFailureMessage(ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);\n }\n};\n\nexport const fetchOrValidateAccessToken = async (credential?: TokenCredential): Promise<string> => {\n const entraIdAccessToken = new EntraIdAccessToken(credential);\n if (entraIdAccessToken.token && entraIdAccessToken.doesEntraIdAccessTokenNeedRotation()) {\n await entraIdAccessToken.fetchEntraIdAccessToken();\n }\n if (!getAccessToken()) {\n throw new Error(ServiceErrorMessageConstants.NO_AUTH_ERROR.message);\n }\n return getAccessToken()!;\n};\n\nexport const emitReportingUrl = (): void => {\n const regex =\n /wss:\\/\\/([\\w-]+)\\.api\\.(playwright(?:-test|-int)?\\.io|playwright\\.microsoft\\.com)\\//;\n const url = getServiceBaseURL();\n const match = url?.match(regex);\n if (match && match.length >= 3) {\n const [, region, domain] = match;\n process.env[ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_REPORTING_URL] =\n `https://${region}.reporting.api.${domain}`;\n }\n};\n\nexport const getPlaywrightVersion = (): string => {\n if (process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]) {\n return process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]!;\n }\n\n const packageManager = getPackageManager();\n const command = packageManager.runCommand(\"playwright\", \"--version\");\n const stdout = execSync(command).toString().trim();\n const version = packageManager.getVersionFromStdout(stdout);\n process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION] = version;\n coreLogger.info(\n `Playwright version being used - ${process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]}`,\n );\n return process.env[InternalEnvironmentVariables.MPT_PLAYWRIGHT_VERSION]!;\n};\n\nexport const getVersionInfo = (version: string): VersionInfo => {\n const regex = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?/;\n const match = version.match(regex);\n const versionInfo = {\n major: 0,\n minor: 0,\n patch: 0,\n };\n versionInfo.major = match && match[1] ? parseInt(match[1], 10) : 0;\n versionInfo.minor = match && match[2] ? parseInt(match[2], 10) : 0;\n versionInfo.patch = match && match[3] ? parseInt(match[3], 10) : 0;\n return versionInfo;\n};\n\nexport const validatePlaywrightVersion = (): void => {\n const minimumSupportedVersion = MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION;\n const installedVersion = getPlaywrightVersion();\n\n const minimumSupportedVersionInfo = getVersionInfo(minimumSupportedVersion);\n const installedVersionInfo = getVersionInfo(installedVersion);\n const isInstalledVersionGreater =\n installedVersionInfo.major > minimumSupportedVersionInfo.major ||\n (installedVersionInfo.major === minimumSupportedVersionInfo.major &&\n installedVersionInfo.minor >= minimumSupportedVersionInfo.minor);\n if (!isInstalledVersionGreater) {\n exitWithFailureMessage(ServiceErrorMessageConstants.INVALID_PLAYWRIGHT_VERSION_ERROR);\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/microsoft-playwright-testing",
3
- "version": "1.0.0-alpha.20241015.1",
3
+ "version": "1.0.0-alpha.20241016.2",
4
4
  "description": "Package to integrate your Playwright test suite with Microsoft Playwright Testing service",
5
5
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/microsoft-playwright-testing/README.md",
6
6
  "sdk-type": "client",
@@ -333,7 +333,6 @@ export declare const ServiceAuth: {
333
333
  */
334
334
  export declare const ServiceEnvironmentVariable: {
335
335
  PLAYWRIGHT_SERVICE_OS: string;
336
- PLAYWRIGHT_SERVICE_RUN_ID: string;
337
336
  PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string;
338
337
  PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string;
339
338
  PLAYWRIGHT_SERVICE_URL: string;