@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
|
@@ -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,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,+BAA+B,EAAE,iCAAiC;IAClE,sBAAsB,E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AAG,IAAI;IACtC,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAC/B,iCAAiC,EAAE,QAAQ;IAC3C,gBAAgB,EAAE,YAAY;IAC9B,iBAAiB,EAAE,KAAK;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,oBAAoB,EAAE,uBAAuB;IAC7C,eAAe,EAAE,kBAAkB;IACnC,kBAAkB,EAAE,qBAAqB;IACzC,6BAA6B,EAAE,gCAAgC;IAC/D,cAAc,EAAE,iBAAiB;IACjC,uBAAuB,EAAE,0BAA0B;IACnD,oBAAoB,EAAE,uBAAuB;IAC7C,yBAAyB,EAAE,gCAAgC;CAC5D,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,oBAAoB,EAAE,IAAI,GAAG,IAAI;IACjC,oBAAoB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACvC,gBAAgB,EAAE,EAAE;IACpB,eAAe,EAAE,EAAE;IACnB,oBAAoB,EAAE,EAAE;IACxB,sBAAsB,EAAE,CAAC;IACzB,UAAU,EAAE,GAAG;IACf,oBAAoB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IACrC,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IACnC,kBAAkB,EAAE,CAAC;IACrB,gBAAgB,EAAE,IAAI;CACvB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Azure Playwright cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Azure Playwright\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Azure Playwright\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n};\n\nexport const GitHubActionsConstants = {\n GIT_VERSION_COMMAND: \"git --version\",\n GIT_REV_PARSE: \"git rev-parse --is-inside-work-tree\",\n GIT_COMMIT_MESSAGE_COMMAND: 'git log -1 --pretty=format:\"%s\"',\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n DEFAULT_SERVICE_AUTH_TYPE: ServiceAuth.ENTRA_ID,\n};\n\nexport const SDKLanguage = {\n JAVASCRIPT: \"JAVASCRIPT\",\n TYPESCRIPT: \"TYPESCRIPT\",\n CSHARP: \"CSHARP\",\n};\n\nexport const RunConfigConstants = {\n TEST_FRAMEWORK_NAME: \"PLAYWRIGHT\",\n TEST_SDK_LANGUAGE: SDKLanguage.JAVASCRIPT,\n TEST_FRAMEWORK_RUNNERNAME: \"PLAYWRIGHT\",\n};\n\nexport const Constants = {\n SevenDaysInMS: 7 * 24 * 60 * 60 * 1000,\n OneDayInMS: 24 * 60 * 60 * 1000,\n MinimumSupportedPlaywrightVersion: \"1.47.0\",\n LatestAPIVersion: \"2025-09-01\",\n HTTP_CALL_TIMEOUT: 10000,\n};\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_SERVICE_RUN_NAME: \"_MPT_SERVICE_RUN_NAME\",\n MPT_API_VERSION: \"_MPT_API_VERSION\",\n MPT_SERVICE_RUN_ID: \"_MPT_SERVICE_RUN_ID\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n MPT_SERVICE_OS: \"_MPT_SERVICE_OS\",\n ONE_TIME_OPERATION_FLAG: \"_ONE_TIME_OPERATION_FLAG\",\n USING_SERVICE_CONFIG: \"_USING_SERVICE_CONFIG\",\n 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;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,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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;QAC5B,OAAO,EACL,2IAA2I;QAC7I,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,sEAAsE,YAAY,iFAAiF;KACtK;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EAAE,4KAA4K;KACtL;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,qFAAqF;KAC/F;IACD,uB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CAA0C;KACpD;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,qBAAqB;QAC1B,OAAO,EAAE,oDAAoD;KAC9D;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,2BAA2B;KACrC;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE,sCAAsC;KAChD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,0BAA0B;KACpC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EAAE,wBAAwB;QACjC,aAAa,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,yBAAyB,GAAG,EAAE;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;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,0DAA0D;QACnE,sBAAsB,EAAE,CAAC,YAAoB,EAAU,EAAE,CACvD,qCAAqC,YAAY,iCAAiC;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"}
|
|
@@ -2,9 +2,9 @@ import { PlaywrightReporterStorageManager } from "../utils/playwrightReporterSto
|
|
|
2
2
|
import { getHtmlReporterOutputFolder, getPortalTestRunUrl } from "../utils/utils.js";
|
|
3
3
|
import { coreLogger } from "../common/logger.js";
|
|
4
4
|
import { PlaywrightServiceConfig } from "../common/playwrightServiceConfig.js";
|
|
5
|
-
import { ServiceAuth } from "../common/constants.js";
|
|
5
|
+
import { ServiceAuth, InternalEnvironmentVariables } from "../common/constants.js";
|
|
6
6
|
import { ServiceErrorMessageConstants } from "../common/messages.js";
|
|
7
|
-
import {
|
|
7
|
+
import { PlaywrightServiceClient } from "../utils/PlaywrightServiceClient.js";
|
|
8
8
|
/**
|
|
9
9
|
* Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.
|
|
10
10
|
*/
|
|
@@ -20,6 +20,22 @@ export default class PlaywrightReporter {
|
|
|
20
20
|
async onBegin(config) {
|
|
21
21
|
coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);
|
|
22
22
|
this.config = config;
|
|
23
|
+
// Check if using service config
|
|
24
|
+
const usingServiceConfig = process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === "true";
|
|
25
|
+
coreLogger.info(`Using service config: ${usingServiceConfig}`);
|
|
26
|
+
if (!usingServiceConfig) {
|
|
27
|
+
console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_SERVICE_CONFIG.message);
|
|
28
|
+
this.isReportingEnabled = false;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Check if test run creation was successful
|
|
32
|
+
const testRunCreationSuccess = process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] === "true";
|
|
33
|
+
if (!testRunCreationSuccess) {
|
|
34
|
+
console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);
|
|
35
|
+
console.error(ServiceErrorMessageConstants.REPORTING_TEST_RUN_FAILED.message);
|
|
36
|
+
this.isReportingEnabled = false;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
23
39
|
// Check authentication
|
|
24
40
|
const playwrightServiceConfig = PlaywrightServiceConfig.instance;
|
|
25
41
|
coreLogger.info(`Current authentication type: ${playwrightServiceConfig.serviceAuthType}`);
|
|
@@ -32,11 +48,10 @@ export default class PlaywrightReporter {
|
|
|
32
48
|
coreLogger.info("Authentication validation passed - using ENTRA_ID");
|
|
33
49
|
// Get workspace metadata for later use
|
|
34
50
|
try {
|
|
35
|
-
const playwrightServiceApiClient = new
|
|
51
|
+
const playwrightServiceApiClient = new PlaywrightServiceClient();
|
|
36
52
|
this.workspaceMetadata = await playwrightServiceApiClient.getWorkspaceMetadata();
|
|
37
53
|
if (!this.workspaceMetadata?.storageUri) {
|
|
38
54
|
console.error(ServiceErrorMessageConstants.WORKSPACE_REPORTING_DISABLED.message);
|
|
39
|
-
console.error(ServiceErrorMessageConstants.STORAGE_URI_NOT_FOUND.message);
|
|
40
55
|
this.isReportingEnabled = false;
|
|
41
56
|
return;
|
|
42
57
|
}
|
|
@@ -110,21 +125,29 @@ export default class PlaywrightReporter {
|
|
|
110
125
|
this.isReportingEnabled = false;
|
|
111
126
|
return;
|
|
112
127
|
}
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
const htmlReporterIndex = config.reporter.findIndex((reporter) => {
|
|
129
|
+
const reporterName = typeof reporter === "string" ? reporter : reporter?.[0];
|
|
130
|
+
return reporterName === "html";
|
|
131
|
+
});
|
|
132
|
+
const azureReporterIndex = config.reporter.findIndex((reporter) => {
|
|
133
|
+
const reporterName = typeof reporter === "string" ? reporter : reporter?.[0];
|
|
134
|
+
return (typeof reporterName === "string" &&
|
|
135
|
+
reporterName.includes("playwright") &&
|
|
136
|
+
reporterName.includes("reporter"));
|
|
121
137
|
});
|
|
122
|
-
|
|
138
|
+
// Validate HTML reporter exists
|
|
139
|
+
if (htmlReporterIndex === -1) {
|
|
140
|
+
console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);
|
|
141
|
+
this.isReportingEnabled = false;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Validate HTML reporter comes before Azure reporter (if Azure reporter exists)
|
|
145
|
+
if (azureReporterIndex !== -1 && htmlReporterIndex > azureReporterIndex) {
|
|
123
146
|
console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);
|
|
124
147
|
this.isReportingEnabled = false;
|
|
125
148
|
return;
|
|
126
149
|
}
|
|
127
|
-
coreLogger.info("HTML reporter validation passed - HTML reporter is configured");
|
|
150
|
+
coreLogger.info("HTML reporter validation passed - HTML reporter is configured and properly ordered");
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
153
|
//# sourceMappingURL=playwrightReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightReporter.js","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC7B,MAAM,CAAyB;IAC/B,iBAAiB,GAA6B,IAAI,CAAC;IACnD,kBAAkB,GAAG,KAAK,CAAC;IAEnC;;;;OAIG;IAEH,KAAK,CAAC,OAAO,CAAC,MAAkB;QAC9B,UAAU,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAEvF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,uBAAuB;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AC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxD,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,OAAO,QAAQ,KAAK,MAAM,CAAC;YAC7B,CAAC;YACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnD,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;YAChC,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { FullConfig, Reporter } from \"@playwright/test/reporter\";\nimport { PlaywrightReporterStorageManager } from \"../utils/playwrightReporterStorageManager.js\";\nimport { getHtmlReporterOutputFolder, getPortalTestRunUrl } from \"../utils/utils.js\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { ServiceAuth } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { PlaywrightServiceApiCall } from \"../utils/playwrightServiceApicall.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\n/**\n * Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.\n */\n\nexport default class PlaywrightReporter implements Reporter {\n private config: FullConfig | undefined;\n private workspaceMetadata: WorkspaceMetaData | null = null;\n private isReportingEnabled = false;\n\n /**\n * Called when test run begins. Stores configuration for later use and validates serviceAuthType and\n * retrieves workspace metadata.\n * @param config - Playwright test configuration\n */\n\n async onBegin(config: FullConfig): Promise<void> {\n coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);\n\n this.config = config;\n\n // Check authentication\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n coreLogger.info(`Current authentication type: ${playwrightServiceConfig.serviceAuthType}`);\n const isUsingAccessToken = playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN;\n if (isUsingAccessToken) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_ENTRA_AUTH.message);\n this.isReportingEnabled = false;\n return;\n }\n coreLogger.info(\"Authentication validation passed - using ENTRA_ID\");\n\n // Get workspace metadata for later use\n try {\n const playwrightServiceApiClient = new PlaywrightServiceApiCall();\n this.workspaceMetadata = await playwrightServiceApiClient.getWorkspaceMetadata();\n\n if (!this.workspaceMetadata?.storageUri) {\n console.error(ServiceErrorMessageConstants.WORKSPACE_REPORTING_DISABLED.message);\n console.error(ServiceErrorMessageConstants.STORAGE_URI_NOT_FOUND.message);\n this.isReportingEnabled = false;\n return;\n }\n\n this.isReportingEnabled = true;\n\n this.validateHtmlReporterConfiguration(config);\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.REPORTING_ENABLED.message);\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\n `${ServiceErrorMessageConstants.WORKSPACE_METADATA_FETCH_FAILED.message}Error: ${errorMessage} `,\n );\n this.isReportingEnabled = false;\n }\n }\n\n /**\n * Called when test run ends. Uploads Playwright test report to Azure Storage if reporting is enabled.\n */\n\n async onEnd(): Promise<void> {\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.COLLECTING_ARTIFACTS.message);\n const uploadResult = await this.uploadHtmlReport();\n\n if (uploadResult.success) {\n if (\n uploadResult.partialSuccess &&\n uploadResult.failedFileDetails &&\n uploadResult.failedFileDetails.length > 0\n ) {\n console.log(\"Warning: Failed to upload the following files:\");\n uploadResult.failedFileDetails.forEach((fileDetail) => {\n console.log(` - ${fileDetail.fileName}, ERROR: ${fileDetail.error}`);\n });\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_PARTIAL.message);\n } else {\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_SUCCESS.message);\n }\n // Display portal URL for both full and partial success\n if (this.workspaceMetadata) {\n const portalUrl = getPortalTestRunUrl(this.workspaceMetadata);\n console.log(ServiceErrorMessageConstants.TEST_REPORT_VIEW_URL.formatWithUrl(portalUrl));\n }\n } else {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n if (uploadResult.errorMessage) {\n console.error(`Error: ${uploadResult.errorMessage}`);\n }\n }\n }\n }\n\n private async uploadHtmlReport(): Promise<UploadResult> {\n try {\n const outputFolder = getHtmlReporterOutputFolder(this.config);\n coreLogger.info(`Resolved Playwright test report output folder: ${outputFolder}`);\n const storageManager = new PlaywrightReporterStorageManager();\n coreLogger.info(\"Starting Playwright test report upload process\");\n const uploadResult = await storageManager.uploadPlaywrightHtmlReportAfterTests(\n outputFolder,\n this.workspaceMetadata,\n );\n\n if (uploadResult.success) {\n coreLogger.info(`Playwright Test report uploaded successfully to Azure Storage.`);\n }\n return uploadResult;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n private validateHtmlReporterConfiguration(config: FullConfig): void {\n if (!config.reporter || !Array.isArray(config.reporter)) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n const hasHtmlReporter = config.reporter.some((reporter) => {\n if (typeof reporter === \"string\") {\n return reporter === \"html\";\n }\n if (Array.isArray(reporter) && reporter.length > 0) {\n return reporter[0] === \"html\";\n }\n return false;\n });\n\n if (!hasHtmlReporter) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n coreLogger.info(\"HTML reporter validation passed - HTML reporter is configured\");\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"playwrightReporter.js","sourceRoot":"","sources":["../../../src/reporter/playwrightReporter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC7B,MAAM,CAAyB;IAC/B,iBAAiB,GAA6B,IAAI,CAAC;IACnD,kBAAkB,GAAG,KAAK,CAAC;IAEnC;;;;OAIG;IAEH,KAAK,CAAC,OAAO,CAAC,MAAkB;QAC9B,UAAU,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAEvF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,gCAAgC;QAChC,MAAM,kBAAkB,GACtB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CA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AC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7E,OAAO,CACL,OAAO,YAAY,KAAK,QAAQ;gBAChC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC;gBACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAClC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,gCAAgC;QAChC,IAAI,iBAAiB,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,gFAAgF;QAChF,IAAI,kBAAkB,KAAK,CAAC,CAAC,IAAI,iBAAiB,GAAG,kBAAkB,EAAE,CAAC;YACxE,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAC3E,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { FullConfig, Reporter } from \"@playwright/test/reporter\";\nimport { PlaywrightReporterStorageManager } from \"../utils/playwrightReporterStorageManager.js\";\nimport { getHtmlReporterOutputFolder, getPortalTestRunUrl } from \"../utils/utils.js\";\nimport { coreLogger } from \"../common/logger.js\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig.js\";\nimport { ServiceAuth, InternalEnvironmentVariables } from \"../common/constants.js\";\nimport { ServiceErrorMessageConstants } from \"../common/messages.js\";\nimport { PlaywrightServiceClient } from \"../utils/PlaywrightServiceClient.js\";\nimport type { WorkspaceMetaData, UploadResult } from \"../common/types.js\";\n\n/**\n * Azure Playwright Reporter - Uploads generated Playwright test report folder to Azure Storage.\n */\n\nexport default class PlaywrightReporter implements Reporter {\n private config: FullConfig | undefined;\n private workspaceMetadata: WorkspaceMetaData | null = null;\n private isReportingEnabled = false;\n\n /**\n * Called when test run begins. Stores configuration for later use and validates serviceAuthType and\n * retrieves workspace metadata.\n * @param config - Playwright test configuration\n */\n\n async onBegin(config: FullConfig): Promise<void> {\n coreLogger.info(`Reporter configuration: ${JSON.stringify(config.reporter, null, 2)}`);\n\n this.config = config;\n\n // Check if using service config\n const usingServiceConfig =\n process.env[InternalEnvironmentVariables.USING_SERVICE_CONFIG] === \"true\";\n coreLogger.info(`Using service config: ${usingServiceConfig}`);\n if (!usingServiceConfig) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_SERVICE_CONFIG.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check if test run creation was successful\n const testRunCreationSuccess =\n process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] === \"true\";\n if (!testRunCreationSuccess) {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n console.error(ServiceErrorMessageConstants.REPORTING_TEST_RUN_FAILED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Check authentication\n const playwrightServiceConfig = PlaywrightServiceConfig.instance;\n coreLogger.info(`Current authentication type: ${playwrightServiceConfig.serviceAuthType}`);\n const isUsingAccessToken = playwrightServiceConfig.serviceAuthType === ServiceAuth.ACCESS_TOKEN;\n if (isUsingAccessToken) {\n console.error(ServiceErrorMessageConstants.REPORTER_REQUIRES_ENTRA_AUTH.message);\n this.isReportingEnabled = false;\n return;\n }\n coreLogger.info(\"Authentication validation passed - using ENTRA_ID\");\n\n // Get workspace metadata for later use\n try {\n const playwrightServiceApiClient = new PlaywrightServiceClient();\n this.workspaceMetadata = await playwrightServiceApiClient.getWorkspaceMetadata();\n\n if (!this.workspaceMetadata?.storageUri) {\n console.error(ServiceErrorMessageConstants.WORKSPACE_REPORTING_DISABLED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n this.isReportingEnabled = true;\n\n this.validateHtmlReporterConfiguration(config);\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.REPORTING_ENABLED.message);\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\n `${ServiceErrorMessageConstants.WORKSPACE_METADATA_FETCH_FAILED.message}Error: ${errorMessage} `,\n );\n this.isReportingEnabled = false;\n }\n }\n\n /**\n * Called when test run ends. Uploads Playwright test report to Azure Storage if reporting is enabled.\n */\n\n async onEnd(): Promise<void> {\n if (this.isReportingEnabled) {\n console.log(ServiceErrorMessageConstants.COLLECTING_ARTIFACTS.message);\n const uploadResult = await this.uploadHtmlReport();\n\n if (uploadResult.success) {\n if (\n uploadResult.partialSuccess &&\n uploadResult.failedFileDetails &&\n uploadResult.failedFileDetails.length > 0\n ) {\n console.log(\"Warning: Failed to upload the following files:\");\n uploadResult.failedFileDetails.forEach((fileDetail) => {\n console.log(` - ${fileDetail.fileName}, ERROR: ${fileDetail.error}`);\n });\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_PARTIAL.message);\n } else {\n console.log(ServiceErrorMessageConstants.REPORTING_STATUS_SUCCESS.message);\n }\n // Display portal URL for both full and partial success\n if (this.workspaceMetadata) {\n const portalUrl = getPortalTestRunUrl(this.workspaceMetadata);\n console.log(ServiceErrorMessageConstants.TEST_REPORT_VIEW_URL.formatWithUrl(portalUrl));\n }\n } else {\n console.error(ServiceErrorMessageConstants.REPORTING_STATUS_FAILED.message);\n if (uploadResult.errorMessage) {\n console.error(`Error: ${uploadResult.errorMessage}`);\n }\n }\n }\n }\n\n private async uploadHtmlReport(): Promise<UploadResult> {\n try {\n const outputFolder = getHtmlReporterOutputFolder(this.config);\n coreLogger.info(`Resolved Playwright test report output folder: ${outputFolder}`);\n const storageManager = new PlaywrightReporterStorageManager();\n coreLogger.info(\"Starting Playwright test report upload process\");\n const uploadResult = await storageManager.uploadPlaywrightHtmlReportAfterTests(\n outputFolder,\n this.workspaceMetadata,\n );\n\n if (uploadResult.success) {\n coreLogger.info(`Playwright Test report uploaded successfully to Azure Storage.`);\n }\n return uploadResult;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n coreLogger.error(`Upload failed: ${errorMessage}`);\n return { success: false, errorMessage };\n }\n }\n\n private validateHtmlReporterConfiguration(config: FullConfig): void {\n if (!config.reporter || !Array.isArray(config.reporter)) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n const htmlReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return reporterName === \"html\";\n });\n\n const azureReporterIndex = config.reporter.findIndex((reporter) => {\n const reporterName = typeof reporter === \"string\" ? reporter : reporter?.[0];\n return (\n typeof reporterName === \"string\" &&\n reporterName.includes(\"playwright\") &&\n reporterName.includes(\"reporter\")\n );\n });\n\n // Validate HTML reporter exists\n if (htmlReporterIndex === -1) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n // Validate HTML reporter comes before Azure reporter (if Azure reporter exists)\n if (azureReporterIndex !== -1 && htmlReporterIndex > azureReporterIndex) {\n console.error(ServiceErrorMessageConstants.HTML_REPORTER_REQUIRED.message);\n this.isReportingEnabled = false;\n return;\n }\n\n coreLogger.info(\n \"HTML reporter validation passed - HTML reporter is configured and properly ordered\",\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpService } from "../common/httpService.js";
|
|
2
|
+
import { TestRunCreatePayload, WorkspaceMetaData } from "../common/types.js";
|
|
3
|
+
export declare class PlaywrightServiceClient {
|
|
4
|
+
private httpService;
|
|
5
|
+
constructor(httpService?: HttpService);
|
|
6
|
+
createOrUpdateTestRun(payload: TestRunCreatePayload): Promise<void>;
|
|
7
|
+
getWorkspaceMetadata(): Promise<WorkspaceMetaData>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=PlaywrightServiceClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaywrightServiceClient.d.ts","sourceRoot":"","sources":["../../../src/utils/PlaywrightServiceClient.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG7E,qBAAa,uBAAuB;IAClC,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,CAAC,EAAE,WAAW;IAI/B,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CnE,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAsCzD"}
|
package/dist/{esm/utils/playwrightServiceApicall.js → browser/utils/PlaywrightServiceClient.js}
RENAMED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { getTestRunApiUrl, getAccessToken, extractErrorMessage, getWorkspaceMetaDataApiUrl,
|
|
3
|
+
import { getTestRunApiUrl, getAccessToken, extractErrorMessage, getWorkspaceMetaDataApiUrl, } from "./utils.js";
|
|
4
4
|
import { ServiceErrorMessageConstants } from "../common/messages.js";
|
|
5
5
|
import { HttpService } from "../common/httpService.js";
|
|
6
|
-
import { Constants } from "../common/constants.js";
|
|
7
|
-
|
|
8
|
-
* Makes a PATCH call to the Playwright workspaces Test Run API to create or update a test run.
|
|
9
|
-
*
|
|
10
|
-
* @param payload - The request payload (displayName, config, ciConfig, etc.).
|
|
11
|
-
* @returns The parsed JSON response from the API.
|
|
12
|
-
* @throws If the API call fails (non-2xx response).
|
|
13
|
-
*/
|
|
14
|
-
export class PlaywrightServiceApiCall {
|
|
6
|
+
import { Constants, InternalEnvironmentVariables } from "../common/constants.js";
|
|
7
|
+
export class PlaywrightServiceClient {
|
|
15
8
|
httpService;
|
|
16
9
|
constructor(httpService) {
|
|
17
10
|
this.httpService = httpService ?? new HttpService();
|
|
18
11
|
}
|
|
19
|
-
async
|
|
12
|
+
async createOrUpdateTestRun(payload) {
|
|
20
13
|
try {
|
|
21
14
|
const baseUrl = getTestRunApiUrl();
|
|
22
15
|
const token = getAccessToken();
|
|
@@ -32,14 +25,17 @@ export class PlaywrightServiceApiCall {
|
|
|
32
25
|
const response = await this.httpService.callAPI(method, url.toString(), data, token, contentType, correlationId);
|
|
33
26
|
if (response.status !== 200) {
|
|
34
27
|
const errorMessage = extractErrorMessage(response?.bodyAsText ?? "");
|
|
35
|
-
|
|
28
|
+
process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "false";
|
|
29
|
+
console.error(ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(errorMessage || "Unknown error"));
|
|
30
|
+
return;
|
|
36
31
|
}
|
|
37
32
|
console.log("Test run created successfully.");
|
|
38
|
-
|
|
33
|
+
process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "true";
|
|
39
34
|
}
|
|
40
35
|
catch (error) {
|
|
41
36
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred during test run creation";
|
|
42
|
-
|
|
37
|
+
process.env[InternalEnvironmentVariables.TEST_RUN_CREATION_SUCCESS] = "false";
|
|
38
|
+
console.error(ServiceErrorMessageConstants.TEST_RUN_CREATION_FAILED.formatWithErrorDetails(errorMessage));
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
async getWorkspaceMetadata() {
|
|
@@ -56,7 +52,7 @@ export class PlaywrightServiceApiCall {
|
|
|
56
52
|
const response = await this.httpService.callAPI(method, url.toString(), null, token, "", correlationId);
|
|
57
53
|
if (response.status !== 200) {
|
|
58
54
|
const errorMessage = extractErrorMessage(response?.bodyAsText ?? "");
|
|
59
|
-
throw new Error(errorMessage || `HTTP ${response.status}: Failed to retrieve workspace details`);
|
|
55
|
+
throw new Error(ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.formatWithError(errorMessage || `HTTP ${response.status}: Failed to retrieve workspace details`));
|
|
60
56
|
}
|
|
61
57
|
return response.bodyAsText ? JSON.parse(response.bodyAsText) : {};
|
|
62
58
|
}
|
|
@@ -64,8 +60,8 @@ export class PlaywrightServiceApiCall {
|
|
|
64
60
|
if (error instanceof Error) {
|
|
65
61
|
throw error;
|
|
66
62
|
}
|
|
67
|
-
throw new Error(
|
|
63
|
+
throw new Error(ServiceErrorMessageConstants.FAILED_TO_GET_WORKSPACE_METADATA.message);
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
}
|
|
71
|
-
//# sourceMappingURL=
|
|
67
|
+
//# 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,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,OAAO,uBAAuB;IAC1B,WAAW,CAAc;IAEjC,YAAY,WAAyB;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,WAAW,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAA6B;QACvD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,EAAE,C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AAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF","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"}
|
|
@@ -22,6 +22,7 @@ export class PlaywrightReporterStorageManager {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
const blobServiceClient = new BlobServiceClient(workspaceDetails?.storageUri, credential);
|
|
25
|
+
coreLogger.info("blobServiceClient created successfully.");
|
|
25
26
|
const serviceUrlInfo = populateValuesFromServiceUrl();
|
|
26
27
|
if (!serviceUrlInfo?.accountId) {
|
|
27
28
|
coreLogger.error("Unable to extract workspace ID from service URL");
|
|
@@ -34,8 +35,12 @@ export class PlaywrightReporterStorageManager {
|
|
|
34
35
|
const containerClient = blobServiceClient.getContainerClient(containerName);
|
|
35
36
|
const containerExists = await containerClient.exists();
|
|
36
37
|
if (!containerExists) {
|
|
38
|
+
coreLogger.info(`Container ${containerName} does not exist. Creating new container.`);
|
|
37
39
|
await containerClient.create();
|
|
38
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
coreLogger.info(`Container ${containerName} already exists.`);
|
|
43
|
+
}
|
|
39
44
|
const folderName = runId;
|
|
40
45
|
const storageAccountName = getStorageAccountNameFromUri(workspaceDetails?.storageUri || "") || "unknown";
|
|
41
46
|
console.log(ServiceErrorMessageConstants.UPLOADING_ARTIFACTS.formatWithDetails(storageAccountName, containerName, folderName));
|
|
@@ -46,6 +51,16 @@ export class PlaywrightReporterStorageManager {
|
|
|
46
51
|
}
|
|
47
52
|
const failedFiles = uploadResults.totalFiles - uploadResults.uploadedFiles.length;
|
|
48
53
|
if (failedFiles > 0) {
|
|
54
|
+
if (uploadResults.failedFileDetails) {
|
|
55
|
+
const hasAuthorizationError = uploadResults.failedFileDetails.some((fileDetail) => fileDetail.error.includes("not authorized to perform this operation") ||
|
|
56
|
+
fileDetail.error.includes("AuthorizationFailure"));
|
|
57
|
+
if (hasAuthorizationError) {
|
|
58
|
+
return {
|
|
59
|
+
success: false,
|
|
60
|
+
errorMessage: ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.formatWithStorageAccount(storageAccountName),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
49
64
|
// Get list of failed file names by comparing total files with uploaded files
|
|
50
65
|
const uploadedSet = new Set(uploadResults.uploadedFiles);
|
|
51
66
|
const allFiles = collectAllFiles(outputFolder, outputFolder, folderName);
|
|
@@ -66,14 +81,6 @@ export class PlaywrightReporterStorageManager {
|
|
|
66
81
|
catch (error) {
|
|
67
82
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
68
83
|
coreLogger.error(`Failed to upload HTML report: ${error}`);
|
|
69
|
-
if (error instanceof Error &&
|
|
70
|
-
(error.message.includes("AuthorizationFailure") ||
|
|
71
|
-
error.message.includes("not authorized to perform this operation"))) {
|
|
72
|
-
return {
|
|
73
|
-
success: false,
|
|
74
|
-
errorMessage: ServiceErrorMessageConstants.STORAGE_AUTHORIZATION_FAILED.message,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
84
|
return { success: false, errorMessage };
|
|
78
85
|
}
|
|
79
86
|
}
|