@azure/playwright 1.0.1-alpha.20251226.2 → 1.0.1-alpha.20251231.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.
- package/dist/browser/common/constants.d.ts +1 -0
- package/dist/browser/common/constants.d.ts.map +1 -1
- package/dist/browser/common/constants.js +1 -0
- package/dist/browser/common/constants.js.map +1 -1
- package/dist/browser/common/messages.d.ts +14 -0
- package/dist/browser/common/messages.d.ts.map +1 -1
- package/dist/browser/common/messages.js +18 -4
- package/dist/browser/common/messages.js.map +1 -1
- package/dist/browser/core/initializePlaywrightServiceTestRun.d.ts.map +1 -1
- package/dist/browser/core/initializePlaywrightServiceTestRun.js +4 -5
- package/dist/browser/core/initializePlaywrightServiceTestRun.js.map +1 -1
- package/dist/browser/reporter/playwrightReporter.d.ts.map +1 -1
- package/dist/browser/reporter/playwrightReporter.js +37 -14
- package/dist/browser/reporter/playwrightReporter.js.map +1 -1
- package/dist/browser/utils/PlaywrightServiceClient.d.ts +9 -0
- package/dist/browser/utils/PlaywrightServiceClient.d.ts.map +1 -0
- package/dist/{esm/utils/playwrightServiceApicall.js → browser/utils/PlaywrightServiceClient.js} +13 -17
- package/dist/browser/utils/PlaywrightServiceClient.js.map +1 -0
- package/dist/browser/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/browser/utils/playwrightReporterStorageManager.js +15 -8
- package/dist/browser/utils/playwrightReporterStorageManager.js.map +1 -1
- package/dist/commonjs/common/constants.d.ts +1 -0
- package/dist/commonjs/common/constants.d.ts.map +1 -1
- package/dist/commonjs/common/constants.js +1 -0
- package/dist/commonjs/common/constants.js.map +1 -1
- package/dist/commonjs/common/messages.d.ts +14 -0
- package/dist/commonjs/common/messages.d.ts.map +1 -1
- package/dist/commonjs/common/messages.js +18 -4
- package/dist/commonjs/common/messages.js.map +1 -1
- package/dist/commonjs/core/initializePlaywrightServiceTestRun.d.ts.map +1 -1
- package/dist/commonjs/core/initializePlaywrightServiceTestRun.js +4 -5
- package/dist/commonjs/core/initializePlaywrightServiceTestRun.js.map +1 -1
- package/dist/commonjs/reporter/playwrightReporter.d.ts.map +1 -1
- package/dist/commonjs/reporter/playwrightReporter.js +36 -13
- package/dist/commonjs/reporter/playwrightReporter.js.map +1 -1
- package/dist/commonjs/utils/PlaywrightServiceClient.d.ts +9 -0
- package/dist/commonjs/utils/PlaywrightServiceClient.d.ts.map +1 -0
- package/dist/commonjs/utils/{playwrightServiceApicall.js → PlaywrightServiceClient.js} +13 -17
- package/dist/commonjs/utils/PlaywrightServiceClient.js.map +1 -0
- package/dist/commonjs/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/commonjs/utils/playwrightReporterStorageManager.js +15 -8
- package/dist/commonjs/utils/playwrightReporterStorageManager.js.map +1 -1
- package/dist/esm/common/constants.d.ts +1 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +1 -0
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/messages.d.ts +14 -0
- package/dist/esm/common/messages.d.ts.map +1 -1
- package/dist/esm/common/messages.js +18 -4
- package/dist/esm/common/messages.js.map +1 -1
- package/dist/esm/core/initializePlaywrightServiceTestRun.d.ts.map +1 -1
- package/dist/esm/core/initializePlaywrightServiceTestRun.js +4 -5
- package/dist/esm/core/initializePlaywrightServiceTestRun.js.map +1 -1
- package/dist/esm/reporter/playwrightReporter.d.ts.map +1 -1
- package/dist/esm/reporter/playwrightReporter.js +37 -14
- package/dist/esm/reporter/playwrightReporter.js.map +1 -1
- package/dist/esm/utils/PlaywrightServiceClient.d.ts +9 -0
- package/dist/esm/utils/PlaywrightServiceClient.d.ts.map +1 -0
- package/dist/{browser/utils/playwrightServiceApicall.js → esm/utils/PlaywrightServiceClient.js} +13 -17
- package/dist/esm/utils/PlaywrightServiceClient.js.map +1 -0
- package/dist/esm/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/esm/utils/playwrightReporterStorageManager.js +15 -8
- package/dist/esm/utils/playwrightReporterStorageManager.js.map +1 -1
- package/dist/react-native/common/constants.d.ts +1 -0
- package/dist/react-native/common/constants.d.ts.map +1 -1
- package/dist/react-native/common/constants.js +1 -0
- package/dist/react-native/common/constants.js.map +1 -1
- package/dist/react-native/common/messages.d.ts +14 -0
- package/dist/react-native/common/messages.d.ts.map +1 -1
- package/dist/react-native/common/messages.js +18 -4
- package/dist/react-native/common/messages.js.map +1 -1
- package/dist/react-native/core/initializePlaywrightServiceTestRun.d.ts.map +1 -1
- package/dist/react-native/core/initializePlaywrightServiceTestRun.js +4 -5
- package/dist/react-native/core/initializePlaywrightServiceTestRun.js.map +1 -1
- package/dist/react-native/reporter/playwrightReporter.d.ts.map +1 -1
- package/dist/react-native/reporter/playwrightReporter.js +37 -14
- package/dist/react-native/reporter/playwrightReporter.js.map +1 -1
- package/dist/react-native/utils/PlaywrightServiceClient.d.ts +9 -0
- package/dist/react-native/utils/PlaywrightServiceClient.d.ts.map +1 -0
- package/dist/react-native/utils/{playwrightServiceApicall.js → PlaywrightServiceClient.js} +13 -17
- package/dist/react-native/utils/PlaywrightServiceClient.js.map +1 -0
- package/dist/react-native/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/react-native/utils/playwrightReporterStorageManager.js +15 -8
- package/dist/react-native/utils/playwrightReporterStorageManager.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/utils/playwrightServiceApicall.d.ts +0 -16
- package/dist/browser/utils/playwrightServiceApicall.d.ts.map +0 -1
- package/dist/browser/utils/playwrightServiceApicall.js.map +0 -1
- package/dist/commonjs/utils/playwrightServiceApicall.d.ts +0 -16
- package/dist/commonjs/utils/playwrightServiceApicall.d.ts.map +0 -1
- package/dist/commonjs/utils/playwrightServiceApicall.js.map +0 -1
- package/dist/esm/utils/playwrightServiceApicall.d.ts +0 -16
- package/dist/esm/utils/playwrightServiceApicall.d.ts.map +0 -1
- package/dist/esm/utils/playwrightServiceApicall.js.map +0 -1
- package/dist/react-native/utils/playwrightServiceApicall.d.ts +0 -16
- package/dist/react-native/utils/playwrightServiceApicall.d.ts.map +0 -1
- package/dist/react-native/utils/playwrightServiceApicall.js.map +0 -1
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PlaywrightServiceClient = void 0;
|
|
4
4
|
// Copyright (c) Microsoft Corporation.
|
|
5
5
|
// Licensed under the MIT License.
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
7
7
|
const messages_js_1 = require("../common/messages.js");
|
|
8
8
|
const httpService_js_1 = require("../common/httpService.js");
|
|
9
9
|
const constants_js_1 = require("../common/constants.js");
|
|
10
|
-
|
|
11
|
-
* Makes a PATCH call to the Playwright workspaces Test Run API to create or update a test run.
|
|
12
|
-
*
|
|
13
|
-
* @param payload - The request payload (displayName, config, ciConfig, etc.).
|
|
14
|
-
* @returns The parsed JSON response from the API.
|
|
15
|
-
* @throws If the API call fails (non-2xx response).
|
|
16
|
-
*/
|
|
17
|
-
class PlaywrightServiceApiCall {
|
|
10
|
+
class PlaywrightServiceClient {
|
|
18
11
|
httpService;
|
|
19
12
|
constructor(httpService) {
|
|
20
13
|
this.httpService = httpService ?? new httpService_js_1.HttpService();
|
|
21
14
|
}
|
|
22
|
-
async
|
|
15
|
+
async createOrUpdateTestRun(payload) {
|
|
23
16
|
try {
|
|
24
17
|
const baseUrl = (0, utils_js_1.getTestRunApiUrl)();
|
|
25
18
|
const token = (0, utils_js_1.getAccessToken)();
|
|
@@ -35,14 +28,17 @@ class PlaywrightServiceApiCall {
|
|
|
35
28
|
const response = await this.httpService.callAPI(method, url.toString(), data, token, contentType, correlationId);
|
|
36
29
|
if (response.status !== 200) {
|
|
37
30
|
const errorMessage = (0, utils_js_1.extractErrorMessage)(response?.bodyAsText ?? "");
|
|
38
|
-
|
|
31
|
+
process.env[constants_js_1.InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "false";
|
|
32
|
+
console.error(messages_js_1.ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(errorMessage || "Unknown error"));
|
|
33
|
+
return;
|
|
39
34
|
}
|
|
40
35
|
console.log("Test run created successfully.");
|
|
41
|
-
|
|
36
|
+
process.env[constants_js_1.InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "true";
|
|
42
37
|
}
|
|
43
38
|
catch (error) {
|
|
44
39
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred during test run creation";
|
|
45
|
-
|
|
40
|
+
process.env[constants_js_1.InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "false";
|
|
41
|
+
console.error(messages_js_1.ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(errorMessage));
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
async getWorkspaceMetadata() {
|
|
@@ -59,7 +55,7 @@ class PlaywrightServiceApiCall {
|
|
|
59
55
|
const response = await this.httpService.callAPI(method, url.toString(), null, token, "", correlationId);
|
|
60
56
|
if (response.status !== 200) {
|
|
61
57
|
const errorMessage = (0, utils_js_1.extractErrorMessage)(response?.bodyAsText ?? "");
|
|
62
|
-
throw new Error(errorMessage || `HTTP ${response.status}: Failed to retrieve workspace details`);
|
|
58
|
+
throw new Error(messages_js_1.ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.formatWithError(errorMessage || `HTTP ${response.status}: Failed to retrieve workspace details`));
|
|
63
59
|
}
|
|
64
60
|
return response.bodyAsText ? JSON.parse(response.bodyAsText) : {};
|
|
65
61
|
}
|
|
@@ -67,9 +63,9 @@ class PlaywrightServiceApiCall {
|
|
|
67
63
|
if (error instanceof Error) {
|
|
68
64
|
throw error;
|
|
69
65
|
}
|
|
70
|
-
throw new Error(
|
|
66
|
+
throw new Error(messages_js_1.ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.message);
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
|
-
exports.
|
|
75
|
-
//# sourceMappingURL=
|
|
70
|
+
exports.PlaywrightServiceClient = PlaywrightServiceClient;
|
|
71
|
+
//# sourceMappingURL=PlaywrightServiceClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaywrightServiceClient.js","sourceRoot":"","sources":["../../../src/utils/PlaywrightServiceClient.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,yCAKoB;AACpB,uDAAqE;AACrE,6DAAuD;AAEvD,yDAAiF;AAEjF,MAAa,uBAAuB;IAC1B,WAAW,CAAc;IAEjC,YAAY,WAAyB;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,4BAAW,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAA6B;QACvD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAA,2BAAgB,GAAE,CAAC;YACnC,MAAM,KAAK,GAAG,IAAA,yBAAc,GAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;YACtF,CAAC;YACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAC7B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,wBAAS,CAAC,gBAAgB,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,OAAO,CAAC;YACvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACrC,MAAM,WAAW,GAAG,8BAA8B,CAAC;YACnD,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAC7C,MAAM,EACN,GAAG,CAAC,QAAQ,EAAE,EACd,I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aAAa,EAAE,wBAAS,CAAC,gBAAgB,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,KAAK,CAAC;YACrB,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAC7C,MAAM,EACN,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,EACJ,KAAK,EACL,EAAE,EACF,aAAa,CACd,CAAC;YAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,YAAY,GAAG,IAAA,8BAAmB,EAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;gBACrE,MAAM,IAAI,KAAK,CACb,0CAA4B,CAAC,gCAAgC,CAAC,eAAe,CAC3E,YAAY,IAAI,QAAQ,QAAQ,CAAC,MAAM,wCAAwC,CAChF,CACF,CAAC;YACJ,CAAC;YAED,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,0CAA4B,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF;AA3FD,0DA2FC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport {\n getTestRunApiUrl,\n getAccessToken,\n extractErrorMessage,\n getWorkspaceMetaDataApiUrl,\n} from \"./utils.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { HttpService } from \"../common/httpService.js\";\nimport { TestRunCreatePayload, WorkspaceMetaData } from \"../common/types.js\";\nimport { Constants, InternalEnvironmentVariables } from \"../common/constants.js\";\n\nexport class PlaywrightServiceClient {\n private httpService: HttpService;\n\n constructor(httpService?: HttpService) {\n this.httpService = httpService ?? new HttpService();\n }\n\n async createOrUpdateTestRun(payload: TestRunCreatePayload): Promise<void> {\n try {\n const baseUrl = getTestRunApiUrl();\n const token = getAccessToken();\n if (!token) {\n throw new Error(\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN environment variable is not set.\");\n }\n const url = new URL(baseUrl);\n url.searchParams.set(\"api-version\", Constants.LatestAPIVersion);\n const method = \"PATCH\";\n const data = JSON.stringify(payload);\n const contentType = \"application/merge-patch+json\";\n const correlationId = crypto.randomUUID();\n\n const response = await this.httpService.callAPI(\n method,\n url.toString(),\n data,\n token,\n contentType,\n correlationId,\n );\n\n if (response.status !== 200) {\n const errorMessage = extractErrorMessage(response?.bodyAsText ?? \"\");\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = \"false\";\n console.error(\n ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(\n errorMessage || \"Unknown error\",\n ),\n );\n return;\n }\n\n console.log(\"Test run created successfully.\");\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = \"true\";\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred during test run creation\";\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = \"false\";\n console.error(\n ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(errorMessage),\n );\n }\n }\n\n async getWorkspaceMetadata(): Promise<WorkspaceMetaData> {\n try {\n const baseUrl = getWorkspaceMetaDataApiUrl();\n const token = getAccessToken();\n if (!token) {\n throw new Error(\"PLAYWRIGHT_SERVICE_ACCESS_TOKEN environment variable is not set.\");\n }\n const url = new URL(baseUrl);\n url.searchParams.set(\"api-version\", Constants.LatestAPIVersion);\n const method = \"GET\";\n const correlationId = crypto.randomUUID();\n\n const response = await this.httpService.callAPI(\n method,\n url.toString(),\n null,\n token,\n \"\",\n correlationId,\n );\n\n if (response.status !== 200) {\n const errorMessage = extractErrorMessage(response?.bodyAsText ?? \"\");\n throw new Error(\n ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.formatWithError(\n errorMessage || `HTTP ${response.status}: Failed to retrieve workspace details`,\n ),\n );\n }\n\n return response.bodyAsText ? JSON.parse(response.bodyAsText) : {};\n } catch (error) {\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.message);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightReporterStorageManager.d.ts","sourceRoot":"","sources":["../../../src/utils/playwrightReporterStorageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,gCAAgC;IAErC,sBAAsB,CAC1B,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,iBAAiB,GAClC,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"playwrightReporterStorageManager.d.ts","sourceRoot":"","sources":["../../../src/utils/playwrightReporterStorageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,gCAAgC;IAErC,sBAAsB,CAC1B,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,iBAAiB,GAClC,OAAO,CAAC,YAAY,CAAC;YAwGV,oBAAoB;IAmD5B,oCAAoC,CACxC,gBAAgB,CAAC,EAAE,MAAM,EACzB,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAC3C,OAAO,CAAC,YAAY,CAAC;YAiDV,sBAAsB;YA4GtB,4BAA4B;YAwB5B,4BAA4B;YA4E5B,yBAAyB;YA8CzB,sBAAsB;CAsCrC"}
|
|
@@ -25,6 +25,7 @@ class PlaywrightReporterStorageManager {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
const blobServiceClient = new storage_blob_1.BlobServiceClient(workspaceDetails?.storageUri, credential);
|
|
28
|
+
logger_js_1.coreLogger.info("blobServiceClient created successfully.");
|
|
28
29
|
const serviceUrlInfo = (0, utils_js_1.populateValuesFromServiceUrl)();
|
|
29
30
|
if (!serviceUrlInfo?.accountId) {
|
|
30
31
|
logger_js_1.coreLogger.error("Unable to extract workspace ID from service URL");
|
|
@@ -37,8 +38,12 @@ class PlaywrightReporterStorageManager {
|
|
|
37
38
|
const containerClient = blobServiceClient.getContainerClient(containerName);
|
|
38
39
|
const containerExists = await containerClient.exists();
|
|
39
40
|
if (!containerExists) {
|
|
41
|
+
logger_js_1.coreLogger.info(`Container ${containerName} does not exist. Creating new container.`);
|
|
40
42
|
await containerClient.create();
|
|
41
43
|
}
|
|
44
|
+
else {
|
|
45
|
+
logger_js_1.coreLogger.info(`Container ${containerName} already exists.`);
|
|
46
|
+
}
|
|
42
47
|
const folderName = runId;
|
|
43
48
|
const storageAccountName = (0, utils_js_1.getStorageAccountNameFromUri)(workspaceDetails?.storageUri || "") || "unknown";
|
|
44
49
|
console.log(messages_js_1.ServiceErrorMessageConstants.UPLOADING_ARTIFACTS.formatWithDetails(storageAccountName, containerName, folderName));
|
|
@@ -49,6 +54,16 @@ class PlaywrightReporterStorageManager {
|
|
|
49
54
|
}
|
|
50
55
|
const failedFiles = uploadResults.totalFiles - uploadResults.uploadedFiles.length;
|
|
51
56
|
if (failedFiles > 0) {
|
|
57
|
+
if (uploadResults.failedFileDetails) {
|
|
58
|
+
const hasAuthorizationError = uploadResults.failedFileDetails.some((fileDetail) => fileDetail.error.includes("not authorized to perform this operation") ||
|
|
59
|
+
fileDetail.error.includes("AuthorizationFailure"));
|
|
60
|
+
if (hasAuthorizationError) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
errorMessage: messages_js_1.ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.formatWithStorageAccount(storageAccountName),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
// Get list of failed file names by comparing total files with uploaded files
|
|
53
68
|
const uploadedSet = new Set(uploadResults.uploadedFiles);
|
|
54
69
|
const allFiles = (0, utils_js_1.collectAllFiles)(outputFolder, outputFolder, folderName);
|
|
@@ -69,14 +84,6 @@ class PlaywrightReporterStorageManager {
|
|
|
69
84
|
catch (error) {
|
|
70
85
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
71
86
|
logger_js_1.coreLogger.error(`Failed to upload HTML report: ${error}`);
|
|
72
|
-
if (error instanceof Error &&
|
|
73
|
-
(error.message.includes("AuthorizationFailure") ||
|
|
74
|
-
error.message.includes("not authorized to perform this operation"))) {
|
|
75
|
-
return {
|
|
76
|
-
success: false,
|
|
77
|
-
errorMessage: messages_js_1.ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.message,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
87
|
return { success: false, errorMessage };
|
|
81
88
|
}
|
|
82
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightReporterStorageManager.js","sourceRoot":"","sources":["../../../src/utils/playwrightReporterStorageManager.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,sDAA0F;AAE1F,mDAAiD;AACjD,2BAA+E;AAC/E,+BAA4B;AAC5B,yDAAyD;AACzD,uDAAqE;AACrE,yCAKoB;AACpB,qFAA+E;AAG/E,MAAa,gCAAgC;IAC3C,kDAAkD;IAClD,K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QAAQ,CAAC,QAAQ,CAAC,CAAC;YACpD,MAAM,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE;gBAC5D,eAAe,EAAE;oBACf,eAAe,EAAE,QAAQ,CAAC,WAAW;iBACtC;aACF,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,IAAI,8BAAe,CAAC,oBAAoB,EAAE,CAAC;YACjE,uDAAuD;YACvD,MAAM,WAAW,GAAG,IAAA,iBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACpD,MAAM,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE;gBAC5C,eAAe,EAAE;oBACf,eAAe,EAAE,QAAQ,CAAC,WAAW;iBACtC;gBACD,SAAS,EAAE,8BAAe,CAAC,oBAAoB;gBAC/C,WAAW,EAAE,8BAAe,CAAC,oBAAoB;aAClD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,qDAAqD;YACrD,MAAM,MAAM,GAAG,IAAA,qBAAgB,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,eAAe,CAAC,YAAY,CAChC,MAAM,EACN,8BAAe,CAAC,kBAAkB,EAClC,8BAAe,CAAC,sBAAsB,EACtC;gBACE,eAAe,EAAE;oBACf,eAAe,EAAE,QAAQ,CAAC,WAAW;iBACtC;aACF,CACF,CAAC;QACJ,CAAC;QACD,sBAAU,CAAC,IAAI,CAAC,0BAA0B,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACrE,CAAC;CACF;AAhfD,4EAgfC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BlobServiceClient, ContainerClient, BlockBlobClient } from \"@azure/storage-blob\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { readFileSync, writeFileSync, existsSync, createReadStream } from \"fs\";\nimport { join } from \"path\";\nimport { UploadConstants } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport {\n populateValuesFromServiceUrl,\n calculateOptimalConcurrency,\n collectAllFiles,\n getStorageAccountNameFromUri,\n} from \"./utils.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\nexport class PlaywrightReporterStorageManager {\n // Uploads the HTML report folder to Azure Storage\n async uploadHtmlReportFolder(\n credential: TokenCredential,\n runId: string,\n outputFolder: string,\n workspaceDetails: WorkspaceMetaData,\n ): Promise<UploadResult> {\n coreLogger.info(\n `Starting HTML report upload for runId: ${runId}, outputFolder: ${outputFolder}`,\n );\n try {\n coreLogger.info(`Received workspace details: ${JSON.stringify(workspaceDetails, null, 2)}`);\n\n if (!workspaceDetails.storageUri) {\n coreLogger.error(\"Storage URI not found in workspace details\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.STORAGE_URI_NOT_FOUND.message,\n };\n }\n\n const blobServiceClient = new BlobServiceClient(workspaceDetails?.storageUri, credential);\n const serviceUrlInfo = populateValuesFromServiceUrl();\n if (!serviceUrlInfo?.accountId) {\n coreLogger.error(\"Unable to extract workspace ID from service URL\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.UNABLE_TO_EXTRACT_WORKSPACE_ID.message,\n };\n }\n\n const containerName = serviceUrlInfo.accountId.toLowerCase().replace(/[^a-z0-9-]/g, \"-\");\n const containerClient = blobServiceClient.getContainerClient(containerName);\n\n const containerExists = await containerClient.exists();\n if (!containerExists) {\n await containerClient.create();\n }\n\n const folderName = runId;\n const storageAccountName =\n getStorageAccountNameFromUri(workspaceDetails?.storageUri || \"\") || \"unknown\";\n console.log(\n ServiceErrorMessageConstants.UPLOADING_ARTIFACTS.formatWithDetails(\n storageAccountName,\n containerName,\n folderName,\n ),\n );\n\n await this.modifyTraceIndexHtml(outputFolder);\n const uploadResults = await this.uploadFolderInParallel(\n containerClient,\n outputFolder,\n outputFolder,\n folderName,\n );\n\n if (uploadResults.totalFiles === 0) {\n return { success: false, errorMessage: \"No files found to upload\" };\n }\n\n const failedFiles = uploadResults.totalFiles - uploadResults.uploadedFiles.length;\n if (failedFiles > 0) {\n // Get list of failed file names by comparing total files with uploaded files\n const uploadedSet = new Set(uploadResults.uploadedFiles);\n const allFiles = collectAllFiles(outputFolder, outputFolder, folderName);\n const failedFileNames = allFiles\n .filter((file) => !uploadedSet.has(file.relativePath))\n .map((file) => file.relativePath);\n\n return {\n success: false,\n partialSuccess: true,\n failedFileCount: failedFiles,\n totalFiles: uploadResults.totalFiles,\n failedFiles: failedFileNames,\n failedFileDetails: uploadResults.failedFileDetails,\n };\n }\n\n return { success: true };\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n coreLogger.error(`Failed to upload HTML report: ${error}`);\n\n if (\n error instanceof Error &&\n (error.message.includes(\"AuthorizationFailure\") ||\n error.message.includes(\"not authorized to perform this operation\"))\n ) {\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.message,\n };\n }\n\n return { success: false, errorMessage };\n }\n }\n private async modifyTraceIndexHtml(outputFolder: string): Promise<void> {\n coreLogger.info(`Starting trace modification for folder: ${outputFolder}`);\n const indexPath = join(outputFolder, \"trace/index.html\");\n\n if (!existsSync(indexPath)) {\n coreLogger.error(`trace/index.html not found at path: ${indexPath}`);\n return;\n }\n coreLogger.info(`Found trace/index.html at: ${indexPath}`);\n\n try {\n const redirectTraceviewerScript = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <title>Redirecting to Trace Viewer...</title>\n</head>\n<body>\n <script>\n const url = new URL(location.href);\n const traceParam = url.searchParams.get('trace');\n const trace = new URL(traceParam);\n\n // Copy all query parameters from the current URL to the trace URL\n // This includes SAS tokens (sv, sr, sig, etc.) that are on the main URL\n for (const [key, value] of url.searchParams.entries()) {\n if (key !== 'trace') {\n trace.searchParams.set(key, value);\n }\n }\n\n const publicTraceViewer = new URL('https://trace.playwright.dev/');\n publicTraceViewer.searchParams.set('trace', trace.toString());\n location.href = publicTraceViewer.toString();\n </script>\n</body>\n</html>\n`;\n\n writeFileSync(indexPath, redirectTraceviewerScript, \"utf-8\");\n coreLogger.info(\"Successfully updated TraceViewer index file\");\n } catch (error) {\n coreLogger.error(\n `Error modifying trace/index.html: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n }\n\n // Uploads the entire Playwright HTML report folder after tests complete.\n\n async uploadPlaywrightHtmlReportAfterTests(\n outputFolderName?: string,\n workspaceMetadata?: WorkspaceMetaData | null,\n ): Promise<UploadResult> {\n try {\n coreLogger.info(\n `Starting post-test HTML report upload, folder name: ${outputFolderName || \"default (playwright-report)\"}`,\n );\n const cred = PlaywrightServiceConfig.instance.credential;\n if (!cred) {\n coreLogger.error(\"No credential found for authentication\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message,\n };\n }\n coreLogger.info(\"Credential found for authentication\");\n\n const folderName = outputFolderName || \"playwright-report\";\n const outputFolderPath = join(process.cwd(), folderName);\n\n if (!existsSync(outputFolderPath)) {\n coreLogger.error(`HTML report folder not found: ${outputFolderPath}`);\n return {\n success: false,\n errorMessage:\n ServiceErrorMessageConstants.PLAYWRIGHT_TEST_REPORT_NOT_FOUND.formatWithFolder(\n folderName,\n ),\n };\n }\n coreLogger.info(`HTML report folder found: ${outputFolderPath}`);\n\n const testRunId = PlaywrightServiceConfig.instance.runId;\n coreLogger.info(`Starting upload for test run ID: ${testRunId}`);\n const result = await this.uploadHtmlReportFolder(\n cred,\n testRunId,\n outputFolderPath,\n workspaceMetadata!,\n );\n coreLogger.info(`Completed upload for test run ID: ${testRunId}`);\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n // Parallel Upload Engine - Core upload orchestration with performance optimization\n\n private async uploadFolderInParallel(\n containerClient: ContainerClient,\n folderPath: string,\n basePath: string,\n runIdFolderPrefix?: string,\n ): Promise<{\n uploadedFiles: string[];\n failedFiles: string[];\n failedFileDetails?: Array<{ fileName: string; error: string }>;\n totalFiles: number;\n totalSize: number;\n uploadTime: number;\n }> {\n // Sort by size descending - upload large files first for better parallelization\n const filesToUpload = collectAllFiles(folderPath, basePath, runIdFolderPrefix).sort(\n (a, b) => b.size - a.size,\n );\n\n if (filesToUpload.length === 0) {\n return { uploadedFiles: [], failedFiles: [], totalFiles: 0, totalSize: 0, uploadTime: 0 };\n }\n\n const totalSize = filesToUpload.reduce((sum, file) => sum + file.size, 0);\n\n const concurrency = calculateOptimalConcurrency(filesToUpload);\n coreLogger.info(\n `Calculated optimal concurrency: ${concurrency} for ${filesToUpload.length} files (total size: ${(totalSize / 1024 / 1024).toFixed(2)} MB)`,\n );\n const uploadStartTime = Date.now();\n coreLogger.info(`Starting parallel upload with ${concurrency} concurrent operations`);\n const results = await this.uploadWithConcurrencyControl(\n containerClient,\n filesToUpload,\n concurrency,\n );\n\n const uploadEndTime = Date.now();\n const uploadTime = uploadEndTime - uploadStartTime;\n coreLogger.info(`Upload completed in ${uploadTime}ms (${(uploadTime / 1000).toFixed(2)}s)`);\n\n const failed = results.filter((r) => r.status === \"rejected\").length;\n const successful = results.filter((r) => r.status === \"fulfilled\").length;\n coreLogger.info(\n `Upload results: ${successful} successful, ${failed} failed out of ${results.length} total files`,\n );\n\n if (failed > 0) {\n const errors = results\n .filter((r): r is PromiseRejectedResult => r.status === \"rejected\")\n .map((r) => r.reason.message)\n .slice(0, 5); // Show first 5 errors\n\n errors.forEach((error, index) => {\n coreLogger.error(` ${index + 1}. ${error}`);\n });\n\n // Get failed file names and their error messages\n const uploadedSet = new Set(\n results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value),\n );\n const failedFileNames = filesToUpload\n .filter((file) => !uploadedSet.has(file.relativePath))\n .map((file) => file.relativePath);\n\n // Create detailed error mapping\n const failedFileDetails: Array<{ fileName: string; error: string }> = [];\n results.forEach((result, index) => {\n if (result.status === \"rejected\") {\n const fileName = filesToUpload[index]?.relativePath || `File at index ${index}`;\n const errorMessage =\n result.reason instanceof Error ? result.reason.message : String(result.reason);\n failedFileDetails.push({ fileName, error: errorMessage });\n }\n });\n\n // Log error but don't throw to prevent breaking HTML reporter\n coreLogger.error(\n `Upload failed: ${failed} files could not be uploaded. Sample errors: ${errors.join(\", \")}`,\n );\n return {\n uploadedFiles: results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value),\n failedFiles: failedFileNames,\n failedFileDetails,\n totalFiles: filesToUpload.length,\n totalSize,\n uploadTime,\n };\n }\n\n const uploadedFiles = results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value);\n\n return {\n uploadedFiles,\n failedFiles: [],\n totalFiles: filesToUpload.length,\n totalSize,\n uploadTime,\n };\n }\n\n // Concurrency Control System - Manages parallel execution with controlled resource usage\n\n private async uploadWithConcurrencyControl(\n containerClient: ContainerClient,\n files: Array<{ fullPath: string; relativePath: string; size: number; contentType: string }>,\n concurrency: number,\n ): Promise<PromiseSettledResult<string>[]> {\n const uploadTasks = files.map((fileInfo) => async (): Promise<string> => {\n try {\n await this.uploadSingleFileOptimized(containerClient, fileInfo);\n return fileInfo.relativePath;\n } catch (error) {\n coreLogger.error(\n `Failed to upload file: ${fileInfo.relativePath} - ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n );\n throw error;\n }\n });\n\n return this.executeWithOptimizedBatching(uploadTasks, concurrency);\n }\n\n // Optimized Batch Execution Engine - High-performance task processing system\n\n private async executeWithOptimizedBatching<T>(\n tasks: Array<() => Promise<T>>,\n concurrency: number,\n ): Promise<PromiseSettledResult<T>[]> {\n const results: PromiseSettledResult<T>[] = new Array(tasks.length);\n let completedTasks = 0;\n\n // Splits tasks into optimal batches to balance memory usage vs. throughput\n const batchSize = Math.min(UploadConstants.BATCH_SIZE, concurrency * 2);\n const batches: Array<Array<() => Promise<T>>> = [];\n\n // Each batch will be processed with full concurrency before moving to next batch\n for (let i = 0; i < tasks.length; i += batchSize) {\n batches.push(tasks.slice(i, i + batchSize));\n }\n\n // Process each batch sequentially to maintain memory efficiency\n coreLogger.info(`Processing ${batches.length} batches with ${batchSize} tasks per batch`);\n for (let batchIndex = 0; batchIndex < batches.length; batchIndex++) {\n const batch = batches[batchIndex];\n const batchStartIndex = batchIndex * batchSize;\n coreLogger.info(\n `Starting batch ${batchIndex + 1}/${batches.length} with ${batch.length} tasks`,\n );\n\n // Transform each task into a promise that captures results at correct index\n const batchPromises = batch.map(async (task, taskIndex) => {\n const globalIndex = batchStartIndex + taskIndex;\n try {\n const result = await task();\n results[globalIndex] = { status: \"fulfilled\", value: result };\n return result;\n } catch (error) {\n results[globalIndex] = { status: \"rejected\", reason: error };\n coreLogger.error(\n `Task failed at index ${globalIndex}: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n );\n return;\n }\n });\n\n const executing: Promise<any>[] = [];\n\n for (const promise of batchPromises) {\n if (executing.length >= concurrency) {\n await Promise.race(executing);\n }\n const wrappedPromise = promise\n .then((result) => {\n completedTasks++;\n return result;\n })\n .catch(() => {\n completedTasks++;\n })\n .finally(() => {\n // Cleanup: remove completed promise from executing array\n const index = executing.indexOf(wrappedPromise);\n if (index > -1) executing.splice(index, 1);\n });\n\n executing.push(wrappedPromise);\n }\n\n // Wait for all promises in current batch to complete before moving to next batch\n await Promise.allSettled(executing);\n coreLogger.info(`Completed batch ${batchIndex + 1}/${batches.length}`);\n }\n\n return results;\n }\n\n // Individual File Upload with Retry Logic\n\n private async uploadSingleFileOptimized(\n containerClient: ContainerClient,\n fileInfo: { fullPath: string; relativePath: string; contentType: string; size: number },\n ): Promise<void> {\n coreLogger.info(\n `Uploading file: ${fileInfo.relativePath} (${(fileInfo.size / 1024).toFixed(2)} KB, ${fileInfo.contentType})`,\n );\n const blockBlobClient = containerClient.getBlockBlobClient(fileInfo.relativePath);\n const maxRetries = UploadConstants.MAX_RETRY_ATTEMPTS;\n const baseDelay = UploadConstants.RETRY_BASE_DELAY;\n\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n try {\n await this.performOptimizedUpload(blockBlobClient, fileInfo);\n return;\n } catch (error) {\n const isLastAttempt = attempt === maxRetries;\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.info(\n `Upload attempt ${attempt} failed for ${fileInfo.relativePath}: ${errorMessage}`,\n );\n\n if (isLastAttempt) {\n coreLogger.error(\n `All retry attempts exhausted for ${fileInfo.relativePath}: ${errorMessage}`,\n );\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(\n `Upload failed for ${fileInfo.relativePath} after ${maxRetries} attempts: ${errorMessage}`,\n );\n }\n\n // Exponential backoff with jitter (Azure SDK pattern)\n const delay = baseDelay * Math.pow(2, attempt - 1) + Math.random() * 500;\n coreLogger.info(\n `Retrying upload for ${fileInfo.relativePath} in ${delay.toFixed(0)}ms (attempt ${attempt + 1}/${maxRetries})`,\n );\n await new Promise((_resolve) => setTimeout(_resolve, delay));\n }\n }\n }\n\n // Multi-Strategy Upload Engine - Optimized upload based on file characteristics\n\n private async performOptimizedUpload(\n blockBlobClient: BlockBlobClient,\n fileInfo: { fullPath: string; relativePath: string; contentType: string; size: number },\n ): Promise<void> {\n if (fileInfo.size <= UploadConstants.SMALL_FILE_THRESHOLD) {\n // DIRECT UPLOAD: Optimal for small files (≤1MB)\n const fileContent = readFileSync(fileInfo.fullPath);\n await blockBlobClient.upload(fileContent, fileContent.length, {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n });\n } else if (fileInfo.size <= UploadConstants.LARGE_FILE_THRESHOLD) {\n // BLOCK UPLOAD: Optimal for medium files (1MB - 100MB)\n const fileContent = readFileSync(fileInfo.fullPath);\n await blockBlobClient.uploadData(fileContent, {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n blockSize: UploadConstants.OPTIMIZED_BLOCK_SIZE,\n concurrency: UploadConstants.PER_FILE_CONCURRENCY,\n });\n } else {\n // STREAMING UPLOAD: Optimal for large files (>100MB)\n const stream = createReadStream(fileInfo.fullPath);\n await blockBlobClient.uploadStream(\n stream,\n UploadConstants.STREAM_BUFFER_SIZE,\n UploadConstants.LARGE_FILE_CONCURRENCY,\n {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n },\n );\n }\n coreLogger.info(`Successfully uploaded: ${fileInfo.relativePath}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"playwrightReporterStorageManager.js","sourceRoot":"","sources":["../../../src/utils/playwrightReporterStorageManager.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,sDAA0F;AAE1F,mDAAiD;AACjD,2BAA+E;AAC/E,+BAA4B;AAC5B,yDAAyD;AACzD,uDAAqE;AACrE,yCAKoB;AACpB,qFAA+E;AAG/E,MAAa,gCAAgC;IAC3C,kDAAkD;IAClD,KAAK,CAAC,sBAAsB,CAC1B,UAA2B,EAC3B,KAAa,EACb,YAAoB,EACpB,gBAAmC;QAEnC,sBAAU,CAAC,IAAI,CACb,0CAA0C,KAAK,mBAAmB,YAAY,EAAE,CACjF,CAAC;QACF,IAAI,CAAC;YACH,sBAAU,CAAC,IAAI,CAAC,+BAA+B,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAE5F,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;gBACjC,sBAAU,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;gBAC/D,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,YAAY,EAAE,0CAA4B,CAAC,qBAAqB,CAAC,OAAO;iBACzE,CAAC;YACJ,CAAC;YAED,MAAM,iBAAiB,GAAG,IAAI,gCAAiB,CAAC,gBAAgB,EAAE,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AM,IAAI,QAAQ,CAAC,IAAI,IAAI,8BAAe,CAAC,oBAAoB,EAAE,CAAC;YACjE,uDAAuD;YACvD,MAAM,WAAW,GAAG,IAAA,iBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACpD,MAAM,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE;gBAC5C,eAAe,EAAE;oBACf,eAAe,EAAE,QAAQ,CAAC,WAAW;iBACtC;gBACD,SAAS,EAAE,8BAAe,CAAC,oBAAoB;gBAC/C,WAAW,EAAE,8BAAe,CAAC,oBAAoB;aAClD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,qDAAqD;YACrD,MAAM,MAAM,GAAG,IAAA,qBAAgB,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,eAAe,CAAC,YAAY,CAChC,MAAM,EACN,8BAAe,CAAC,kBAAkB,EAClC,8BAAe,CAAC,sBAAsB,EACtC;gBACE,eAAe,EAAE;oBACf,eAAe,EAAE,QAAQ,CAAC,WAAW;iBACtC;aACF,CACF,CAAC;QACJ,CAAC;QACD,sBAAU,CAAC,IAAI,CAAC,0BAA0B,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACrE,CAAC;CACF;AA1fD,4EA0fC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BlobServiceClient, ContainerClient, BlockBlobClient } from \"@azure/storage-blob\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { readFileSync, writeFileSync, existsSync, createReadStream } from \"fs\";\nimport { join } from \"path\";\nimport { UploadConstants } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport {\n populateValuesFromServiceUrl,\n calculateOptimalConcurrency,\n collectAllFiles,\n getStorageAccountNameFromUri,\n} from \"./utils.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\nexport class PlaywrightReporterStorageManager {\n // Uploads the HTML report folder to Azure Storage\n async uploadHtmlReportFolder(\n credential: TokenCredential,\n runId: string,\n outputFolder: string,\n workspaceDetails: WorkspaceMetaData,\n ): Promise<UploadResult> {\n coreLogger.info(\n `Starting HTML report upload for runId: ${runId}, outputFolder: ${outputFolder}`,\n );\n try {\n coreLogger.info(`Received workspace details: ${JSON.stringify(workspaceDetails, null, 2)}`);\n\n if (!workspaceDetails.storageUri) {\n coreLogger.error(\"Storage URI not found in workspace details\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.STORAGE_URI_NOT_FOUND.message,\n };\n }\n\n const blobServiceClient = new BlobServiceClient(workspaceDetails?.storageUri, credential);\n coreLogger.info(\"blobServiceClient created successfully.\");\n const serviceUrlInfo = populateValuesFromServiceUrl();\n if (!serviceUrlInfo?.accountId) {\n coreLogger.error(\"Unable to extract workspace ID from service URL\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.UNABLE_TO_EXTRACT_WORKSPACE_ID.message,\n };\n }\n\n const containerName = serviceUrlInfo.accountId.toLowerCase().replace(/[^a-z0-9-]/g, \"-\");\n const containerClient = blobServiceClient.getContainerClient(containerName);\n\n const containerExists = await containerClient.exists();\n if (!containerExists) {\n coreLogger.info(`Container ${containerName} does not exist. Creating new container.`);\n await containerClient.create();\n } else {\n coreLogger.info(`Container ${containerName} already exists.`);\n }\n\n const folderName = runId;\n const storageAccountName =\n getStorageAccountNameFromUri(workspaceDetails?.storageUri || \"\") || \"unknown\";\n console.log(\n ServiceErrorMessageConstants.UPLOADING_ARTIFACTS.formatWithDetails(\n storageAccountName,\n containerName,\n folderName,\n ),\n );\n\n await this.modifyTraceIndexHtml(outputFolder);\n const uploadResults = await this.uploadFolderInParallel(\n containerClient,\n outputFolder,\n outputFolder,\n folderName,\n );\n\n if (uploadResults.totalFiles === 0) {\n return { success: false, errorMessage: \"No files found to upload\" };\n }\n\n const failedFiles = uploadResults.totalFiles - uploadResults.uploadedFiles.length;\n if (failedFiles > 0) {\n if (uploadResults.failedFileDetails) {\n const hasAuthorizationError = uploadResults.failedFileDetails.some(\n (fileDetail) =>\n fileDetail.error.includes(\"not authorized to perform this operation\") ||\n fileDetail.error.includes(\"AuthorizationFailure\"),\n );\n\n if (hasAuthorizationError) {\n return {\n success: false,\n errorMessage:\n ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.formatWithStorageAccount(\n storageAccountName,\n ),\n };\n }\n }\n\n // Get list of failed file names by comparing total files with uploaded files\n const uploadedSet = new Set(uploadResults.uploadedFiles);\n const allFiles = collectAllFiles(outputFolder, outputFolder, folderName);\n const failedFileNames = allFiles\n .filter((file) => !uploadedSet.has(file.relativePath))\n .map((file) => file.relativePath);\n\n return {\n success: false,\n partialSuccess: true,\n failedFileCount: failedFiles,\n totalFiles: uploadResults.totalFiles,\n failedFiles: failedFileNames,\n failedFileDetails: uploadResults.failedFileDetails,\n };\n }\n\n return { success: true };\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n coreLogger.error(`Failed to upload HTML report: ${error}`);\n return { success: false, errorMessage };\n }\n }\n private async modifyTraceIndexHtml(outputFolder: string): Promise<void> {\n coreLogger.info(`Starting trace modification for folder: ${outputFolder}`);\n const indexPath = join(outputFolder, \"trace/index.html\");\n\n if (!existsSync(indexPath)) {\n coreLogger.error(`trace/index.html not found at path: ${indexPath}`);\n return;\n }\n coreLogger.info(`Found trace/index.html at: ${indexPath}`);\n\n try {\n const redirectTraceviewerScript = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <title>Redirecting to Trace Viewer...</title>\n</head>\n<body>\n <script>\n const url = new URL(location.href);\n const traceParam = url.searchParams.get('trace');\n const trace = new URL(traceParam);\n\n // Copy all query parameters from the current URL to the trace URL\n // This includes SAS tokens (sv, sr, sig, etc.) that are on the main URL\n for (const [key, value] of url.searchParams.entries()) {\n if (key !== 'trace') {\n trace.searchParams.set(key, value);\n }\n }\n\n const publicTraceViewer = new URL('https://trace.playwright.dev/');\n publicTraceViewer.searchParams.set('trace', trace.toString());\n location.href = publicTraceViewer.toString();\n </script>\n</body>\n</html>\n`;\n\n writeFileSync(indexPath, redirectTraceviewerScript, \"utf-8\");\n coreLogger.info(\"Successfully updated TraceViewer index file\");\n } catch (error) {\n coreLogger.error(\n `Error modifying trace/index.html: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n }\n\n // Uploads the entire Playwright HTML report folder after tests complete.\n\n async uploadPlaywrightHtmlReportAfterTests(\n outputFolderName?: string,\n workspaceMetadata?: WorkspaceMetaData | null,\n ): Promise<UploadResult> {\n try {\n coreLogger.info(\n `Starting post-test HTML report upload, folder name: ${outputFolderName || \"default (playwright-report)\"}`,\n );\n const cred = PlaywrightServiceConfig.instance.credential;\n if (!cred) {\n coreLogger.error(\"No credential found for authentication\");\n return {\n success: false,\n errorMessage: ServiceErrorMessageConstants.NO_CRED_ENTRA_AUTH_ERROR.message,\n };\n }\n coreLogger.info(\"Credential found for authentication\");\n\n const folderName = outputFolderName || \"playwright-report\";\n const outputFolderPath = join(process.cwd(), folderName);\n\n if (!existsSync(outputFolderPath)) {\n coreLogger.error(`HTML report folder not found: ${outputFolderPath}`);\n return {\n success: false,\n errorMessage:\n ServiceErrorMessageConstants.PLAYWRIGHT_TEST_REPORT_NOT_FOUND.formatWithFolder(\n folderName,\n ),\n };\n }\n coreLogger.info(`HTML report folder found: ${outputFolderPath}`);\n\n const testRunId = PlaywrightServiceConfig.instance.runId;\n coreLogger.info(`Starting upload for test run ID: ${testRunId}`);\n const result = await this.uploadHtmlReportFolder(\n cred,\n testRunId,\n outputFolderPath,\n workspaceMetadata!,\n );\n coreLogger.info(`Completed upload for test run ID: ${testRunId}`);\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n // Parallel Upload Engine - Core upload orchestration with performance optimization\n\n private async uploadFolderInParallel(\n containerClient: ContainerClient,\n folderPath: string,\n basePath: string,\n runIdFolderPrefix?: string,\n ): Promise<{\n uploadedFiles: string[];\n failedFiles: string[];\n failedFileDetails?: Array<{ fileName: string; error: string }>;\n totalFiles: number;\n totalSize: number;\n uploadTime: number;\n }> {\n // Sort by size descending - upload large files first for better parallelization\n const filesToUpload = collectAllFiles(folderPath, basePath, runIdFolderPrefix).sort(\n (a, b) => b.size - a.size,\n );\n\n if (filesToUpload.length === 0) {\n return { uploadedFiles: [], failedFiles: [], totalFiles: 0, totalSize: 0, uploadTime: 0 };\n }\n\n const totalSize = filesToUpload.reduce((sum, file) => sum + file.size, 0);\n\n const concurrency = calculateOptimalConcurrency(filesToUpload);\n coreLogger.info(\n `Calculated optimal concurrency: ${concurrency} for ${filesToUpload.length} files (total size: ${(totalSize / 1024 / 1024).toFixed(2)} MB)`,\n );\n const uploadStartTime = Date.now();\n coreLogger.info(`Starting parallel upload with ${concurrency} concurrent operations`);\n const results = await this.uploadWithConcurrencyControl(\n containerClient,\n filesToUpload,\n concurrency,\n );\n\n const uploadEndTime = Date.now();\n const uploadTime = uploadEndTime - uploadStartTime;\n coreLogger.info(`Upload completed in ${uploadTime}ms (${(uploadTime / 1000).toFixed(2)}s)`);\n\n const failed = results.filter((r) => r.status === \"rejected\").length;\n const successful = results.filter((r) => r.status === \"fulfilled\").length;\n coreLogger.info(\n `Upload results: ${successful} successful, ${failed} failed out of ${results.length} total files`,\n );\n\n if (failed > 0) {\n const errors = results\n .filter((r): r is PromiseRejectedResult => r.status === \"rejected\")\n .map((r) => r.reason.message)\n .slice(0, 5); // Show first 5 errors\n\n errors.forEach((error, index) => {\n coreLogger.error(` ${index + 1}. ${error}`);\n });\n\n // Get failed file names and their error messages\n const uploadedSet = new Set(\n results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value),\n );\n const failedFileNames = filesToUpload\n .filter((file) => !uploadedSet.has(file.relativePath))\n .map((file) => file.relativePath);\n\n // Create detailed error mapping\n const failedFileDetails: Array<{ fileName: string; error: string }> = [];\n results.forEach((result, index) => {\n if (result.status === \"rejected\") {\n const fileName = filesToUpload[index]?.relativePath || `File at index ${index}`;\n const errorMessage =\n result.reason instanceof Error ? result.reason.message : String(result.reason);\n failedFileDetails.push({ fileName, error: errorMessage });\n }\n });\n\n // Log error but don't throw to prevent breaking HTML reporter\n coreLogger.error(\n `Upload failed: ${failed} files could not be uploaded. Sample errors: ${errors.join(\", \")}`,\n );\n return {\n uploadedFiles: results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value),\n failedFiles: failedFileNames,\n failedFileDetails,\n totalFiles: filesToUpload.length,\n totalSize,\n uploadTime,\n };\n }\n\n const uploadedFiles = results\n .filter((r): r is PromiseFulfilledResult<string> => r.status === \"fulfilled\")\n .map((r) => r.value);\n\n return {\n uploadedFiles,\n failedFiles: [],\n totalFiles: filesToUpload.length,\n totalSize,\n uploadTime,\n };\n }\n\n // Concurrency Control System - Manages parallel execution with controlled resource usage\n\n private async uploadWithConcurrencyControl(\n containerClient: ContainerClient,\n files: Array<{ fullPath: string; relativePath: string; size: number; contentType: string }>,\n concurrency: number,\n ): Promise<PromiseSettledResult<string>[]> {\n const uploadTasks = files.map((fileInfo) => async (): Promise<string> => {\n try {\n await this.uploadSingleFileOptimized(containerClient, fileInfo);\n return fileInfo.relativePath;\n } catch (error) {\n coreLogger.error(\n `Failed to upload file: ${fileInfo.relativePath} - ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n );\n throw error;\n }\n });\n\n return this.executeWithOptimizedBatching(uploadTasks, concurrency);\n }\n\n // Optimized Batch Execution Engine - High-performance task processing system\n\n private async executeWithOptimizedBatching<T>(\n tasks: Array<() => Promise<T>>,\n concurrency: number,\n ): Promise<PromiseSettledResult<T>[]> {\n const results: PromiseSettledResult<T>[] = new Array(tasks.length);\n let completedTasks = 0;\n\n // Splits tasks into optimal batches to balance memory usage vs. throughput\n const batchSize = Math.min(UploadConstants.BATCH_SIZE, concurrency * 2);\n const batches: Array<Array<() => Promise<T>>> = [];\n\n // Each batch will be processed with full concurrency before moving to next batch\n for (let i = 0; i < tasks.length; i += batchSize) {\n batches.push(tasks.slice(i, i + batchSize));\n }\n\n // Process each batch sequentially to maintain memory efficiency\n coreLogger.info(`Processing ${batches.length} batches with ${batchSize} tasks per batch`);\n for (let batchIndex = 0; batchIndex < batches.length; batchIndex++) {\n const batch = batches[batchIndex];\n const batchStartIndex = batchIndex * batchSize;\n coreLogger.info(\n `Starting batch ${batchIndex + 1}/${batches.length} with ${batch.length} tasks`,\n );\n\n // Transform each task into a promise that captures results at correct index\n const batchPromises = batch.map(async (task, taskIndex) => {\n const globalIndex = batchStartIndex + taskIndex;\n try {\n const result = await task();\n results[globalIndex] = { status: \"fulfilled\", value: result };\n return result;\n } catch (error) {\n results[globalIndex] = { status: \"rejected\", reason: error };\n coreLogger.error(\n `Task failed at index ${globalIndex}: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n );\n return;\n }\n });\n\n const executing: Promise<any>[] = [];\n\n for (const promise of batchPromises) {\n if (executing.length >= concurrency) {\n await Promise.race(executing);\n }\n const wrappedPromise = promise\n .then((result) => {\n completedTasks++;\n return result;\n })\n .catch(() => {\n completedTasks++;\n })\n .finally(() => {\n // Cleanup: remove completed promise from executing array\n const index = executing.indexOf(wrappedPromise);\n if (index > -1) executing.splice(index, 1);\n });\n\n executing.push(wrappedPromise);\n }\n\n // Wait for all promises in current batch to complete before moving to next batch\n await Promise.allSettled(executing);\n coreLogger.info(`Completed batch ${batchIndex + 1}/${batches.length}`);\n }\n\n return results;\n }\n\n // Individual File Upload with Retry Logic\n\n private async uploadSingleFileOptimized(\n containerClient: ContainerClient,\n fileInfo: { fullPath: string; relativePath: string; contentType: string; size: number },\n ): Promise<void> {\n coreLogger.info(\n `Uploading file: ${fileInfo.relativePath} (${(fileInfo.size / 1024).toFixed(2)} KB, ${fileInfo.contentType})`,\n );\n const blockBlobClient = containerClient.getBlockBlobClient(fileInfo.relativePath);\n const maxRetries = UploadConstants.MAX_RETRY_ATTEMPTS;\n const baseDelay = UploadConstants.RETRY_BASE_DELAY;\n\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n try {\n await this.performOptimizedUpload(blockBlobClient, fileInfo);\n return;\n } catch (error) {\n const isLastAttempt = attempt === maxRetries;\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.info(\n `Upload attempt ${attempt} failed for ${fileInfo.relativePath}: ${errorMessage}`,\n );\n\n if (isLastAttempt) {\n coreLogger.error(\n `All retry attempts exhausted for ${fileInfo.relativePath}: ${errorMessage}`,\n );\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(\n `Upload failed for ${fileInfo.relativePath} after ${maxRetries} attempts: ${errorMessage}`,\n );\n }\n\n // Exponential backoff with jitter (Azure SDK pattern)\n const delay = baseDelay * Math.pow(2, attempt - 1) + Math.random() * 500;\n coreLogger.info(\n `Retrying upload for ${fileInfo.relativePath} in ${delay.toFixed(0)}ms (attempt ${attempt + 1}/${maxRetries})`,\n );\n await new Promise((_resolve) => setTimeout(_resolve, delay));\n }\n }\n }\n\n // Multi-Strategy Upload Engine - Optimized upload based on file characteristics\n\n private async performOptimizedUpload(\n blockBlobClient: BlockBlobClient,\n fileInfo: { fullPath: string; relativePath: string; contentType: string; size: number },\n ): Promise<void> {\n if (fileInfo.size <= UploadConstants.SMALL_FILE_THRESHOLD) {\n // DIRECT UPLOAD: Optimal for small files (≤1MB)\n const fileContent = readFileSync(fileInfo.fullPath);\n await blockBlobClient.upload(fileContent, fileContent.length, {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n });\n } else if (fileInfo.size <= UploadConstants.LARGE_FILE_THRESHOLD) {\n // BLOCK UPLOAD: Optimal for medium files (1MB - 100MB)\n const fileContent = readFileSync(fileInfo.fullPath);\n await blockBlobClient.uploadData(fileContent, {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n blockSize: UploadConstants.OPTIMIZED_BLOCK_SIZE,\n concurrency: UploadConstants.PER_FILE_CONCURRENCY,\n });\n } else {\n // STREAMING UPLOAD: Optimal for large files (>100MB)\n const stream = createReadStream(fileInfo.fullPath);\n await blockBlobClient.uploadStream(\n stream,\n UploadConstants.STREAM_BUFFER_SIZE,\n UploadConstants.LARGE_FILE_CONCURRENCY,\n {\n blobHTTPHeaders: {\n blobContentType: fileInfo.contentType,\n },\n },\n );\n }\n coreLogger.info(`Successfully uploaded: ${fileInfo.relativePath}`);\n }\n}\n"]}
|
|
@@ -66,6 +66,7 @@ export declare const InternalEnvironmentVariables: {
|
|
|
66
66
|
MPT_SERVICE_OS: string;
|
|
67
67
|
ONE_TIME_OPERATION_FLAG: string;
|
|
68
68
|
USING_SERVICE_CONFIG: string;
|
|
69
|
+
TEST_RUN_CREATION_SUCCESS: string;
|
|
69
70
|
};
|
|
70
71
|
export declare const UploadConstants: {
|
|
71
72
|
SMALL_FILE_THRESHOLD: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAGA,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;;;CAGtC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;CAM1C,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAGA,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;;;CAGtC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;CAM1C,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;CAWxC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;CAY3B,CAAC"}
|
|
@@ -68,6 +68,7 @@ export const InternalEnvironmentVariables = {
|
|
|
68
68
|
MPT_SERVICE_OS: "_MPT_SERVICE_OS",
|
|
69
69
|
ONE_TIME_OPERATION_FLAG: "_ONE_TIME_OPERATION_FLAG",
|
|
70
70
|
USING_SERVICE_CONFIG: "_USING_SERVICE_CONFIG",
|
|
71
|
+
TEST_RUN_CREATION_SUCCESS: "_MPT_TEST_RUN_CREATION_SUCCESS",
|
|
71
72
|
};
|
|
72
73
|
export const UploadConstants = {
|
|
73
74
|
SMALL_FILE_THRESHOLD: 1024 * 1024,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,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// Licensed under the MIT License.\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Azure Playwright cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Azure Playwright\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Azure Playwright\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n};\n\nexport const GitHubActionsConstants = {\n GIT_VERSION_COMMAND: \"git --version\",\n GIT_REV_PARSE: \"git rev-parse --is-inside-work-tree\",\n GIT_COMMIT_MESSAGE_COMMAND: 'git log -1 --pretty=format:\"%s\"',\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n DEFAULT_SERVICE_AUTH_TYPE: ServiceAuth.ENTRA_ID,\n};\n\nexport const SDKLanguage = {\n JAVASCRIPT: \"JAVASCRIPT\",\n TYPESCRIPT: \"TYPESCRIPT\",\n CSHARP: \"CSHARP\",\n};\n\nexport const RunConfigConstants = {\n TEST_FRAMEWORK_NAME: \"PLAYWRIGHT\",\n TEST_SDK_LANGUAGE: SDKLanguage.JAVASCRIPT,\n TEST_FRAMEWORK_RUNNERNAME: \"PLAYWRIGHT\",\n};\n\nexport const Constants = {\n SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,\n OneDayInMS: 24 * 60 * 60 * 1000,\n MinimumSupportedPlaywrightVersion: \"1.47.0\",\n LatestAPIVersion: \"2025-09-01\",\n HTTP_CALL_TIMEOUT: 10000,\n};\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_SERVICE_RUN_NAME: \"_MPT_SERVICE_RUN_NAME\",\n MPT_API_VERSION: \"_MPT_API_VERSION\",\n MPT_SERVICE_RUN_ID: \"_MPT_SERVICE_RUN_ID\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n MPT_SERVICE_OS: \"_MPT_SERVICE_OS\",\n ONE_TIME_OPERATION_FLAG: \"_ONE_TIME_OPERATION_FLAG\",\n USING_SERVICE_CONFIG: \"_USING_SERVICE_CONFIG\",\n TEST_RUN_CREATION_SUCCESS: \"_MPT_TEST_RUN_CREATION_SUCCESS\",\n};\n\nexport const UploadConstants = {\n SMALL_FILE_THRESHOLD: 1024 * 1024,\n LARGE_FILE_THRESHOLD: 100 * 1024 * 1024,\n BASE_CONCURRENCY: 20,\n MAX_CONCURRENCY: 50,\n PER_FILE_CONCURRENCY: 10,\n LARGE_FILE_CONCURRENCY: 5,\n BATCH_SIZE: 100,\n OPTIMIZED_BLOCK_SIZE: 8 * 1024 * 1024,\n STREAM_BUFFER_SIZE: 4 * 1024 * 1024,\n MAX_RETRY_ATTEMPTS: 3,\n RETRY_BASE_DELAY: 1000,\n};\n"]}
|
|
@@ -64,6 +64,7 @@ export declare const ServiceErrorMessageConstants: {
|
|
|
64
64
|
STORAGE_AUTHORIZATION_FAILED: {
|
|
65
65
|
key: string;
|
|
66
66
|
message: string;
|
|
67
|
+
formatWithStorageAccount: (storageAccountName: string) => string;
|
|
67
68
|
};
|
|
68
69
|
UNABLE_TO_EXTRACT_WORKSPACE_ID: {
|
|
69
70
|
key: string;
|
|
@@ -130,5 +131,18 @@ export declare const ServiceErrorMessageConstants: {
|
|
|
130
131
|
message: string;
|
|
131
132
|
formatWithError: (error: string) => string;
|
|
132
133
|
};
|
|
134
|
+
TEST_RUN_CREATION_FAILED: {
|
|
135
|
+
key: string;
|
|
136
|
+
message: string;
|
|
137
|
+
formatWithErrorDetails: (errorDetails: string) => string;
|
|
138
|
+
};
|
|
139
|
+
REPORTING_TEST_RUN_FAILED: {
|
|
140
|
+
key: string;
|
|
141
|
+
message: string;
|
|
142
|
+
};
|
|
143
|
+
REPORTER_REQUIRES_SERVICE_CONFIG: {
|
|
144
|
+
key: string;
|
|
145
|
+
message: string;
|
|
146
|
+
};
|
|
133
147
|
};
|
|
134
148
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA+CE,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;+CAkBf,MAAM,KAAG,MAAM
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA+CE,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;+CAkBf,MAAM,KAAG,MAAM;;;;;;;;;uDAWP,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;kCA8BpC,MAAM,KAAG,MAAM;;;;;uCAMV,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;6BA0BzB,MAAM,KAAG,MAAM;;;;;4CAKA,MAAM,aAAa,MAAM,UAAU,MAAM,KAAG,MAAM;;;;;iCAM7D,MAAM,KAAG,MAAM;;;;;+CAKD,MAAM,KAAG,MAAM;;;;;;;;;;CAYzD,CAAC"}
|
|
@@ -65,7 +65,8 @@ export const ServiceErrorMessageConstants = {
|
|
|
65
65
|
},
|
|
66
66
|
STORAGE_AUTHORIZATION_FAILED: {
|
|
67
67
|
key: "StorageAuthorizationFailed",
|
|
68
|
-
message: "
|
|
68
|
+
message: "The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account. Refer to https://aka.ms/pww-reporting",
|
|
69
|
+
formatWithStorageAccount: (storageAccountName) => `The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account - ${storageAccountName}. Refer to https://aka.ms/pww-reporting`,
|
|
69
70
|
},
|
|
70
71
|
UNABLE_TO_EXTRACT_WORKSPACE_ID: {
|
|
71
72
|
key: "UnableToExtractWorkspaceId",
|
|
@@ -73,11 +74,11 @@ export const ServiceErrorMessageConstants = {
|
|
|
73
74
|
},
|
|
74
75
|
REPORTER_REQUIRES_ENTRA_AUTH: {
|
|
75
76
|
key: "ReporterRequiresEntraAuth",
|
|
76
|
-
message: "
|
|
77
|
+
message: "Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.",
|
|
77
78
|
},
|
|
78
79
|
HTML_REPORTER_REQUIRED: {
|
|
79
80
|
key: "HtmlReporterRequired",
|
|
80
|
-
message: "
|
|
81
|
+
message: "Playwright Workspaces Reporter requires the 'html' reporter to be configured in your Playwright configuration. Please add the 'html' reporter before playwright workspace reporter to generate test reports that can be uploaded to Azure Storage. Example: reporter: [['html'], ['@azure/playwright/reporter']]",
|
|
81
82
|
},
|
|
82
83
|
WORKSPACE_METADATA_FETCH_FAILED: {
|
|
83
84
|
key: "WorkspaceMetadataFetchFailed",
|
|
@@ -85,7 +86,7 @@ export const ServiceErrorMessageConstants = {
|
|
|
85
86
|
},
|
|
86
87
|
WORKSPACE_REPORTING_DISABLED: {
|
|
87
88
|
key: "WorkspaceReportingDisabled",
|
|
88
|
-
message: "Playwright Workspaces reporting: DISABLED.
|
|
89
|
+
message: "Playwright Workspaces reporting: DISABLED. Reporting is not enabled for the Playwright Workspace. To learn more about how to enable reporting and link a storage account, refer to https://aka.ms/pww-reporting ",
|
|
89
90
|
},
|
|
90
91
|
UPLOAD_FAILED_FILES: {
|
|
91
92
|
key: "UploadFailedFiles",
|
|
@@ -132,5 +133,18 @@ export const ServiceErrorMessageConstants = {
|
|
|
132
133
|
message: "Failed to get workspace metadata",
|
|
133
134
|
formatWithError: (error) => error,
|
|
134
135
|
},
|
|
136
|
+
TEST_RUN_CREATION_FAILED: {
|
|
137
|
+
key: "TestRunCreationFailed",
|
|
138
|
+
message: "Failed to create test run. Test execution will continue.",
|
|
139
|
+
formatWithErrorDetails: (errorDetails) => `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`,
|
|
140
|
+
},
|
|
141
|
+
REPORTING_TEST_RUN_FAILED: {
|
|
142
|
+
key: "ReportingTestRunFailed",
|
|
143
|
+
message: "Test run creation failed during setup.",
|
|
144
|
+
},
|
|
145
|
+
REPORTER_REQUIRES_SERVICE_CONFIG: {
|
|
146
|
+
key: "ReporterRequiresServiceConfig",
|
|
147
|
+
message: "Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig.",
|
|
148
|
+
},
|
|
135
149
|
};
|
|
136
150
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,qCAAqC;KAC/C;IACD,gCAAgC,EAAE;QA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AAE;KACvE;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,gCAAgC;QACzC,iBAAiB,EAAE,CAAC,cAAsB,EAAE,SAAiB,EAAE,MAAc,EAAU,EAAE,CACvF,4CAA4C,cAAc,wBAAwB,SAAS,aAAa,MAAM,EAAE;KACnH;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,8BAA8B;QACnC,OAAO,EAAE,kCAAkC;QAC3C,eAAe,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK;KAClD;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions.\",\n },\n MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {\n key: \"MultipleSetupFilePlaywrightVersionError\",\n message:\n \"The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR: {\n key: \"NoAuthError\",\n message:\n \"Could not authenticate with the service. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message: \"The authentication token provided is invalid. Check the token and try again.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"Your authentication token has expired. Create a new token.\",\n },\n NO_CRED_ENTRA_AUTH_ERROR: {\n key: \"NoCredEntraAuthError\",\n message:\n \"Azure credentials not found when using Entra ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n FAILED_TO_CREATE_TEST_RUN: {\n key: \"FailedToCreateTestRun\",\n message:\n \"Failed to create the test run in the Playwright workspaces. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.`,\n },\n INVALID_PARAM_WITH_SERVICE_CONFIG: {\n key: \"InvalidParamWithServiceConfig\",\n message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,\n },\n INVALID_RUN_ID_FORMAT: {\n key: \"InvalidRunIdFormat\",\n message: \"The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID.\",\n },\n INVALID_AUTH_TYPE_ERROR: {\n key: \"InvalidAuthTypeError\",\n message: \"Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN.\",\n },\n FAILED_TO_GET_WORKSPACE_DETAILS: {\n key: \"FailedToGetWorkspaceDetails\",\n message: \"Failed to retrieve workspace details from the Playwright service.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`,\n },\n STORAGE_URI_NOT_FOUND: {\n key: \"StorageUriNotFound\",\n message: \"Storage Account is not linked with this Playwright Workspace.\",\n },\n STORAGE_AUTHORIZATION_FAILED: {\n key: \"StorageAuthorizationFailed\",\n message:\n \"This request is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to this storage account.\",\n },\n UNABLE_TO_EXTRACT_WORKSPACE_ID: {\n key: \"UnableToExtractWorkspaceId\",\n message: \"Unable to extract workspace ID from service URL\",\n },\n REPORTER_REQUIRES_ENTRA_AUTH: {\n key: \"ReporterRequiresEntraAuth\",\n message:\n \"The Azure Playwright Reporter can only be used with ENTRA_ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n HTML_REPORTER_REQUIRED: {\n key: \"HtmlReporterRequired\",\n message:\n \"The Azure Playwright Reporter requires the 'html' reporter to be configured in your Playwright configuration. Please add the HTML reporter to generate test reports that can be uploaded to Azure Storage. Example: reporter: [['html'], ['@azure/playwright/reporter']]\",\n },\n WORKSPACE_METADATA_FETCH_FAILED: {\n key: \"WorkspaceMetadataFetchFailed\",\n message:\n \"Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL.\",\n },\n WORKSPACE_REPORTING_DISABLED: {\n key: \"WorkspaceReportingDisabled\",\n message:\n \"Playwright Workspaces reporting: DISABLED. Please refer to https://aka.ms/pww-reporting for more information.\",\n },\n UPLOAD_FAILED_FILES: {\n key: \"UploadFailedFiles\",\n message: \"Upload failed: files could not be uploaded\",\n formatWithCount: (failed: number): string =>\n `Upload failed: ${failed} files could not be uploaded`,\n },\n PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {\n key: \"PlaywrightTestReportNotFound\",\n message: \"Playwright test report not found\",\n formatWithFolder: (folderName: string): string =>\n `Playwright test report not found: ${folderName}`,\n },\n REPORTING_ENABLED: {\n key: \"ReportingEnabled\",\n message: \"Playwright Workspaces reporting: ENABLED\",\n },\n COLLECTING_ARTIFACTS: {\n key: \"CollectingArtifacts\",\n message: \"Collecting artifacts: screenshots, videos, traces.\",\n },\n REPORTING_STATUS_SUCCESS: {\n key: \"ReportingStatusSuccess\",\n message: \"Reporting status: SUCCESS\",\n },\n REPORTING_STATUS_PARTIAL: {\n key: \"ReportingStatusPartial\",\n message: \"Reporting status: Partially Uploaded\",\n },\n REPORTING_STATUS_FAILED: {\n key: \"ReportingStatusFailed\",\n message: \"Reporting status: FAILED\",\n },\n TEST_REPORT_VIEW_URL: {\n key: \"TestReportViewUrl\",\n message: \"Published report URL: \",\n formatWithUrl: (url: string): string => `Published report URL: ${url}`,\n },\n UPLOADING_ARTIFACTS: {\n key: \"UploadingArtifacts\",\n message: \"Uploading artifacts to storage\",\n formatWithDetails: (storageAccount: string, container: string, folder: string): string =>\n `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`,\n },\n FAILED_TO_GET_WORKSPACE_METADATA: {\n key: \"FailedToGetWorkspaceMetadata\",\n message: \"Failed to get workspace metadata\",\n formatWithError: (error: string): string => error,\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/common/messages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,qCAAqC;KAC/C;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,0IAA0I;KAC7I;IACD,4CAA4C,EAAE;QAC5C,GAAG,EAAE,yCAAyC;QAC9C,OAAO,EACL,4IAA4I;KAC/I;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EACL,mHAAmH;KACtH;IACD,aAAa,EAAE;QACb,GAAG,EAAE,aAAa;QAClB,OAAO,EACL,uHAAuH;KAC1H;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,8EAA8E;KACxF;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,4DAA4D;KACtE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,sBAAsB;QAC3B,OAAO,EACL,8IAA8I;KACjJ;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,uBAAuB;QA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;KACrF;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,wCAAwC;KAClD;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,2GAA2G;KAC9G;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/pww/docs/supported-versions.\",\n },\n MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {\n key: \"MultipleSetupFilePlaywrightVersionError\",\n message:\n \"The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR: {\n key: \"NoAuthError\",\n message:\n \"Could not authenticate with the service. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message: \"The authentication token provided is invalid. Check the token and try again.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"Your authentication token has expired. Create a new token.\",\n },\n NO_CRED_ENTRA_AUTH_ERROR: {\n key: \"NoCredEntraAuthError\",\n message:\n \"Azure credentials not found when using Entra ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n FAILED_TO_CREATE_TEST_RUN: {\n key: \"FailedToCreateTestRun\",\n message:\n \"Failed to create the test run in the Playwright workspaces. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create the test run in the Playwright workspaces. Error: ${errorDetails}. Please refer to https://aka.ms/pww/docs/troubleshooting for more information.`,\n },\n INVALID_PARAM_WITH_SERVICE_CONFIG: {\n key: \"InvalidParamWithServiceConfig\",\n message: `Remove serviceAuth, runId, and runName from getConnectOptions when using createAzurePlaywrightConfig. Configure these options through createAzurePlaywrightConfig instead.`,\n },\n INVALID_RUN_ID_FORMAT: {\n key: \"InvalidRunIdFormat\",\n message: \"The Run ID must be a valid GUID format. Please provide a valid GUID for the Run ID.\",\n },\n INVALID_AUTH_TYPE_ERROR: {\n key: \"InvalidAuthTypeError\",\n message: \"Invalid authentication type specified. Please use either ENTRA_ID or ACCESS_TOKEN.\",\n },\n FAILED_TO_GET_WORKSPACE_DETAILS: {\n key: \"FailedToGetWorkspaceDetails\",\n message: \"Failed to retrieve workspace details from the Playwright service.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to retrieve workspace details from the Playwright service. Error: ${errorDetails}. Please verify your service URL and authentication credentials.`,\n },\n STORAGE_URI_NOT_FOUND: {\n key: \"StorageUriNotFound\",\n message: \"Storage Account is not linked with this Playwright Workspace.\",\n },\n STORAGE_AUTHORIZATION_FAILED: {\n key: \"StorageAuthorizationFailed\",\n message:\n \"The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account. Refer to https://aka.ms/pww-reporting\",\n formatWithStorageAccount: (storageAccountName: string): string =>\n `The user is not authorized to perform this operation. Please make sure you have the Storage Blob Data Contributor role assigned to the storage account - ${storageAccountName}. Refer to https://aka.ms/pww-reporting`,\n },\n UNABLE_TO_EXTRACT_WORKSPACE_ID: {\n key: \"UnableToExtractWorkspaceId\",\n message: \"Unable to extract workspace ID from service URL\",\n },\n REPORTER_REQUIRES_ENTRA_AUTH: {\n key: \"ReporterRequiresEntraAuth\",\n message:\n \"Playwright Workspaces Reporter can only be used with ENTRA_ID authentication. Please refer to https://aka.ms/pww/docs/authentication for more information.\",\n },\n HTML_REPORTER_REQUIRED: {\n key: \"HtmlReporterRequired\",\n message:\n \"Playwright Workspaces Reporter requires the 'html' reporter to be configured in your Playwright configuration. Please add the 'html' reporter before playwright workspace reporter to generate test reports that can be uploaded to Azure Storage. Example: reporter: [['html'], ['@azure/playwright/reporter']]\",\n },\n WORKSPACE_METADATA_FETCH_FAILED: {\n key: \"WorkspaceMetadataFetchFailed\",\n message:\n \"Failed to retrieve workspace configuration. Reporting will be disabled for this run. Please check your authentication credentials and service URL.\",\n },\n WORKSPACE_REPORTING_DISABLED: {\n key: \"WorkspaceReportingDisabled\",\n message:\n \"Playwright Workspaces reporting: DISABLED. Reporting is not enabled for the Playwright Workspace. To learn more about how to enable reporting and link a storage account, refer to https://aka.ms/pww-reporting \",\n },\n UPLOAD_FAILED_FILES: {\n key: \"UploadFailedFiles\",\n message: \"Upload failed: files could not be uploaded\",\n formatWithCount: (failed: number): string =>\n `Upload failed: ${failed} files could not be uploaded`,\n },\n PLAYWRIGHT_TEST_REPORT_NOT_FOUND: {\n key: \"PlaywrightTestReportNotFound\",\n message: \"Playwright test report not found\",\n formatWithFolder: (folderName: string): string =>\n `Playwright test report not found: ${folderName}`,\n },\n REPORTING_ENABLED: {\n key: \"ReportingEnabled\",\n message: \"Playwright Workspaces reporting: ENABLED\",\n },\n COLLECTING_ARTIFACTS: {\n key: \"CollectingArtifacts\",\n message: \"Collecting artifacts: screenshots, videos, traces.\",\n },\n REPORTING_STATUS_SUCCESS: {\n key: \"ReportingStatusSuccess\",\n message: \"Reporting status: SUCCESS\",\n },\n REPORTING_STATUS_PARTIAL: {\n key: \"ReportingStatusPartial\",\n message: \"Reporting status: Partially Uploaded\",\n },\n REPORTING_STATUS_FAILED: {\n key: \"ReportingStatusFailed\",\n message: \"Reporting status: FAILED\",\n },\n TEST_REPORT_VIEW_URL: {\n key: \"TestReportViewUrl\",\n message: \"Published report URL: \",\n formatWithUrl: (url: string): string => `Published report URL: ${url}`,\n },\n UPLOADING_ARTIFACTS: {\n key: \"UploadingArtifacts\",\n message: \"Uploading artifacts to storage\",\n formatWithDetails: (storageAccount: string, container: string, folder: string): string =>\n `Uploading artifacts to: storage account= ${storageAccount}, storage container= ${container}, folder= ${folder}`,\n },\n FAILED_TO_GET_WORKSPACE_METADATA: {\n key: \"FailedToGetWorkspaceMetadata\",\n message: \"Failed to get workspace metadata\",\n formatWithError: (error: string): string => error,\n },\n TEST_RUN_CREATION_FAILED: {\n key: \"TestRunCreationFailed\",\n message: \"Failed to create test run. Test execution will continue.\",\n formatWithErrorDetails: (errorDetails: string): string =>\n `Failed to create test run. Error: ${errorDetails}. Test execution will continue.`,\n },\n REPORTING_TEST_RUN_FAILED: {\n key: \"ReportingTestRunFailed\",\n message: \"Test run creation failed during setup.\",\n },\n REPORTER_REQUIRES_SERVICE_CONFIG: {\n key: \"ReporterRequiresServiceConfig\",\n message:\n \"Playwright Workspaces Reporter requires the use of service configuration via createAzurePlaywrightConfig.\",\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializePlaywrightServiceTestRun.d.ts","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnD;;;;;GAKG;AACH,wBAAsB,kCAAkC,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"initializePlaywrightServiceTestRun.d.ts","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnD;;;;;GAKG;AACH,wBAAsB,kCAAkC,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAe1F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
3
|
+
import { PlaywrightServiceClient } from "../utils/PlaywrightServiceClient.js";
|
|
4
4
|
import { PlaywrightServiceConfig } from "../common/playwrightServiceConfig.js";
|
|
5
5
|
import { getTestRunConfig } from "../utils/utils.js";
|
|
6
6
|
import { CIInfoProvider } from "../utils/cIInfoProvider.js";
|
|
@@ -11,9 +11,9 @@ import { CIInfoProvider } from "../utils/cIInfoProvider.js";
|
|
|
11
11
|
* @returns Promise that resolves when service initialization is complete
|
|
12
12
|
*/
|
|
13
13
|
export async function initializePlaywrightServiceTestRun(config) {
|
|
14
|
-
const playwrightServiceApiClient = new
|
|
15
|
-
const ciConfigInfo = CIInfoProvider.getCIInfo();
|
|
14
|
+
const playwrightServiceApiClient = new PlaywrightServiceClient();
|
|
16
15
|
const playwrightServiceConfig = PlaywrightServiceConfig.instance;
|
|
16
|
+
const ciConfigInfo = CIInfoProvider.getCIInfo();
|
|
17
17
|
const testRunCreatePayload = {
|
|
18
18
|
displayName: playwrightServiceConfig.runName === ""
|
|
19
19
|
? playwrightServiceConfig.runId
|
|
@@ -21,7 +21,6 @@ export async function initializePlaywrightServiceTestRun(config) {
|
|
|
21
21
|
config: getTestRunConfig(config),
|
|
22
22
|
ciConfig: ciConfigInfo,
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
await playwrightServiceApiClient.patchTestRunAPI(testRunCreatePayload);
|
|
24
|
+
await playwrightServiceApiClient.createOrUpdateTestRun(testRunCreatePayload);
|
|
26
25
|
}
|
|
27
26
|
//# sourceMappingURL=initializePlaywrightServiceTestRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializePlaywrightServiceTestRun.js","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"initializePlaywrightServiceTestRun.js","sourceRoot":"","sources":["../../../src/core/initializePlaywrightServiceTestRun.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,MAAkB;IACzE,MAAM,0BAA0B,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACjE,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;IACjE,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;IAEhD,MAAM,oBAAoB,GAAG;QAC3B,WAAW,EACT,uBAAuB,CAAC,OAAO,KAAK,EAAE;YACpC,CAAC,CAAC,uBAAuB,CAAC,KAAK;YAC/B,CAAC,CAAC,uBAAuB,CAAC,OAAO;QACrC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,YAAY;KACvB,CAAC;IAEF,MAAM,0BAA0B,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FullConfig } from \"@playwright/test\";\nimport { PlaywrightServiceClient } from \"../utils/PlaywrightServiceClient.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { getTestRunConfig } from \"../utils/utils.js\";\nimport { CIInfoProvider } from \"../utils/cIInfoProvider.js\";\n\n/**\n * Initializes the Playwright workspaces by setting up authentication and creating a test run.\n *\n * @param config - The full Playwright configuration\n * @returns Promise that resolves when service initialization is complete\n */\nexport async function initializePlaywrightServiceTestRun(config: FullConfig): Promise<void> {\n const playwrightServiceApiClient = new PlaywrightServiceClient();\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n const ciConfigInfo = CIInfoProvider.getCIInfo();\n\n const testRunCreatePayload = {\n displayName:\n playwrightServiceConfig.runName === \"\"\n ? playwrightServiceConfig.runId\n : playwrightServiceConfig.runName,\n config: getTestRunConfig(config),\n ciConfig: ciConfigInfo,\n };\n\n await playwrightServiceApiClient.createOrUpdateTestRun(testRunCreatePayload);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightReporter.d.ts","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAUtE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,QAAQ;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,kBAAkB,CAAS;IAEnC;;;;OAIG;IAEG,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"playwrightReporter.d.ts","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAUtE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,QAAQ;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,kBAAkB,CAAS;IAEnC;;;;OAIG;IAEG,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA8DhD;;OAEG;IAEG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAiCd,gBAAgB;IAsB9B,OAAO,CAAC,iCAAiC;CAuC1C"}
|