@azure/microsoft-playwright-testing 1.0.0-alpha.20240911.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.
Files changed (127) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +151 -0
  4. package/dist/common/constants.d.ts +92 -0
  5. package/dist/common/constants.d.ts.map +1 -0
  6. package/dist/common/constants.js +222 -0
  7. package/dist/common/constants.js.map +1 -0
  8. package/dist/common/customerConfig.d.ts +9 -0
  9. package/dist/common/customerConfig.d.ts.map +1 -0
  10. package/dist/common/customerConfig.js +15 -0
  11. package/dist/common/customerConfig.js.map +1 -0
  12. package/dist/common/entraIdAccessToken.d.ts +12 -0
  13. package/dist/common/entraIdAccessToken.d.ts.map +1 -0
  14. package/dist/common/entraIdAccessToken.js +72 -0
  15. package/dist/common/entraIdAccessToken.js.map +1 -0
  16. package/dist/common/environmentVariables.d.ts +12 -0
  17. package/dist/common/environmentVariables.d.ts.map +1 -0
  18. package/dist/common/environmentVariables.js +17 -0
  19. package/dist/common/environmentVariables.js.map +1 -0
  20. package/dist/common/executor.d.ts +2 -0
  21. package/dist/common/executor.d.ts.map +1 -0
  22. package/dist/common/executor.js +79 -0
  23. package/dist/common/executor.js.map +1 -0
  24. package/dist/common/httpService.d.ts +5 -0
  25. package/dist/common/httpService.d.ts.map +1 -0
  26. package/dist/common/httpService.js +37 -0
  27. package/dist/common/httpService.js.map +1 -0
  28. package/dist/common/logger.d.ts +3 -0
  29. package/dist/common/logger.d.ts.map +1 -0
  30. package/dist/common/logger.js +9 -0
  31. package/dist/common/logger.js.map +1 -0
  32. package/dist/common/messages.d.ts +9 -0
  33. package/dist/common/messages.d.ts.map +1 -0
  34. package/dist/common/messages.js +14 -0
  35. package/dist/common/messages.js.map +1 -0
  36. package/dist/common/multimap.d.ts +16 -0
  37. package/dist/common/multimap.d.ts.map +1 -0
  38. package/dist/common/multimap.js +64 -0
  39. package/dist/common/multimap.js.map +1 -0
  40. package/dist/common/playwrightServiceConfig.d.ts +12 -0
  41. package/dist/common/playwrightServiceConfig.d.ts.map +1 -0
  42. package/dist/common/playwrightServiceConfig.js +39 -0
  43. package/dist/common/playwrightServiceConfig.js.map +1 -0
  44. package/dist/common/types.d.ts +301 -0
  45. package/dist/common/types.d.ts.map +1 -0
  46. package/dist/common/types.js +5 -0
  47. package/dist/common/types.js.map +1 -0
  48. package/dist/core/global/playwright-service-global-setup.d.ts +4 -0
  49. package/dist/core/global/playwright-service-global-setup.d.ts.map +1 -0
  50. package/dist/core/global/playwright-service-global-setup.js +19 -0
  51. package/dist/core/global/playwright-service-global-setup.js.map +1 -0
  52. package/dist/core/global/playwright-service-global-teardown.d.ts +4 -0
  53. package/dist/core/global/playwright-service-global-teardown.d.ts.map +1 -0
  54. package/dist/core/global/playwright-service-global-teardown.js +19 -0
  55. package/dist/core/global/playwright-service-global-teardown.js.map +1 -0
  56. package/dist/core/playwrightService.d.ts +63 -0
  57. package/dist/core/playwrightService.d.ts.map +1 -0
  58. package/dist/core/playwrightService.js +131 -0
  59. package/dist/core/playwrightService.js.map +1 -0
  60. package/dist/core/playwrightServiceEntra.d.ts +16 -0
  61. package/dist/core/playwrightServiceEntra.d.ts.map +1 -0
  62. package/dist/core/playwrightServiceEntra.js +51 -0
  63. package/dist/core/playwrightServiceEntra.js.map +1 -0
  64. package/dist/index.d.ts +10 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +19 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/model/entraTokenDetails.d.ts +5 -0
  69. package/dist/model/entraTokenDetails.d.ts.map +1 -0
  70. package/dist/model/entraTokenDetails.js +9 -0
  71. package/dist/model/entraTokenDetails.js.map +1 -0
  72. package/dist/model/mptTokenDetails.d.ts +11 -0
  73. package/dist/model/mptTokenDetails.d.ts.map +1 -0
  74. package/dist/model/mptTokenDetails.js +14 -0
  75. package/dist/model/mptTokenDetails.js.map +1 -0
  76. package/dist/model/shard.d.ts +41 -0
  77. package/dist/model/shard.d.ts.map +1 -0
  78. package/dist/model/shard.js +24 -0
  79. package/dist/model/shard.js.map +1 -0
  80. package/dist/model/storageUri.d.ts +14 -0
  81. package/dist/model/storageUri.d.ts.map +1 -0
  82. package/dist/model/storageUri.js +22 -0
  83. package/dist/model/storageUri.js.map +1 -0
  84. package/dist/model/testResult.d.ts +40 -0
  85. package/dist/model/testResult.d.ts.map +1 -0
  86. package/dist/model/testResult.js +9 -0
  87. package/dist/model/testResult.js.map +1 -0
  88. package/dist/model/testRun.d.ts +36 -0
  89. package/dist/model/testRun.d.ts.map +1 -0
  90. package/dist/model/testRun.js +12 -0
  91. package/dist/model/testRun.js.map +1 -0
  92. package/dist/reporter/index.d.ts +10 -0
  93. package/dist/reporter/index.d.ts.map +1 -0
  94. package/dist/reporter/index.js +15 -0
  95. package/dist/reporter/index.js.map +1 -0
  96. package/dist/reporter/mptReporter.d.ts +96 -0
  97. package/dist/reporter/mptReporter.d.ts.map +1 -0
  98. package/dist/reporter/mptReporter.js +350 -0
  99. package/dist/reporter/mptReporter.js.map +1 -0
  100. package/dist/tsdoc-metadata.json +11 -0
  101. package/dist/utils/cIInfoProvider.d.ts +25 -0
  102. package/dist/utils/cIInfoProvider.d.ts.map +1 -0
  103. package/dist/utils/cIInfoProvider.js +107 -0
  104. package/dist/utils/cIInfoProvider.js.map +1 -0
  105. package/dist/utils/packageManager.d.ts +15 -0
  106. package/dist/utils/packageManager.d.ts.map +1 -0
  107. package/dist/utils/packageManager.js +54 -0
  108. package/dist/utils/packageManager.js.map +1 -0
  109. package/dist/utils/reporterUtils.d.ts +57 -0
  110. package/dist/utils/reporterUtils.d.ts.map +1 -0
  111. package/dist/utils/reporterUtils.js +547 -0
  112. package/dist/utils/reporterUtils.js.map +1 -0
  113. package/dist/utils/serviceClient.d.ts +23 -0
  114. package/dist/utils/serviceClient.d.ts.map +1 -0
  115. package/dist/utils/serviceClient.js +91 -0
  116. package/dist/utils/serviceClient.js.map +1 -0
  117. package/dist/utils/storageClient.d.ts +6 -0
  118. package/dist/utils/storageClient.d.ts.map +1 -0
  119. package/dist/utils/storageClient.js +41 -0
  120. package/dist/utils/storageClient.js.map +1 -0
  121. package/dist/utils/utils.d.ts +17 -0
  122. package/dist/utils/utils.d.ts.map +1 -0
  123. package/dist/utils/utils.js +143 -0
  124. package/dist/utils/utils.js.map +1 -0
  125. package/package.json +104 -0
  126. package/types/microsoft-playwright-testing.d.ts +352 -0
  127. package/types/reporter/microsoft-playwright-testing.d.ts +146 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Release History
