@azure/playwright 1.1.2 → 1.1.3-alpha.20260310.1
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/types.d.ts +1 -1
- package/dist/browser/common/types.d.ts.map +1 -1
- package/dist/browser/common/types.js.map +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/utils/PlaywrightServiceClient.d.ts +1 -1
- package/dist/browser/utils/PlaywrightServiceClient.d.ts.map +1 -1
- package/dist/browser/utils/PlaywrightServiceClient.js.map +1 -1
- package/dist/browser/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/browser/utils/playwrightReporterStorageManager.js.map +1 -1
- package/dist/browser/utils/utils.d.ts +2 -2
- package/dist/browser/utils/utils.d.ts.map +1 -1
- package/dist/browser/utils/utils.js.map +1 -1
- package/dist/commonjs/common/constants.js +127 -95
- package/dist/commonjs/common/constants.js.map +7 -1
- package/dist/commonjs/common/customerConfig.js +31 -14
- package/dist/commonjs/common/customerConfig.js.map +7 -1
- package/dist/commonjs/common/entraIdAccessToken.js +106 -83
- package/dist/commonjs/common/entraIdAccessToken.js.map +7 -1
- package/dist/commonjs/common/environmentVariables.js +43 -24
- package/dist/commonjs/common/environmentVariables.js.map +7 -1
- package/dist/commonjs/common/executor.js +88 -67
- package/dist/commonjs/common/executor.js.map +7 -1
- package/dist/commonjs/common/httpService.js +54 -35
- package/dist/commonjs/common/httpService.js.map +7 -1
- package/dist/commonjs/common/logger.js +28 -8
- package/dist/commonjs/common/logger.js.map +7 -1
- package/dist/commonjs/common/messages.js +189 -169
- package/dist/commonjs/common/messages.js.map +7 -1
- package/dist/commonjs/common/playwrightServiceConfig.js +113 -98
- package/dist/commonjs/common/playwrightServiceConfig.js.map +7 -1
- package/dist/commonjs/common/state.js +30 -10
- package/dist/commonjs/common/state.js.map +7 -1
- package/dist/commonjs/common/types.d.ts +1 -1
- package/dist/commonjs/common/types.d.ts.map +1 -1
- package/dist/commonjs/common/types.js +15 -5
- package/dist/commonjs/common/types.js.map +7 -1
- package/dist/commonjs/core/global/playwright-service-global-setup.js +52 -26
- package/dist/commonjs/core/global/playwright-service-global-setup.js.map +7 -1
- package/dist/commonjs/core/global/playwright-service-global-teardown.js +49 -20
- package/dist/commonjs/core/global/playwright-service-global-teardown.js.map +7 -1
- package/dist/commonjs/core/initializePlaywrightServiceTestRun.js +39 -27
- package/dist/commonjs/core/initializePlaywrightServiceTestRun.js.map +7 -1
- package/dist/commonjs/core/playwrightService.js +166 -205
- package/dist/commonjs/core/playwrightService.js.map +7 -1
- package/dist/commonjs/core/playwrightServiceEntra.js +67 -48
- package/dist/commonjs/core/playwrightServiceEntra.js.map +7 -1
- package/dist/commonjs/core/playwrightServiceUtils.d.ts +1 -1
- package/dist/commonjs/core/playwrightServiceUtils.d.ts.map +1 -0
- package/dist/commonjs/core/playwrightServiceUtils.js +44 -11
- package/dist/commonjs/core/playwrightServiceUtils.js.map +7 -0
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +36 -18
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/reporter/index.js +34 -15
- package/dist/commonjs/reporter/index.js.map +7 -1
- package/dist/commonjs/reporter/playwrightReporter.js +222 -216
- package/dist/commonjs/reporter/playwrightReporter.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/PlaywrightServiceClient.d.ts +1 -1
- package/dist/commonjs/utils/PlaywrightServiceClient.d.ts.map +1 -1
- package/dist/commonjs/utils/PlaywrightServiceClient.js +140 -91
- package/dist/commonjs/utils/PlaywrightServiceClient.js.map +7 -1
- package/dist/commonjs/utils/cIInfoProvider.js +81 -74
- package/dist/commonjs/utils/cIInfoProvider.js.map +7 -1
- package/dist/commonjs/utils/getPackageVersion.d.ts +1 -1
- package/dist/commonjs/utils/getPackageVersion.d.ts.map +1 -0
- package/dist/commonjs/utils/getPackageVersion.js +50 -19
- package/dist/commonjs/utils/getPackageVersion.js.map +7 -0
- package/dist/commonjs/utils/getPlaywrightVersion.js +42 -21
- package/dist/commonjs/utils/getPlaywrightVersion.js.map +7 -1
- package/dist/commonjs/utils/packageManager.js +59 -40
- package/dist/commonjs/utils/packageManager.js.map +7 -1
- package/dist/commonjs/utils/parseJwt.js +37 -17
- package/dist/commonjs/utils/parseJwt.js.map +7 -1
- package/dist/commonjs/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/commonjs/utils/playwrightReporterStorageManager.js +381 -342
- package/dist/commonjs/utils/playwrightReporterStorageManager.js.map +7 -1
- package/dist/commonjs/utils/utils.d.ts +2 -2
- package/dist/commonjs/utils/utils.d.ts.map +1 -1
- package/dist/commonjs/utils/utils.js +417 -369
- package/dist/commonjs/utils/utils.js.map +7 -1
- package/dist/esm/common/constants.js +92 -92
- package/dist/esm/common/constants.js.map +7 -1
- package/dist/esm/common/customerConfig.js +11 -11
- package/dist/esm/common/customerConfig.js.map +7 -1
- package/dist/esm/common/entraIdAccessToken.js +85 -77
- package/dist/esm/common/entraIdAccessToken.js.map +7 -1
- package/dist/esm/common/environmentVariables.js +19 -19
- package/dist/esm/common/environmentVariables.js.map +7 -1
- package/dist/esm/common/executor.js +51 -58
- package/dist/esm/common/executor.js.map +7 -1
- package/dist/esm/common/httpService.js +34 -29
- package/dist/esm/common/httpService.js.map +7 -1
- package/dist/esm/common/logger.js +4 -4
- package/dist/esm/common/logger.js.map +7 -1
- package/dist/esm/common/messages.js +166 -166
- package/dist/esm/common/messages.js.map +7 -1
- package/dist/esm/common/playwrightServiceConfig.js +91 -91
- package/dist/esm/common/playwrightServiceConfig.js.map +7 -1
- package/dist/esm/common/state.js +7 -7
- package/dist/esm/common/state.js.map +7 -1
- package/dist/esm/common/types.d.ts +1 -1
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js +0 -4
- package/dist/esm/common/types.js.map +7 -1
- package/dist/esm/core/global/playwright-service-global-setup.js +17 -17
- package/dist/esm/core/global/playwright-service-global-setup.js.map +7 -1
- package/dist/esm/core/global/playwright-service-global-teardown.js +16 -13
- package/dist/esm/core/global/playwright-service-global-teardown.js.map +7 -1
- package/dist/esm/core/initializePlaywrightServiceTestRun.js +13 -21
- package/dist/esm/core/initializePlaywrightServiceTestRun.js.map +7 -1
- package/dist/esm/core/playwrightService.js +144 -195
- package/dist/esm/core/playwrightService.js.map +7 -1
- package/dist/esm/core/playwrightServiceEntra.js +44 -42
- package/dist/esm/core/playwrightServiceEntra.js.map +7 -1
- package/dist/esm/core/playwrightServiceUtils.js +6 -8
- package/dist/esm/core/playwrightServiceUtils.js.map +7 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -9
- package/dist/esm/index.js.map +7 -1
- package/dist/esm/reporter/index.js +4 -11
- package/dist/esm/reporter/index.js.map +7 -1
- package/dist/esm/reporter/playwrightReporter.js +202 -207
- package/dist/esm/reporter/playwrightReporter.js.map +7 -1
- package/dist/esm/utils/PlaywrightServiceClient.d.ts +1 -1
- package/dist/esm/utils/PlaywrightServiceClient.d.ts.map +1 -1
- package/dist/esm/utils/PlaywrightServiceClient.js +120 -85
- package/dist/esm/utils/PlaywrightServiceClient.js.map +7 -1
- package/dist/esm/utils/cIInfoProvider.js +58 -71
- package/dist/esm/utils/cIInfoProvider.js.map +7 -1
- package/dist/esm/utils/getPackageVersion.js +12 -17
- package/dist/esm/utils/getPackageVersion.js.map +7 -1
- package/dist/esm/utils/getPlaywrightVersion.js +15 -13
- package/dist/esm/utils/getPlaywrightVersion.js.map +7 -1
- package/dist/esm/utils/packageManager.js +37 -37
- package/dist/esm/utils/packageManager.js.map +7 -1
- package/dist/esm/utils/parseJwt.js +15 -14
- package/dist/esm/utils/parseJwt.js.map +7 -1
- package/dist/esm/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/esm/utils/playwrightReporterStorageManager.js +358 -333
- package/dist/esm/utils/playwrightReporterStorageManager.js.map +7 -1
- package/dist/esm/utils/utils.d.ts +2 -2
- package/dist/esm/utils/utils.d.ts.map +1 -1
- package/dist/esm/utils/utils.js +377 -350
- package/dist/esm/utils/utils.js.map +7 -1
- package/dist/react-native/common/types.d.ts +1 -1
- package/dist/react-native/common/types.d.ts.map +1 -1
- package/dist/react-native/common/types.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -1
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/utils/PlaywrightServiceClient.d.ts +1 -1
- package/dist/react-native/utils/PlaywrightServiceClient.d.ts.map +1 -1
- package/dist/react-native/utils/PlaywrightServiceClient.js.map +1 -1
- package/dist/react-native/utils/playwrightReporterStorageManager.d.ts.map +1 -1
- package/dist/react-native/utils/playwrightReporterStorageManager.js.map +1 -1
- package/dist/react-native/utils/utils.d.ts +2 -2
- package/dist/react-native/utils/utils.d.ts.map +1 -1
- package/dist/react-native/utils/utils.js.map +1 -1
- package/package.json +6 -24
- package/dist/commonjs/core/playwrightServiceUtils-cjs.cjs.map +0 -1
- package/dist/commonjs/core/playwrightServiceUtils-cjs.d.cts.map +0 -1
- package/dist/commonjs/utils/getPackageVersion-cjs.cjs.map +0 -1
- package/dist/commonjs/utils/getPackageVersion-cjs.d.cts.map +0 -1
|
@@ -1,441 +1,489 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
ValidateRunID: () => ValidateRunID,
|
|
31
|
+
calculateOptimalConcurrency: () => calculateOptimalConcurrency,
|
|
32
|
+
collectAllFiles: () => collectAllFiles,
|
|
33
|
+
exitWithFailureMessage: () => exitWithFailureMessage,
|
|
34
|
+
extractErrorMessage: () => extractErrorMessage,
|
|
35
|
+
fetchOrValidateAccessToken: () => fetchOrValidateAccessToken,
|
|
36
|
+
getAccessToken: () => getAccessToken,
|
|
37
|
+
getAndSetRunId: () => getAndSetRunId,
|
|
38
|
+
getContentType: () => getContentType,
|
|
39
|
+
getHtmlReporterOutputFolder: () => getHtmlReporterOutputFolder,
|
|
40
|
+
getPackageVersion: () => getPackageVersion,
|
|
41
|
+
getPlaywrightVersion: () => import_getPlaywrightVersion2.getPlaywrightVersion,
|
|
42
|
+
getPortalTestRunUrl: () => getPortalTestRunUrl,
|
|
43
|
+
getRunName: () => getRunName,
|
|
44
|
+
getServiceBaseURL: () => getServiceBaseURL,
|
|
45
|
+
getServiceWSEndpoint: () => getServiceWSEndpoint,
|
|
46
|
+
getStorageAccountNameFromUri: () => getStorageAccountNameFromUri,
|
|
47
|
+
getTestRunApiUrl: () => getTestRunApiUrl,
|
|
48
|
+
getTestRunConfig: () => getTestRunConfig,
|
|
49
|
+
getVersionInfo: () => getVersionInfo,
|
|
50
|
+
getWorkspaceMetaDataApiUrl: () => getWorkspaceMetaDataApiUrl,
|
|
51
|
+
isNullOrEmpty: () => isNullOrEmpty,
|
|
52
|
+
isValidGuid: () => isValidGuid,
|
|
53
|
+
parseJwt: () => import_parseJwt2.parseJwt,
|
|
54
|
+
populateValuesFromServiceUrl: () => populateValuesFromServiceUrl,
|
|
55
|
+
resolveTenantDomain: () => resolveTenantDomain,
|
|
56
|
+
throwErrorWithFailureMessage: () => throwErrorWithFailureMessage,
|
|
57
|
+
validateMptPAT: () => validateMptPAT,
|
|
58
|
+
validatePlaywrightVersion: () => validatePlaywrightVersion,
|
|
59
|
+
validateServiceUrl: () => validateServiceUrl,
|
|
60
|
+
warnIfAccessTokenCloseToExpiry: () => warnIfAccessTokenCloseToExpiry
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(utils_exports);
|
|
63
|
+
var import_constants = require("../common/constants.js");
|
|
64
|
+
var import_messages = require("../common/messages.js");
|
|
65
|
+
var import_logger = require("../common/logger.js");
|
|
66
|
+
var import_node_process = __toESM(require("node:process"));
|
|
67
|
+
var import_node_crypto = require("node:crypto");
|
|
68
|
+
var import_parseJwt = require("./parseJwt.js");
|
|
69
|
+
var import_getPlaywrightVersion = require("./getPlaywrightVersion.js");
|
|
70
|
+
var import_entraIdAccessToken = require("../common/entraIdAccessToken.js");
|
|
71
|
+
var import_cIInfoProvider = require("./cIInfoProvider.js");
|
|
72
|
+
var import_child_process = require("child_process");
|
|
73
|
+
var import_getPackageVersion = require("./getPackageVersion.js");
|
|
74
|
+
var import_fs = require("fs");
|
|
75
|
+
var import_path = require("path");
|
|
76
|
+
var import_constants2 = require("../common/constants.js");
|
|
77
|
+
var import_getPlaywrightVersion2 = require("./getPlaywrightVersion.js");
|
|
78
|
+
var import_parseJwt2 = require("./parseJwt.js");
|
|
37
79
|
const getPackageVersion = () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return srcVersion;
|
|
48
|
-
}
|
|
49
|
-
return "unknown-version";
|
|
80
|
+
const distVersion = (0, import_getPackageVersion.getPackageVersionFromFolder)("../../../");
|
|
81
|
+
if (distVersion) {
|
|
82
|
+
return distVersion;
|
|
83
|
+
}
|
|
84
|
+
const srcVersion = (0, import_getPackageVersion.getPackageVersionFromFolder)("../../");
|
|
85
|
+
if (srcVersion) {
|
|
86
|
+
return srcVersion;
|
|
87
|
+
}
|
|
88
|
+
return "unknown-version";
|
|
50
89
|
};
|
|
51
|
-
exports.getPackageVersion = getPackageVersion;
|
|
52
90
|
const exitWithFailureMessage = (error, errorDetails) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line n/no-process-exit
|
|
61
|
-
node_process_1.default.exit(1);
|
|
91
|
+
console.log();
|
|
92
|
+
if (error.formatWithErrorDetails && errorDetails) {
|
|
93
|
+
console.error(error.formatWithErrorDetails(errorDetails));
|
|
94
|
+
} else {
|
|
95
|
+
console.error(error.message);
|
|
96
|
+
}
|
|
97
|
+
import_node_process.default.exit(1);
|
|
62
98
|
};
|
|
63
|
-
exports.exitWithFailureMessage = exitWithFailureMessage;
|
|
64
99
|
const throwErrorWithFailureMessage = (error, errorDetails) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
: error.message;
|
|
69
|
-
throw new Error(finalMessage);
|
|
100
|
+
console.log();
|
|
101
|
+
const finalMessage = error.formatWithErrorDetails && errorDetails ? error.formatWithErrorDetails(errorDetails) : error.message;
|
|
102
|
+
throw new Error(finalMessage);
|
|
70
103
|
};
|
|
71
|
-
exports.throwErrorWithFailureMessage = throwErrorWithFailureMessage;
|
|
72
104
|
const populateValuesFromServiceUrl = () => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return null;
|
|
105
|
+
const url = import_node_process.default.env["PLAYWRIGHT_SERVICE_URL"];
|
|
106
|
+
if (url) {
|
|
107
|
+
const parts = url.split("/");
|
|
108
|
+
if (parts.length > 2) {
|
|
109
|
+
const subdomainParts = parts[2].split(".");
|
|
110
|
+
const region = subdomainParts.length > 0 ? subdomainParts[0] : null;
|
|
111
|
+
const domain = subdomainParts.slice(2).join(".");
|
|
112
|
+
const accountId = parts[4];
|
|
113
|
+
return { region, domain, accountId };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
86
117
|
};
|
|
87
|
-
exports.populateValuesFromServiceUrl = populateValuesFromServiceUrl;
|
|
88
118
|
const getAccessToken = () => {
|
|
89
|
-
|
|
119
|
+
return import_node_process.default.env[import_constants.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_ACCESS_TOKEN];
|
|
90
120
|
};
|
|
91
|
-
exports.getAccessToken = getAccessToken;
|
|
92
121
|
const getServiceBaseURL = () => {
|
|
93
|
-
|
|
122
|
+
return import_node_process.default.env[import_constants.ServiceEnvironmentVariable.PLAYWRIGHT_SERVICE_URL];
|
|
94
123
|
};
|
|
95
|
-
exports.getServiceBaseURL = getServiceBaseURL;
|
|
96
124
|
const isValidGuid = (guid) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
if (!guid) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
129
|
+
return guidRegex.test(guid);
|
|
102
130
|
};
|
|
103
|
-
exports.isValidGuid = isValidGuid;
|
|
104
131
|
const getAndSetRunId = () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
132
|
+
const runId = (0, import_node_crypto.randomUUID)();
|
|
133
|
+
import_node_process.default.env[import_constants.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID] = runId;
|
|
134
|
+
return runId;
|
|
108
135
|
};
|
|
109
|
-
exports.getAndSetRunId = getAndSetRunId;
|
|
110
136
|
const getServiceWSEndpoint = (runId, os, apiVersion) => {
|
|
111
|
-
|
|
137
|
+
return `${getServiceBaseURL()}?runId=${encodeURIComponent(runId)}&os=${os}&api-version=${apiVersion}`;
|
|
112
138
|
};
|
|
113
|
-
exports.getServiceWSEndpoint = getServiceWSEndpoint;
|
|
114
139
|
const validateServiceUrl = () => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
140
|
+
const serviceUrl = getServiceBaseURL();
|
|
141
|
+
if (!serviceUrl) {
|
|
142
|
+
exitWithFailureMessage(import_messages.ServiceErrorMessageConstants.NO_SERVICE_URL_ERROR);
|
|
143
|
+
}
|
|
119
144
|
};
|
|
120
|
-
exports.validateServiceUrl = validateServiceUrl;
|
|
121
145
|
const ValidateRunID = (runID) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
146
|
+
const isValidRunID = isValidGuid(runID);
|
|
147
|
+
if (!isValidRunID) {
|
|
148
|
+
const errorMessage = import_messages.ServiceErrorMessageConstants.INVALID_RUN_ID_FORMAT.message;
|
|
149
|
+
throw new Error(errorMessage);
|
|
150
|
+
}
|
|
127
151
|
};
|
|
128
|
-
exports.ValidateRunID = ValidateRunID;
|
|
129
152
|
const validateMptPAT = (validationFailureCallback) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
if (Date.now() >= claims.exp * 1000) {
|
|
141
|
-
validationFailureCallback(messages_js_1.ServiceErrorMessageConstants.EXPIRED_MPT_PAT_ERROR);
|
|
142
|
-
}
|
|
143
|
-
if (result.accountId !== claims.pwid) {
|
|
144
|
-
validationFailureCallback(messages_js_1.ServiceErrorMessageConstants.WORKSPACE_MISMATCH_ERROR);
|
|
145
|
-
}
|
|
153
|
+
try {
|
|
154
|
+
const accessToken = getAccessToken();
|
|
155
|
+
const result = populateValuesFromServiceUrl();
|
|
156
|
+
if (!accessToken) {
|
|
157
|
+
validationFailureCallback(import_messages.ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN);
|
|
158
|
+
}
|
|
159
|
+
const claims = (0, import_parseJwt.parseJwt)(accessToken);
|
|
160
|
+
if (!claims.exp) {
|
|
161
|
+
validationFailureCallback(import_messages.ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);
|
|
146
162
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
(0, exports.exitWithFailureMessage)(messages_js_1.ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);
|
|
163
|
+
if (Date.now() >= claims.exp * 1e3) {
|
|
164
|
+
validationFailureCallback(import_messages.ServiceErrorMessageConstants.EXPIRED_MPT_PAT_ERROR);
|
|
150
165
|
}
|
|
166
|
+
if (result.accountId !== claims.pwid) {
|
|
167
|
+
validationFailureCallback(import_messages.ServiceErrorMessageConstants.WORKSPACE_MISMATCH_ERROR);
|
|
168
|
+
}
|
|
169
|
+
} catch (err) {
|
|
170
|
+
import_logger.coreLogger.error(err);
|
|
171
|
+
exitWithFailureMessage(import_messages.ServiceErrorMessageConstants.INVALID_MPT_PAT_ERROR);
|
|
172
|
+
}
|
|
151
173
|
};
|
|
152
|
-
exports.validateMptPAT = validateMptPAT;
|
|
153
174
|
const isTokenExpiringSoon = (expirationTime, currentTime) => {
|
|
154
|
-
|
|
175
|
+
return expirationTime * 1e3 - currentTime <= import_constants.Constants.SevenDaysInMS;
|
|
155
176
|
};
|
|
156
177
|
const warnAboutTokenExpiry = (expirationTime, currentTime) => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
178
|
+
const daysToExpiration = Math.ceil((expirationTime * 1e3 - currentTime) / import_constants.Constants.OneDayInMS);
|
|
179
|
+
const expirationDate = new Date(expirationTime * 1e3).toLocaleDateString();
|
|
180
|
+
const expirationWarning = `Warning: The access token used for this test run will expire in ${daysToExpiration} days on ${expirationDate}. Generate a new token from the portal to avoid failures. For a simpler, more secure solution, switch to Microsoft Entra ID and eliminate token management. https://learn.microsoft.com/entra/identity/`;
|
|
181
|
+
console.warn(expirationWarning);
|
|
161
182
|
};
|
|
162
183
|
const warnIfAccessTokenCloseToExpiry = () => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
184
|
+
const accessToken = getAccessToken();
|
|
185
|
+
if (!accessToken) {
|
|
186
|
+
throw new Error(import_messages.ServiceErrorMessageConstants.NO_AUTH_ERROR_PAT_TOKEN.message);
|
|
187
|
+
}
|
|
188
|
+
const claims = (0, import_parseJwt.parseJwt)(accessToken);
|
|
189
|
+
const currentTime = Date.now();
|
|
190
|
+
if (isTokenExpiringSoon(claims.exp, currentTime)) {
|
|
191
|
+
warnAboutTokenExpiry(claims.exp, currentTime);
|
|
192
|
+
}
|
|
172
193
|
};
|
|
173
|
-
exports.warnIfAccessTokenCloseToExpiry = warnIfAccessTokenCloseToExpiry;
|
|
174
194
|
const fetchOrValidateAccessToken = async (credential) => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return token;
|
|
195
|
+
const entraIdAccessToken = (0, import_entraIdAccessToken.createEntraIdAccessToken)(credential);
|
|
196
|
+
if (entraIdAccessToken.doesEntraIdAccessTokenNeedRotation()) {
|
|
197
|
+
await entraIdAccessToken.fetchEntraIdAccessToken();
|
|
198
|
+
}
|
|
199
|
+
const token = getAccessToken();
|
|
200
|
+
if (!token) {
|
|
201
|
+
throw new Error(import_messages.ServiceErrorMessageConstants.NO_AUTH_ERROR_ENTRA_TOKEN.message);
|
|
202
|
+
}
|
|
203
|
+
return token;
|
|
185
204
|
};
|
|
186
|
-
exports.fetchOrValidateAccessToken = fetchOrValidateAccessToken;
|
|
187
205
|
const getVersionInfo = (version) => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
206
|
+
const regex = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?/;
|
|
207
|
+
const match = version.match(regex);
|
|
208
|
+
const versionInfo = {
|
|
209
|
+
major: 0,
|
|
210
|
+
minor: 0,
|
|
211
|
+
patch: 0
|
|
212
|
+
};
|
|
213
|
+
versionInfo.major = match && match[1] ? parseInt(match[1], 10) : 0;
|
|
214
|
+
versionInfo.minor = match && match[2] ? parseInt(match[2], 10) : 0;
|
|
215
|
+
versionInfo.patch = match && match[3] ? parseInt(match[3], 10) : 0;
|
|
216
|
+
return versionInfo;
|
|
199
217
|
};
|
|
200
|
-
exports.getVersionInfo = getVersionInfo;
|
|
201
218
|
const validatePlaywrightVersion = () => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(0, exports.exitWithFailureMessage)(messages_js_1.ServiceErrorMessageConstants.INVALID_PLAYWRIGHT_VERSION_ERROR);
|
|
211
|
-
}
|
|
219
|
+
const minimumSupportedVersion = import_constants.Constants.MinimumSupportedPlaywrightVersion;
|
|
220
|
+
const installedVersion = (0, import_getPlaywrightVersion.getPlaywrightVersion)();
|
|
221
|
+
const minimumSupportedVersionInfo = getVersionInfo(minimumSupportedVersion);
|
|
222
|
+
const installedVersionInfo = getVersionInfo(installedVersion);
|
|
223
|
+
const isInstalledVersionGreater = installedVersionInfo.major > minimumSupportedVersionInfo.major || installedVersionInfo.major === minimumSupportedVersionInfo.major && installedVersionInfo.minor >= minimumSupportedVersionInfo.minor;
|
|
224
|
+
if (!isInstalledVersionGreater) {
|
|
225
|
+
exitWithFailureMessage(import_messages.ServiceErrorMessageConstants.INVALID_PLAYWRIGHT_VERSION_ERROR);
|
|
226
|
+
}
|
|
212
227
|
};
|
|
213
|
-
exports.validatePlaywrightVersion = validatePlaywrightVersion;
|
|
214
228
|
const getTestRunConfig = (config) => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
const maxWorkers = config.workers || config.metadata.actualWorkers;
|
|
230
|
+
const frameWorkVersion = config.version;
|
|
231
|
+
const testRunConfig = {
|
|
232
|
+
framework: {
|
|
233
|
+
name: import_constants.RunConfigConstants.TEST_FRAMEWORK_NAME,
|
|
234
|
+
version: frameWorkVersion,
|
|
235
|
+
runnerName: import_constants.RunConfigConstants.TEST_FRAMEWORK_RUNNERNAME
|
|
236
|
+
},
|
|
237
|
+
sdkLanguage: import_constants.RunConfigConstants.TEST_SDK_LANGUAGE,
|
|
238
|
+
maxWorkers
|
|
239
|
+
};
|
|
240
|
+
return testRunConfig;
|
|
227
241
|
};
|
|
228
|
-
exports.getTestRunConfig = getTestRunConfig;
|
|
229
242
|
function getTestRunApiUrl() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
const result = populateValuesFromServiceUrl();
|
|
244
|
+
const runId = import_node_process.default.env[import_constants.InternalEnvironmentVariables.MPT_SERVICE_RUN_ID];
|
|
245
|
+
if (!result?.region || !result?.domain || !result?.accountId) {
|
|
246
|
+
exitWithFailureMessage(import_messages.ServiceErrorMessageConstants.NO_SERVICE_URL_ERROR);
|
|
247
|
+
}
|
|
248
|
+
const baseUrl = `https://${result?.region}.${import_constants.UrlConstants.ReportingApiSubdomain}.${result?.domain}/${import_constants.UrlConstants.PlaywrightWorkspacesPath}/${result?.accountId}/${import_constants.UrlConstants.TestRunsPath}`;
|
|
249
|
+
const url = runId ? `${baseUrl}/${runId}` : baseUrl;
|
|
250
|
+
return `${url}?api-version=${import_constants.Constants.LatestAPIVersion}`;
|
|
238
251
|
}
|
|
239
252
|
function isNullOrEmpty(str) {
|
|
240
|
-
|
|
253
|
+
return !str || str.trim() === "";
|
|
241
254
|
}
|
|
242
255
|
async function runCommand(command) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
256
|
+
return new Promise((resolve, reject) => {
|
|
257
|
+
(0, import_child_process.exec)(command, (error, stdout, stderr) => {
|
|
258
|
+
if (error) {
|
|
259
|
+
reject(error);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (stderr) {
|
|
263
|
+
reject(new Error(stderr));
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
resolve(stdout.trim());
|
|
255
267
|
});
|
|
268
|
+
});
|
|
256
269
|
}
|
|
257
270
|
async function getRunName(ciInfo) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return "";
|
|
279
|
-
}
|
|
271
|
+
if (ciInfo.providerName === import_cIInfoProvider.CI_PROVIDERS.GITHUB && import_node_process.default.env["GITHUB_EVENT_NAME"] === "pull_request") {
|
|
272
|
+
const prNumber = `${import_node_process.default.env["GITHUB_REF_NAME"]?.split("/")[0]}`;
|
|
273
|
+
const prLink = `${import_node_process.default.env["GITHUB_REPOSITORY"]}/pull/${prNumber}`;
|
|
274
|
+
return `PR# ${prNumber} on Repo: ${import_node_process.default.env["GITHUB_REPOSITORY"]} (${prLink})`;
|
|
275
|
+
}
|
|
276
|
+
try {
|
|
277
|
+
const gitVersion = await runCommand(import_constants.GitHubActionsConstants.GIT_VERSION_COMMAND);
|
|
278
|
+
if (isNullOrEmpty(gitVersion)) {
|
|
279
|
+
throw new Error("Git is not installed on the machine");
|
|
280
|
+
}
|
|
281
|
+
const isInsideWorkTree = await runCommand(import_constants.GitHubActionsConstants.GIT_REV_PARSE);
|
|
282
|
+
if (isInsideWorkTree !== "true") {
|
|
283
|
+
throw new Error("Not inside a git repository");
|
|
284
|
+
}
|
|
285
|
+
const gitCommitMessage = await runCommand(import_constants.GitHubActionsConstants.GIT_COMMIT_MESSAGE_COMMAND);
|
|
286
|
+
return gitCommitMessage;
|
|
287
|
+
} catch (err) {
|
|
288
|
+
import_logger.coreLogger.error(`Error in getting git commit message: ${err}.`);
|
|
289
|
+
return "";
|
|
290
|
+
}
|
|
280
291
|
}
|
|
281
292
|
function extractErrorMessage(responseBody) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
293
|
+
if (!responseBody) {
|
|
294
|
+
return "";
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
const errorResponse = JSON.parse(responseBody);
|
|
298
|
+
if (errorResponse.error && errorResponse.error.message) {
|
|
299
|
+
return errorResponse.error.message;
|
|
300
|
+
}
|
|
301
|
+
return responseBody;
|
|
302
|
+
} catch (e) {
|
|
303
|
+
return responseBody;
|
|
304
|
+
}
|
|
295
305
|
}
|
|
296
306
|
function getWorkspaceMetaDataApiUrl() {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
307
|
+
const result = populateValuesFromServiceUrl();
|
|
308
|
+
if (!result?.region || !result?.domain || !result?.accountId) {
|
|
309
|
+
exitWithFailureMessage(import_messages.ServiceErrorMessageConstants.NO_SERVICE_URL_ERROR);
|
|
310
|
+
}
|
|
311
|
+
const baseUrl = `https://${result?.region}.${import_constants.UrlConstants.ApiSubdomain}.${result?.domain}/${import_constants.UrlConstants.PlaywrightWorkspacesPath}/${result?.accountId}`;
|
|
312
|
+
return `${baseUrl}?api-version=${import_constants.Constants.LatestAPIVersion}`;
|
|
303
313
|
}
|
|
304
314
|
function getHtmlReporterOutputFolder(config) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return defaultFolder;
|
|
308
|
-
}
|
|
309
|
-
for (const reporter of config.reporter) {
|
|
310
|
-
if (Array.isArray(reporter)) {
|
|
311
|
-
const [reporterName, options] = reporter;
|
|
312
|
-
if (reporterName === "html" && options && typeof options === "object") {
|
|
313
|
-
return options.outputFolder || defaultFolder;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
else if (typeof reporter === "string" && reporter === "html") {
|
|
317
|
-
return defaultFolder;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
315
|
+
const defaultFolder = "playwright-report";
|
|
316
|
+
if (!config?.reporter) {
|
|
320
317
|
return defaultFolder;
|
|
318
|
+
}
|
|
319
|
+
for (const reporter of config.reporter) {
|
|
320
|
+
if (Array.isArray(reporter)) {
|
|
321
|
+
const [reporterName, options] = reporter;
|
|
322
|
+
if (reporterName === "html" && options && typeof options === "object") {
|
|
323
|
+
return options.outputFolder || defaultFolder;
|
|
324
|
+
}
|
|
325
|
+
} else if (typeof reporter === "string" && reporter === "html") {
|
|
326
|
+
return defaultFolder;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return defaultFolder;
|
|
321
330
|
}
|
|
322
331
|
function getContentType(filePath) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
332
|
+
const ext = filePath.toLowerCase().split(".").pop();
|
|
333
|
+
const contentTypes = {
|
|
334
|
+
html: "text/html",
|
|
335
|
+
css: "text/css",
|
|
336
|
+
js: "application/javascript",
|
|
337
|
+
json: "application/json",
|
|
338
|
+
png: "image/png",
|
|
339
|
+
jpg: "image/jpeg",
|
|
340
|
+
jpeg: "image/jpeg",
|
|
341
|
+
svg: "image/svg+xml",
|
|
342
|
+
ico: "image/x-icon",
|
|
343
|
+
txt: "text/plain",
|
|
344
|
+
ttf: "font/ttf",
|
|
345
|
+
woff: "font/woff",
|
|
346
|
+
woff2: "font/woff2",
|
|
347
|
+
webmanifest: "application/manifest+json",
|
|
348
|
+
map: "application/json",
|
|
349
|
+
xml: "application/xml",
|
|
350
|
+
pdf: "application/pdf",
|
|
351
|
+
zip: "application/zip"
|
|
352
|
+
};
|
|
353
|
+
return contentTypes[ext || ""] || "application/octet-stream";
|
|
345
354
|
}
|
|
346
355
|
function calculateOptimalConcurrency(files) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
356
|
+
const totalFiles = files.length;
|
|
357
|
+
const totalSize = files.reduce((sum, f) => sum + f.size, 0);
|
|
358
|
+
const avgFileSize = totalSize / totalFiles;
|
|
359
|
+
let optimalConcurrency;
|
|
360
|
+
if (totalFiles <= 10) {
|
|
361
|
+
optimalConcurrency = Math.min(totalFiles, 10);
|
|
362
|
+
} else if (avgFileSize < import_constants2.UploadConstants.SMALL_FILE_THRESHOLD) {
|
|
363
|
+
optimalConcurrency = Math.min(
|
|
364
|
+
import_constants2.UploadConstants.MAX_CONCURRENCY,
|
|
365
|
+
Math.max(import_constants2.UploadConstants.BASE_CONCURRENCY, totalFiles / 50)
|
|
366
|
+
);
|
|
367
|
+
} else if (totalFiles > 1e3) {
|
|
368
|
+
optimalConcurrency = Math.min(
|
|
369
|
+
import_constants2.UploadConstants.MAX_CONCURRENCY,
|
|
370
|
+
import_constants2.UploadConstants.BASE_CONCURRENCY + Math.floor(totalFiles / 200)
|
|
371
|
+
);
|
|
372
|
+
} else {
|
|
373
|
+
optimalConcurrency = Math.min(
|
|
374
|
+
import_constants2.UploadConstants.MAX_CONCURRENCY,
|
|
375
|
+
import_constants2.UploadConstants.BASE_CONCURRENCY
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
return Math.floor(optimalConcurrency);
|
|
364
379
|
}
|
|
365
380
|
function collectAllFiles(folderPath, basePath, runIdFolderPrefix) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
catch (error) {
|
|
393
|
-
continue;
|
|
381
|
+
const files = [];
|
|
382
|
+
const stack = [folderPath];
|
|
383
|
+
while (stack.length > 0) {
|
|
384
|
+
const currentPath = stack.pop();
|
|
385
|
+
try {
|
|
386
|
+
const items = (0, import_fs.readdirSync)(currentPath);
|
|
387
|
+
for (const item of items) {
|
|
388
|
+
const itemPath = (0, import_path.join)(currentPath, item);
|
|
389
|
+
const stats = (0, import_fs.statSync)(itemPath);
|
|
390
|
+
if (stats.isDirectory()) {
|
|
391
|
+
stack.push(itemPath);
|
|
392
|
+
} else {
|
|
393
|
+
let relativePath = (0, import_path.relative)(basePath, itemPath).split("\\").join("/");
|
|
394
|
+
if (runIdFolderPrefix) {
|
|
395
|
+
relativePath = `${runIdFolderPrefix}/${relativePath}`;
|
|
396
|
+
}
|
|
397
|
+
files.push({
|
|
398
|
+
fullPath: itemPath,
|
|
399
|
+
relativePath,
|
|
400
|
+
size: stats.size,
|
|
401
|
+
contentType: getContentType(itemPath)
|
|
402
|
+
});
|
|
394
403
|
}
|
|
404
|
+
}
|
|
405
|
+
} catch (error) {
|
|
406
|
+
continue;
|
|
395
407
|
}
|
|
396
|
-
|
|
408
|
+
}
|
|
409
|
+
return files;
|
|
397
410
|
}
|
|
398
411
|
function resolveTenantDomain(tenantId, tenants) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
412
|
+
if (!tenantId || tenants.length === 0) {
|
|
413
|
+
return void 0;
|
|
414
|
+
}
|
|
415
|
+
const matchingTenant = tenants.find((t) => t.tenantId === tenantId);
|
|
416
|
+
import_logger.coreLogger.info(
|
|
417
|
+
`Resolved tenant domain: ${JSON.stringify(matchingTenant?.defaultDomain)} for tenant ID: ${tenantId}`
|
|
418
|
+
);
|
|
419
|
+
return matchingTenant?.defaultDomain;
|
|
405
420
|
}
|
|
406
421
|
function getPortalTestRunUrl(workspaceMetadata, tenantDomain) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
422
|
+
const { subscriptionId, resourceId, name } = workspaceMetadata ?? {};
|
|
423
|
+
if (!subscriptionId || !resourceId || !name) {
|
|
424
|
+
throw new Error(
|
|
425
|
+
"Missing required workspace metadata: subscriptionId, resourceId, and name are required"
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
const resourceIdParts = resourceId.split("/");
|
|
429
|
+
const resourceGroupIndex = resourceIdParts.findIndex(
|
|
430
|
+
(part) => part.toLowerCase() === import_constants.UrlConstants.ResourceGroupsPath
|
|
431
|
+
);
|
|
432
|
+
if (resourceGroupIndex === -1 || resourceGroupIndex + 1 >= resourceIdParts.length) {
|
|
433
|
+
throw new Error("Invalid resourceId format: could not extract resource group name");
|
|
434
|
+
}
|
|
435
|
+
const resourceGroupName = resourceIdParts[resourceGroupIndex + 1];
|
|
436
|
+
const tenantFragment = tenantDomain ? `#@${tenantDomain}` : "#";
|
|
437
|
+
return `${import_constants.UrlConstants.AzurePortalBaseUrl}/${tenantFragment}${import_constants.UrlConstants.ResourcePath}${import_constants.UrlConstants.SubscriptionsPath}/${encodeURIComponent(subscriptionId)}${import_constants.UrlConstants.ResourceGroupsUrlPath}/${encodeURIComponent(resourceGroupName)}${import_constants.UrlConstants.ProvidersPath}/${import_constants.UrlConstants.LoadTestServiceProvider}/${import_constants.UrlConstants.PlaywrightWorkspacesResourceType}/${encodeURIComponent(name)}/${import_constants.UrlConstants.TestRunsRoute}`;
|
|
420
438
|
}
|
|
421
439
|
const getStorageAccountNameFromUri = (storageUri) => {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
const url = new URL(storageUri);
|
|
427
|
-
const hostname = url.hostname;
|
|
428
|
-
// Extract storage account name from hostname pattern: {accountname}.blob.core.windows.net
|
|
429
|
-
const match = hostname.match(/^([^.]+)\.blob\.core\.windows\.net$/i);
|
|
430
|
-
if (match && match[1]) {
|
|
431
|
-
return match[1];
|
|
432
|
-
}
|
|
433
|
-
return null;
|
|
440
|
+
try {
|
|
441
|
+
if (!storageUri || typeof storageUri !== "string") {
|
|
442
|
+
return null;
|
|
434
443
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
444
|
+
const url = new URL(storageUri);
|
|
445
|
+
const hostname = url.hostname;
|
|
446
|
+
const match = hostname.match(/^([^.]+)\.blob\.core\.windows\.net$/i);
|
|
447
|
+
if (match && match[1]) {
|
|
448
|
+
return match[1];
|
|
438
449
|
}
|
|
450
|
+
return null;
|
|
451
|
+
} catch (error) {
|
|
452
|
+
console.warn("Failed to extract storage account name from URI:", storageUri, error);
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
439
455
|
};
|
|
440
|
-
|
|
441
|
-
|
|
456
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
457
|
+
0 && (module.exports = {
|
|
458
|
+
ValidateRunID,
|
|
459
|
+
calculateOptimalConcurrency,
|
|
460
|
+
collectAllFiles,
|
|
461
|
+
exitWithFailureMessage,
|
|
462
|
+
extractErrorMessage,
|
|
463
|
+
fetchOrValidateAccessToken,
|
|
464
|
+
getAccessToken,
|
|
465
|
+
getAndSetRunId,
|
|
466
|
+
getContentType,
|
|
467
|
+
getHtmlReporterOutputFolder,
|
|
468
|
+
getPackageVersion,
|
|
469
|
+
getPlaywrightVersion,
|
|
470
|
+
getPortalTestRunUrl,
|
|
471
|
+
getRunName,
|
|
472
|
+
getServiceBaseURL,
|
|
473
|
+
getServiceWSEndpoint,
|
|
474
|
+
getStorageAccountNameFromUri,
|
|
475
|
+
getTestRunApiUrl,
|
|
476
|
+
getTestRunConfig,
|
|
477
|
+
getVersionInfo,
|
|
478
|
+
getWorkspaceMetaDataApiUrl,
|
|
479
|
+
isNullOrEmpty,
|
|
480
|
+
isValidGuid,
|
|
481
|
+
parseJwt,
|
|
482
|
+
populateValuesFromServiceUrl,
|
|
483
|
+
resolveTenantDomain,
|
|
484
|
+
throwErrorWithFailureMessage,
|
|
485
|
+
validateMptPAT,
|
|
486
|
+
validatePlaywrightVersion,
|
|
487
|
+
validateServiceUrl,
|
|
488
|
+
warnIfAccessTokenCloseToExpiry
|
|
489
|
+
});
|