2
+
3
+ ## 1.0.0-beta.2 (2024-09-12)
4
+
5
+ This release updates the Microsoft Playwright Testing library documentation and improves error messages.
6
+
7
+ ### Bugs Fixed
8
+
9
+ - Improved handling of Entra ID token expiry so that test runs don't fail intermittently.
10
+ - Optimized retries if reporting API fails with 5xx error
11
+
12
+ ## 1.0.0-beta.1 (2024-09-09)
13
+
14
+ ### Features Added
15
+
16
+ - Added authentication using Entra ID for the service.
17
+ - Added reporting capabilities for the service. You can now publish the reports and artifacts generated by Playwright OSS to the service.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # Microsoft Playwright Testing preview
2
+
3
+ Microsoft Playwright Testing is a fully managed Azure service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality. The service also enables you to publish test results and related artifacts to the service and view them in the service portal enabling faster and easier troubleshooting. With Microsoft Playwright Testing service, you can release features faster and more confidently.
4
+
5
+ Ready to get started? Jump into our [quickstart guide](#get-started)!
6
+
7
+
8
+ ## Useful Links
9
+ - [Quickstart: Run end-to-end tests at scale](https://aka.ms/mpt/quickstart)
10
+ - [Quickstart: Set up continuous end-to-end testing across different browsers and operating systems](https://aka.ms/mpt/ci)
11
+ - [Explore features and benefits](https://aka.ms/mpt/about)
12
+ - [Documentation](https://aka.ms/mpt/docs)
13
+ - [Pricing](https://aka.ms/mpt/pricing)
14
+ - [Share feedback](https://aka.ms/mpt/feedback)
15
+
16
+ ## Get Started
17
+ Follow these steps to run your existing Playwright test suite with the service.
18
+
19
+ ### Prerequisites
20
+
21
+ - An Azure account with an active subscription. If you don't have an Azure subscription, [create a free account](https://aka.ms/mpt/create-azure-subscription) before you begin.
22
+ - Your Azure account must be assigned the [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner), [Contributor](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#contributor), or one of the [classic administrator roles](https://learn.microsoft.com/azure/role-based-access-control/rbac-and-directory-admin-roles#classic-subscription-administrator-roles).
23
+ - [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) must be installed in the machine from where you are running Playwright tests.
24
+
25
+ ### Create a Workspace
26
+
27
+ 1. Sign in to the [Playwright portal](https://aka.ms/mpt/portal) with your Azure account.
28
+
29
+ 1. Create the Workspace.
30
+
31
+ ![Create new workspace](https://github.com/microsoft/playwright-testing-service/assets/12104064/d571e86b-9d43-48ac-a2b7-63afb9bb86a8)
32
+
33
+ |Field |Description |
34
+ |---------|---------|
35
+ |**Workspace Name** | A unique name to identify your workspace.<BR>The name can't contain special characters or whitespace. |
36
+ |**Azure Subscription** | Select an Azure subscription where you want to create the workspace. |
37
+ |**Region** | This is where test run data will be stored for your workspace. |
38
+
39
+ > If you don't see this screen, select an existing workspace and go to the next section.
40
+
41
+ ### Install Microsoft Playwright Testing package
42
+
43
+ 1. Run this command to install the service package
44
+
45
+ ```nodejs
46
+ npm init @azure/microsoft-playwright-testing
47
+ ```
48
+
49
+ Installing the service package will create a service config file named `playwright.service.config.ts`
50
+
51
+ The service configuration serves to:
52
+
53
+ - Direct and authenticate Playwright to the Microsoft Playwright Testing service.
54
+ - Add Microsoft Playwright Testing reporting to your config.
55
+ - Override timeouts for service operations, if needed.
56
+
57
+ > Make sure your project uses @playwright/test version 1.47 or above.
58
+
59
+ ### Obtain region endpoint
60
+
61
+ 1. In the [Playwright portal](https://aka.ms/mpt/portal), copy the command under **Add region endpoint in your set up**.
62
+
63
+ ![Set workspace endpoint](https://github.com/microsoft/playwright-testing-service/assets/12104064/d81ca629-2b23-4d34-8b70-67b6f7061a83)
64
+
65
+ The endpoint URL corresponds to the workspace region. You might see a different endpoint URL in the Playwright portal, depending on the region you selected when creating the workspace.
66
+
67
+ ### Set up environment
68
+
69
+ Ensure that the `PLAYWRIGHT_SERVICE_URL` that you obtained in previous step is available in your environment.
70
+
71
+ We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.
72
+
73
+ > Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.
74
+
75
+ ```sh
76
+ npm i --save-dev dotenv
77
+ ```
78
+
79
+ `.env` file
80
+
81
+ ```nodejs
82
+ PLAYWRIGHT_SERVICE_URL=wss://eastus.api.playwright.microsoft.com/accounts/workspace-id/browsers
83
+ ```
84
+
85
+ ### Set up Authentication
86
+
87
+ To run your Playwright tests in your Microsoft Playwright Testing workspace, you need to authenticate the Playwright client where you are running the tests with the service. This could be your local dev machine or CI machine.
88
+
89
+ The service offers two authentication methods: Microsoft Entra ID and Access Tokens.
90
+
91
+ Microsoft Entra ID uses your Azure credentials, requiring a sign-in to your Azure account for secure access. Alternatively, you can generate an access token from your Playwright workspace and use it in your setup.
92
+
93
+ #### Set up authtication using Microsoft Entra ID
94
+
95
+ Microsoft Entra ID is the default and recommended authentication for the service. From your local dev machine, you can use [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) to sign-in
96
+
97
+ ```CLI
98
+ az login
99
+ ```
100
+
101
+ **NOTE**: If you are a part of multiple Microsoft Entra tenants, make sure you sign-in to the tenant where your workspace belongs. You can get the tenant id from Azure portal, see [Find your Microsoft Entra Tenant](https://learn.microsoft.com/azure/azure-portal/get-subscription-tenant-id#find-your-microsoft-entra-tenant). Once you get the ID, sign-in using the command `az login --tenant <TenantID>`
102
+
103
+ #### Set up authentication using access tokens
104
+
105
+ You can generate an access token from your Playwright Testing workspace and use it in your setup. However, we strongly recommend Microsoft Entra ID for authentication due to its enhanced security. Access tokens, while convenient, function like long-lived passwords and are more susceptible to being compromised.
106
+
107
+ 1. To use access token based authentication, [Enable access-token based authentication](https://aka.ms/mpt/authentication)
108
+
109
+ 2. [Set up authentication using access tokens](https://aka.ms/mpt/access-token)
110
+
111
+ > We strongly recommend using Microsoft Entra ID for authentication to the service. If you are using access tokens, see [How to Manage Access Tokens](https://aka.ms/mpt/access-token)
112
+
113
+ *NOTE:* To use Microsoft Playwright Testing in CI pipelines, you need to configure authentication with the service from pipeline, see [set up continuous end-to-end testing across different browsers and operating systems](https://aka.ms/mpt/ci)
114
+
115
+ ### Run the tests
116
+
117
+ Run Playwright tests against browsers managed by the service using the configuration you created above.
118
+
119
+ ```nodejs
120
+ npx playwright test --config=playwright.service.config.ts --workers=20
121
+ ```
122
+
123
+ ## Next steps
124
+
125
+ - Run tests in a [CI/CD pipeline.](https://aka.ms/mpt/configure-pipeline)
126
+
127
+ - Learn how to [manage access](https://aka.ms/mpt/manage-access) to the created workspace.
128
+
129
+ - Experiment with different number of workers to [determine the optimal configuration of your test suite](https://aka.ms/mpt/parallelism).
130
+
131
+ ## Contributing
132
+
133
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
134
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
135
+ the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
136
+
137
+ When you submit a pull request, a CLA bot will automatically determine whether you need to provide
138
+ a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
139
+ provided by the bot. You will only need to do this once across all repos using our CLA.
140
+
141
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
142
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
143
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
144
+
145
+ ## Trademarks
146
+
147
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
148
+ trademarks or logos is subject to and must follow
149
+ [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).
150
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
151
+ Any use of third-party trademarks or logos is subject to those third-party's policies.
@@ -0,0 +1,92 @@
1
+ import { ApiErrorMessage } from "./types";
2
+ export declare const EntraIdAccessTokenConstants: {
3
+ LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: number;
4
+ SCOPE: string;
5
+ ROTATION_INTERVAL_PERIOD_IN_MINUTES: number;
6
+ };
7
+ /** @public
8
+ *
9
+ * OS types supported on Microsoft Playwright Testing cloud hosted browsers
10
+ */
11
+ export declare const ServiceOS: {
12
+ readonly LINUX: "linux";
13
+ readonly WINDOWS: "windows";
14
+ };
15
+ /** @public
16
+ *
17
+ * Authentication types supported on Microsoft Playwright Testing
18
+ */
19
+ export declare const ServiceAuth: {
20
+ readonly ENTRA_ID: "ENTRA_ID";
21
+ readonly ACCESS_TOKEN: "ACCESS_TOKEN";
22
+ };
23
+ /** @public
24
+ *
25
+ * Environment variables used by Microsoft Playwright Testing
26
+ */
27
+ export declare const ServiceEnvironmentVariable: {
28
+ PLAYWRIGHT_SERVICE_OS: string;
29
+ PLAYWRIGHT_SERVICE_RUN_ID: string;
30
+ PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string;
31
+ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string;
32
+ PLAYWRIGHT_SERVICE_URL: string;
33
+ PLAYWRIGHT_SERVICE_REPORTING_URL: string;
34
+ };
35
+ export declare const DefaultConnectOptionsConstants: {
36
+ DEFAULT_TIMEOUT: number;
37
+ DEFAULT_SLOW_MO: number;
38
+ DEFAULT_EXPOSE_NETWORK: string;
39
+ DEFAULT_SERVICE_OS: "linux";
40
+ };
41
+ export declare const API_VERSION = "2023-10-01-preview";
42
+ export declare class Constants {
43
+ static readonly TEST_FRAMEWORK_NAME = "PLAYWRIGHT";
44
+ static readonly TEST_FRAMEWORK_RUNNERNAME = "PLAYWRIGHT";
45
+ static readonly TEST_TYPE = "WebTest";
46
+ static readonly TEST_SDK_LANGUAGE = "JAVASCRIPT";
47
+ static readonly REPORTER_PACKAGE_VERSION = "1.0.0-beta.2";
48
+ static readonly DEFAULT_DASHBOARD_ENDPOINT = "https://playwright.microsoft.com";
49
+ static readonly DEFAULT_SERVICE_ENDPOINT = "https://{region}.reporting.api.playwright-test.io";
50
+ static readonly DEFAULT_REDACTED_MESSAGE = "***REDACTED***";
51
+ static readonly SAS_URI_SEPARATOR = "?";
52
+ static readonly DEFAULT_TEST_RUN_NAME = "MPTReporterTests";
53
+ static readonly TEST_BATCH_SIZE = 50;
54
+ static readonly UPLOAD_MODE = "sdk";
55
+ static readonly GIT_VERSION_COMMAND = "git --version";
56
+ static readonly GIT_REV_PARSE = "git rev-parse --is-inside-work-tree";
57
+ static readonly GIT_COMMIT_MESSAGE_COMMAND = "git log -1 --pretty=format:\"%s\"";
58
+ static readonly ERROR_MESSAGES_MAX_LENGTH = 100;
59
+ static readonly API_VERSION = "2024-09-01-preview";
60
+ static readonly NON_RETRYABLE_STATUS_CODES: number[];
61
+ static readonly SupportedRegions: string[];
62
+ static readonly CONFLICT_409_ERROR_MESSAGE = "Test run with id {runId} already exists. Provide a unique run id.";
63
+ static readonly FORBIDDEN_403_ERROR_MESSAGE = "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";
64
+ static readonly testRunsEndpoint: string;
65
+ static readonly testRunsShardEndpoint: string;
66
+ static readonly storageUriEndpoint: string;
67
+ static readonly testResultsEndpoint: string;
68
+ static readonly patchTestRun: string;
69
+ static readonly getTestRun: string;
70
+ static readonly patchTestRunShardStart: string;
71
+ static readonly patchTestRunShardEnd: string;
72
+ static readonly postTestResults: string;
73
+ static readonly getStorageUri: string;
74
+ static readonly ERROR_MESSAGE: ApiErrorMessage;
75
+ }
76
+ export declare const TestErrorType: {
77
+ Scalable: string;
78
+ Reporting: string;
79
+ };
80
+ export declare const TestResultErrorConstants: {
81
+ key: string;
82
+ message: string;
83
+ pattern: RegExp;
84
+ type: string;
85
+ }[];
86
+ export declare const InternalEnvironmentVariables: {
87
+ MPT_PLAYWRIGHT_VERSION: string;
88
+ MPT_SETUP_FATAL_ERROR: string;
89
+ MPT_CLOUD_HOSTED_BROWSER_USED: string;
90
+ };
91
+ export declare const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = "1.47.0";
92
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AAM,CACK;IACvD,gBAAuB,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;IAE/D,gBAAuB,aAAa,EAAE,eAAe,CAsDnD;CACH;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;GAwEpC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;CAIxC,CAAC;AAEF,eAAO,MAAM,oCAAoC,WAAW,CAAC"}
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = exports.InternalEnvironmentVariables = exports.TestResultErrorConstants = exports.TestErrorType = exports.Constants = exports.API_VERSION = exports.DefaultConnectOptionsConstants = exports.ServiceEnvironmentVariable = exports.ServiceAuth = exports.ServiceOS = exports.EntraIdAccessTokenConstants = void 0;
4
+ exports.EntraIdAccessTokenConstants = {
5
+ LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,
6
+ SCOPE: "https://management.core.windows.net/.default",
7
+ ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,
8
+ };
9
+ /** @public
10
+ *
11
+ * OS types supported on Microsoft Playwright Testing cloud hosted browsers
12
+ */
13
+ exports.ServiceOS = {
14
+ LINUX: "linux",
15
+ WINDOWS: "windows",
16
+ };
17
+ /** @public
18
+ *
19
+ * Authentication types supported on Microsoft Playwright Testing
20
+ */
21
+ exports.ServiceAuth = {
22
+ ENTRA_ID: "ENTRA_ID",
23
+ ACCESS_TOKEN: "ACCESS_TOKEN",
24
+ };
25
+ /** @public
26
+ *
27
+ * Environment variables used by Microsoft Playwright Testing
28
+ */
29
+ exports.ServiceEnvironmentVariable = {
30
+ PLAYWRIGHT_SERVICE_OS: "PLAYWRIGHT_SERVICE_OS",
31
+ PLAYWRIGHT_SERVICE_RUN_ID: "PLAYWRIGHT_SERVICE_RUN_ID",
32
+ PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: "PLAYWRIGHT_SERVICE_EXPOSE_NETWORK",
33
+ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: "PLAYWRIGHT_SERVICE_ACCESS_TOKEN",
34
+ PLAYWRIGHT_SERVICE_URL: "PLAYWRIGHT_SERVICE_URL",
35
+ PLAYWRIGHT_SERVICE_REPORTING_URL: "PLAYWRIGHT_SERVICE_REPORTING_URL",
36
+ };
37
+ exports.DefaultConnectOptionsConstants = {
38
+ DEFAULT_TIMEOUT: 30000,
39
+ DEFAULT_SLOW_MO: 0,
40
+ DEFAULT_EXPOSE_NETWORK: "<loopback>",
41
+ DEFAULT_SERVICE_OS: exports.ServiceOS.LINUX,
42
+ };
43
+ exports.API_VERSION = "2023-10-01-preview";
44
+ // Do not put an ending slash for the urls,
45
+ // for example use https://www.microsoft.com/en-in and not https://www.microsoft.com/en-in/
46
+ class Constants {
47
+ }
48
+ exports.Constants = Constants;
49
+ // Config related constants
50
+ Constants.TEST_FRAMEWORK_NAME = "PLAYWRIGHT";
51
+ Constants.TEST_FRAMEWORK_RUNNERNAME = "PLAYWRIGHT";
52
+ Constants.TEST_TYPE = "WebTest";
53
+ Constants.TEST_SDK_LANGUAGE = "JAVASCRIPT";
54
+ // Placeholder version
55
+ Constants.REPORTER_PACKAGE_VERSION = "1.0.0-beta.2";
56
+ Constants.DEFAULT_DASHBOARD_ENDPOINT = "https://playwright.microsoft.com";
57
+ Constants.DEFAULT_SERVICE_ENDPOINT = "https://{region}.reporting.api.playwright-test.io";
58
+ Constants.DEFAULT_REDACTED_MESSAGE = "***REDACTED***";
59
+ Constants.SAS_URI_SEPARATOR = "?";
60
+ Constants.DEFAULT_TEST_RUN_NAME = "MPTReporterTests";
61
+ Constants.TEST_BATCH_SIZE = 50;
62
+ Constants.UPLOAD_MODE = "sdk";
63
+ Constants.GIT_VERSION_COMMAND = "git --version";
64
+ Constants.GIT_REV_PARSE = "git rev-parse --is-inside-work-tree";
65
+ Constants.GIT_COMMIT_MESSAGE_COMMAND = 'git log -1 --pretty=format:"%s"';
66
+ Constants.ERROR_MESSAGES_MAX_LENGTH = 100;
67
+ Constants.API_VERSION = "2024-09-01-preview";
68
+ Constants.NON_RETRYABLE_STATUS_CODES = [400, 403, 404, 405, 409];
69
+ Constants.SupportedRegions = [
70
+ "eastus",
71
+ "eastasia",
72
+ "westeurope",
73
+ "westus3",
74
+ "centraluseuap",
75
+ "eastus2euap",
76
+ ];
77
+ // Error messages
78
+ Constants.CONFLICT_409_ERROR_MESSAGE = "Test run with id {runId} already exists. Provide a unique run id.";
79
+ Constants.FORBIDDEN_403_ERROR_MESSAGE = "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";
80
+ // API Endpoints
81
+ Constants.testRunsEndpoint = "workspaces/{workspaceId}/test-runs";
82
+ Constants.testRunsShardEndpoint = "workspaces/{workspaceId}/test-runs/{testRunId}:updateShardExecutionStatus";
83
+ Constants.storageUriEndpoint = "workspaces/{workspaceId}/test-runs/{testRunId}:createArtifactsUploadBaseUri";
84
+ Constants.testResultsEndpoint = "workspaces/{workspaceId}/test-results/upload-batch";
85
+ Constants.patchTestRun = "patchTestRun";
86
+ Constants.getTestRun = "getTestRun";
87
+ Constants.patchTestRunShardStart = "patchTestRunShardStart";
88
+ Constants.patchTestRunShardEnd = "patchTestRunShardEnd";
89
+ Constants.postTestResults = "postTestResults";
90
+ Constants.getStorageUri = "getStorageUri";
91
+ Constants.ERROR_MESSAGE = {
92
+ patchTestRun: {
93
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
94
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
95
+ 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.",
96
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
97
+ 504: "The request to the service timed out. Please try again later.",
98
+ 503: "The service is currently unavailable. Please check the service status and try again.",
99
+ },
100
+ getTestRun: {
101
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
102
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
103
+ 403: "You do not have the required permissions to run tests. Please contact your workspace administrator.",
104
+ 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.",
105
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
106
+ 504: "The request to the service timed out. Please try again later.",
107
+ 503: "The service is currently unavailable. Please check the service status and try again.",
108
+ },
109
+ patchTestRunShardStart: {
110
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
111
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
112
+ 403: "You do not have the required permissions to run tests. Please contact your workspace administrator.",
113
+ 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.",
114
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
115
+ 504: "The request to the service timed out. Please try again later.",
116
+ 503: "The service is currently unavailable. Please check the service status and try again.",
117
+ },
118
+ patchTestRunShardEnd: {
119
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
120
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
121
+ 403: "You do not have the required permissions to run tests. Please contact your workspace administrator.",
122
+ 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.",
123
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
124
+ 504: "The request to the service timed out. Please try again later.",
125
+ 503: "The service is currently unavailable. Please check the service status and try again.",
126
+ },
127
+ postTestResults: {
128
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
129
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
130
+ 403: "You do not have the required permissions to run tests. Please contact your workspace administrator.",
131
+ 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.",
132
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
133
+ 504: "The request to the service timed out. Please try again later.",
134
+ 503: "The service is currently unavailable. Please check the service status and try again.",
135
+ },
136
+ getStorageUri: {
137
+ 400: "The request made to the server is invalid. Please check the request parameters and try again.",
138
+ 401: "The authentication token provided is invalid. Please check the token and try again.",
139
+ 403: "You do not have the required permissions to run tests. Please contact your workspace administrator.",
140
+ 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.",
141
+ 429: "You have exceeded the rate limit for the API. Please wait and try again later.",
142
+ 504: "The request to the service timed out. Please try again later.",
143
+ 503: "The service is currently unavailable. Please check the service status and try again.",
144
+ },
145
+ };
146
+ exports.TestErrorType = {
147
+ Scalable: "Scalable",
148
+ Reporting: "Reporting",
149
+ };
150
+ exports.TestResultErrorConstants = [
151
+ {
152
+ key: "Unauthorized_Scalable",
153
+ message: "The authentication token provided is invalid. Please check the token and try again.",
154
+ pattern: /(?=.*browserType\.connect)(?=.*401 Unauthorized)/i,
155
+ type: exports.TestErrorType.Scalable,
156
+ },
157
+ {
158
+ key: "NoPermissionOnWorkspace_Scalable",
159
+ message: `You do not have the required permissions to run tests. This could be because:
160
+
161
+ a. You do not have the required roles on the workspace. Only Owner and Contributor roles can run tests. Contact the service administrator.
162
+ 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>'.
163
+ `,
164
+ pattern: /(?=.*browserType\.connect)(?=.*403 Forbidden)(?=[\s\S]*CheckAccess API call with non successful response)/i,
165
+ type: exports.TestErrorType.Scalable,
166
+ },
167
+ {
168
+ key: "InvalidWorkspace_Scalable",
169
+ message: "The specified workspace does not exist. Please verify your workspace settings.",
170
+ pattern: /(?=.*browserType\.connect)(?=.*403 Forbidden)(?=[\s\S]*InvalidAccountOrSubscriptionState)/i,
171
+ type: exports.TestErrorType.Scalable,
172
+ },
173
+ {
174
+ key: "InvalidAccessToken_Scalable",
175
+ message: "The provided access token does not match the specified workspace URL. Please verify that both values are correct.",
176
+ pattern: /(?=.*browserType\.connect)(?=.*403 Forbidden)(?=[\s\S]*InvalidAccessToken)/i,
177
+ type: exports.TestErrorType.Scalable,
178
+ },
179
+ {
180
+ key: "AccessTokenOrUserOrWorkspaceNotFound_Scalable",
181
+ message: "The data for the user, workspace or access token was not found. Please check the request or create new token and try again.",
182
+ pattern: /(?=.*browserType\.connect)(?=.*404 Not Found)(?=[\s\S]*NotFound)/i,
183
+ type: exports.TestErrorType.Scalable,
184
+ },
185
+ {
186
+ key: "AccessKeyBasedAuthNotSupported_Scalable",
187
+ message: "Authentication through service access token is disabled for this workspace. Please use Entra ID to authenticate.",
188
+ pattern: /(?=.*browserType\.connect)(?=.*403 Forbidden)(?=[\s\S]*AccessKeyBasedAuthNotSupported)/i,
189
+ type: exports.TestErrorType.Scalable,
190
+ },
191
+ {
192
+ key: "ServiceUnavailable_Scalable",
193
+ message: "The service is currently unavailable. Please check the service status and try again.",
194
+ pattern: /(?=.*browserType\.connect)(?=.*503 Service Unavailable)/i,
195
+ type: exports.TestErrorType.Scalable,
196
+ },
197
+ {
198
+ key: "GatewayTimeout_Scalable",
199
+ message: "The request to the service timed out. Please try again later.",
200
+ pattern: /(?=.*browserType\.connect)(?=.*504 Gateway Timeout)/i,
201
+ type: exports.TestErrorType.Scalable,
202
+ },
203
+ {
204
+ key: "QuotaLimitError_Scalable",
205
+ message: "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.",
206
+ pattern: /browserType.connect: Timeout .* exceeded/i,
207
+ type: exports.TestErrorType.Scalable,
208
+ },
209
+ {
210
+ key: "BrowserConnectionError_Scalable",
211
+ message: "The service is currently unavailable. Please try again after some time.",
212
+ pattern: /browserType.connect: Target page, context or browser has been closed/i,
213
+ type: exports.TestErrorType.Scalable,
214
+ },
215
+ ];
216
+ exports.InternalEnvironmentVariables = {
217
+ MPT_PLAYWRIGHT_VERSION: "_MPT_PLAYWRIGHT_VERSION",
218
+ MPT_SETUP_FATAL_ERROR: "_MPT_SETUP_FATAL_ERROR",
219
+ MPT_CLOUD_HOSTED_BROWSER_USED: "_MPT_CLOUD_HOSTED_BROWSER_USED",
220
+ };
221
+ exports.MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = "1.47.0";
222
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
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,yBAAyB,EAAE,2BAA2B;IACtD,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,EAAE,iBAAS,CAAC,KAAK;CACpC,CAAC;AAEW,QAAA,WAAW,GAAG,oBAAoB,CAAC;AAEhD,2CAA2C;AA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Q;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,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_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.2\";\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\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: \"Unauthorized_Scalable\",\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_Scalable\",\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: \"ServiceUnavailable_Scalable\",\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: \"GatewayTimeout_Scalable\",\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"]}
@@ -0,0 +1,9 @@
1
+ declare class CustomerConfig {
2
+ private static instance;
3
+ globalSetup?: string;
4
+ globalTeardown?: string;
5
+ static getInstance(): CustomerConfig;
6
+ }
7
+ declare const customerConfig: CustomerConfig;
8
+ export default customerConfig;
9
+ //# sourceMappingURL=customerConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customerConfig.d.ts","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":"AAGA,cAAM,cAAc;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;WAEjB,WAAW,IAAI,cAAc;CAM5C;AAED,QAAA,MAAM,cAAc,gBAA+B,CAAC;AACpD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ class CustomerConfig {
6
+ static getInstance() {
7
+ if (!CustomerConfig.instance) {
8
+ CustomerConfig.instance = new CustomerConfig();
9
+ }
10
+ return CustomerConfig.instance;
11
+ }
12
+ }
13
+ const customerConfig = CustomerConfig.getInstance();
14
+ exports.default = customerConfig;
15
+ //# sourceMappingURL=customerConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customerConfig.js","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,MAAM,cAAc;IAKX,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IACjC,CAAC;CACF;AAED,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AACpD,kBAAe,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nclass CustomerConfig {\n private static instance: CustomerConfig;\n public globalSetup?: string;\n public globalTeardown?: string;\n\n public static getInstance(): CustomerConfig {\n if (!CustomerConfig.instance) {\n CustomerConfig.instance = new CustomerConfig();\n }\n return CustomerConfig.instance;\n }\n}\n\nconst customerConfig = CustomerConfig.getInstance();\nexport default customerConfig;\n"]}
@@ -0,0 +1,12 @@
1
+ import { TokenCredential } from "@azure/identity";
2
+ declare class EntraIdAccessToken {
3
+ token?: string;
4
+ private _expiryTimestamp?;
5
+ private _credential?;
6
+ constructor(credential?: TokenCredential);
7
+ fetchEntraIdAccessToken: () => Promise<void>;
8
+ doesEntraIdAccessTokenNeedRotation(): boolean;
9
+ private setEntraIdAccessTokenFromEnvironment;
10
+ }
11
+ export { EntraIdAccessToken };
12
+ //# sourceMappingURL=entraIdAccessToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entraIdAccessToken.d.ts","sourceRoot":"","sources":["../../src/common/entraIdAccessToken.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAW1E,cAAM,kBAAkB;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,WAAW,CAAC,CAAkB;gBAE1B,UAAU,CAAC,EAAE,eAAe;IAKjC,uBAAuB,QAAa,OAAO,CAAC,IAAI,CAAC,CA0BtD;IAEK,kCAAkC,IAAI,OAAO;IAgBpD,OAAO,CAAC,oCAAoC,CAgB1C;CACH;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}