@mablhq/mabl-cli 1.58.25 → 1.59.5
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/api/basicApiClient.js +15 -21
- package/api/mablApiClient.js +54 -43
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +2 -1
- package/browserEngines/chromiumBrowserEngine.js +2 -2
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +3 -2
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +20 -12
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +10 -7
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +4 -3
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +5 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +7 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +7 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +37 -31
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +9 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +8 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -3
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/cloudMonitoringPerformanceMetrics.js +28 -56
- package/browserTestMonitoring/distributions.js +1 -6
- package/browserTestMonitoring/metricsRecorder.js +47 -30
- package/commands/commandUtil/branches.js +3 -2
- package/commands/commandUtil/codeInsights.js +16 -13
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +5 -3
- package/commands/commandUtil/versionUtil.js +5 -4
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/datatables/datatables_cmds/create.js +3 -2
- package/commands/datatables/datatables_cmds/export.js +5 -3
- package/commands/datatables/datatables_cmds/list.js +2 -1
- package/commands/datatables/datatables_cmds/scenarios.js +2 -1
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
- package/commands/deploy/deploy_cmds/create.js +13 -11
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
- package/commands/deploy/deploy_cmds/list.js +4 -3
- package/commands/deploy/deploy_cmds/watch.js +2 -1
- package/commands/environments/environments_cmds/create.js +2 -1
- package/commands/environments/environments_cmds/delete.js +2 -1
- package/commands/environments/environments_cmds/update.js +2 -1
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
- package/commands/flows/flows_cmds/export.js +5 -4
- package/commands/plans/plans_cmds/describe.js +2 -1
- package/commands/tests/mobileEmulationUtil.js +7 -5
- package/commands/tests/testsUtil.js +46 -42
- package/commands/tests/tests_cmds/export.js +2 -1
- package/commands/tests/tests_cmds/import.js +5 -4
- package/commands/tests/tests_cmds/run-cloud.js +34 -15
- package/commands/tests/tests_cmds/run.js +11 -11
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -1
- package/core/execution/ApiTestUtils.js +94 -82
- package/core/messaging/logLineMessaging.js +3 -2
- package/core/messaging/messaging.js +7 -6
- package/core/trainer/trainingSessions.js +32 -16
- package/coreWebVitals/index.js +18 -14
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +5 -4
- package/http/MablHttpAgent.js +6 -4
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +5 -3
- package/http/httpUtil.js +3 -2
- package/http/requestInterceptor.js +15 -11
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +3 -2
- package/mablscript/MablStep.js +4 -2
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -2
- package/mablscript/actions/FindAction.js +4 -2
- package/mablscript/diffing/diffingUtil.js +7 -8
- package/mablscript/importer.js +2 -1
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +16 -11
- package/mablscript/steps/ClickAndHoldStep.js +2 -1
- package/mablscript/steps/CreateVariableStep.js +2 -1
- package/mablscript/steps/DownloadStep.js +2 -1
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +6 -4
- package/mablscript/steps/ReleaseStep.js +2 -1
- package/mablscript/steps/SendHttpRequestStep.js +4 -2
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +8 -7
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +6 -3
- package/mablscript/steps/SyntheticStep.js +2 -1
- package/middleware.js +2 -1
- package/package.json +3 -3
- package/popupDismissal/index.js +5 -4
- package/providers/authenticationProvider.js +6 -5
- package/providers/cliConfigProvider.js +12 -10
- package/providers/exportRequestProvider.js +5 -3
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
- package/util/TestOutputWriter.js +12 -8
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +9 -6
- package/util/browserTestUtils.js +2 -1
- package/util/markdownUtil.js +11 -9
|
@@ -17,26 +17,27 @@ function createFileUploadDirectory(testContext) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.createFileUploadDirectory = createFileUploadDirectory;
|
|
19
19
|
function validateApiTestMessage(request, response) {
|
|
20
|
+
var _a, _b, _c;
|
|
20
21
|
const authorizationHeader = request.get('authorization');
|
|
21
22
|
if (authorizationHeader === undefined) {
|
|
22
23
|
(0, utils_1.handleExecutionFailure)(response, 'Illegal authorization');
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
25
26
|
const contentType = request.get('content-type');
|
|
26
|
-
if (contentType
|
|
27
|
+
if ((contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase()) !== 'application/json') {
|
|
27
28
|
(0, utils_1.handleExecutionFailure)(response, 'Illegal content type. Must be application/json');
|
|
28
29
|
return false;
|
|
29
30
|
}
|
|
30
31
|
const pubsubMessage = request.body;
|
|
31
|
-
if (typeof pubsubMessage
|
|
32
|
+
if (typeof ((_a = pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.message) === null || _a === void 0 ? void 0 : _a.data) !== 'string') {
|
|
32
33
|
(0, utils_1.handleExecutionFailure)(response, 'Illegal message data format');
|
|
33
34
|
return false;
|
|
34
35
|
}
|
|
35
|
-
if (typeof pubsubMessage
|
|
36
|
+
if (typeof (pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.subscription) !== 'string') {
|
|
36
37
|
(0, utils_1.handleExecutionFailure)(response, 'Illegal message subscription format');
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
|
-
if (pubsubMessage
|
|
40
|
+
if (((_c = (_b = pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.message) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.test_type) !==
|
|
40
41
|
mablApi_1.TestTypeEnum.Api.toString()) {
|
|
41
42
|
(0, utils_1.handleExecutionFailure)(response, 'Illegal test type');
|
|
42
43
|
return false;
|
package/http/MablHttpAgent.js
CHANGED
|
@@ -48,14 +48,16 @@ class MablHttpAgent extends agent_base_1.Agent {
|
|
|
48
48
|
return new MablHttpAgent(constructorParameters.httpAgent, constructorParameters.httpsAgent);
|
|
49
49
|
}
|
|
50
50
|
static async getConstructorParameters(httpAgent, httpsAgent) {
|
|
51
|
+
var _a, _b;
|
|
51
52
|
const proxyConfig = await (0, axiosProxyConfig_1.currentProxyConfig)('test');
|
|
52
53
|
return {
|
|
53
|
-
httpAgent: httpAgent
|
|
54
|
-
httpsAgent: httpsAgent
|
|
54
|
+
httpAgent: (_a = httpAgent !== null && httpAgent !== void 0 ? httpAgent : proxyConfig.httpAgent) !== null && _a !== void 0 ? _a : http_1.default.globalAgent,
|
|
55
|
+
httpsAgent: (_b = httpsAgent !== null && httpsAgent !== void 0 ? httpsAgent : proxyConfig.httpsAgent) !== null && _b !== void 0 ? _b : https.globalAgent,
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
callback(req, opts) {
|
|
58
|
-
|
|
59
|
+
var _a;
|
|
60
|
+
if ((_a = this.maybeGetFirstStringHeader(req, httpUtil_1.USER_AGENT_HEADER)) === null || _a === void 0 ? void 0 : _a.startsWith('PostmanRuntime/')) {
|
|
59
61
|
req.setHeader(httpUtil_1.USER_AGENT_HEADER, httpUtil_1.USER_AGENT);
|
|
60
62
|
}
|
|
61
63
|
return Promise.resolve(opts.secureEndpoint ? this.httpsAgent : this.httpAgent);
|
|
@@ -65,7 +67,7 @@ class MablHttpAgent extends agent_base_1.Agent {
|
|
|
65
67
|
if (Array.isArray(value)) {
|
|
66
68
|
return value[0].toString();
|
|
67
69
|
}
|
|
68
|
-
return value
|
|
70
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
exports.MablHttpAgent = MablHttpAgent;
|
|
@@ -7,7 +7,7 @@ class RequestSecurityError extends Error {
|
|
|
7
7
|
this.isRequestSecurityError = true;
|
|
8
8
|
}
|
|
9
9
|
static isInstance(error) {
|
|
10
|
-
return error
|
|
10
|
+
return (error === null || error === void 0 ? void 0 : error.isRequestSecurityError) || false;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.RequestSecurityError = RequestSecurityError;
|
package/http/axiosProxyConfig.js
CHANGED
|
@@ -31,10 +31,11 @@ const hpagent_1 = require("hpagent");
|
|
|
31
31
|
const httpUtil_1 = require("./httpUtil");
|
|
32
32
|
async function currentProxyConfig(mode = 'mabl') {
|
|
33
33
|
const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
|
|
34
|
-
return axiosProxyConfig(mode === 'test' ? httpConfig
|
|
34
|
+
return axiosProxyConfig(mode === 'test' ? httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.test : httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.mabl);
|
|
35
35
|
}
|
|
36
36
|
exports.currentProxyConfig = currentProxyConfig;
|
|
37
37
|
function axiosProxyConfig(httpConfig) {
|
|
38
|
+
var _a;
|
|
38
39
|
const config = {
|
|
39
40
|
headers: {
|
|
40
41
|
[httpUtil_1.USER_AGENT_HEADER]: httpUtil_1.USER_AGENT,
|
|
@@ -45,7 +46,7 @@ function axiosProxyConfig(httpConfig) {
|
|
|
45
46
|
rejectUnauthorized: false,
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
if (httpConfig.proxyHost
|
|
49
|
+
if ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href) {
|
|
49
50
|
config.proxy = proxyUrlToPortConfig(httpConfig.proxyHost);
|
|
50
51
|
}
|
|
51
52
|
return maybeGetModifiedAxiosConfigForHttpProxy(config, httpConfig.sslVerify, httpConfig.proxyType);
|
|
@@ -78,8 +79,9 @@ function proxyUrlToPortConfig(proxyUrl) {
|
|
|
78
79
|
}
|
|
79
80
|
exports.proxyUrlToPortConfig = proxyUrlToPortConfig;
|
|
80
81
|
function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType) {
|
|
82
|
+
var _a, _b;
|
|
81
83
|
if (config.proxy &&
|
|
82
|
-
(config.proxy
|
|
84
|
+
(((_a = config.proxy) === null || _a === void 0 ? void 0 : _a.protocol) === 'http:' || ((_b = config.proxy) === null || _b === void 0 ? void 0 : _b.protocol) === 'http')) {
|
|
83
85
|
const newConfig = {
|
|
84
86
|
...config,
|
|
85
87
|
};
|
package/http/httpUtil.js
CHANGED
|
@@ -39,13 +39,14 @@ function maybeGetSocksAgent(linkServer) {
|
|
|
39
39
|
return new socks_proxy_agent_1.SocksProxyAgent(agentOptions);
|
|
40
40
|
}
|
|
41
41
|
function postProcessHeaders(response) {
|
|
42
|
+
var _a, _b, _c;
|
|
42
43
|
const parsed = {};
|
|
43
|
-
const rawHeaders = response.request
|
|
44
|
+
const rawHeaders = (_b = (_a = response.request) === null || _a === void 0 ? void 0 : _a.res) === null || _b === void 0 ? void 0 : _b.rawHeaders;
|
|
44
45
|
if (rawHeaders) {
|
|
45
46
|
for (let i = 0; i + 1 < rawHeaders.length; i += 2) {
|
|
46
47
|
const headerName = rawHeaders[i].toLowerCase();
|
|
47
48
|
const headerValue = rawHeaders[i + 1];
|
|
48
|
-
parsed[headerName] = (parsed[headerName]
|
|
49
|
+
parsed[headerName] = ((_c = parsed[headerName]) !== null && _c !== void 0 ? _c : []).concat(headerValue);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
return parsed;
|
|
@@ -22,9 +22,10 @@ function headerStringToHeaders(rawHeader) {
|
|
|
22
22
|
.filter((value) => HEADER_EXTRACT_REGEXP.test(value))
|
|
23
23
|
.map((value) => value.match(HEADER_EXTRACT_REGEXP).groups)
|
|
24
24
|
.forEach(({ rawKey, value }) => {
|
|
25
|
+
var _a;
|
|
25
26
|
const normalizedHeader = rawKey.toLowerCase().trim();
|
|
26
|
-
const values = headers[normalizedHeader]
|
|
27
|
-
if (value
|
|
27
|
+
const values = (_a = headers[normalizedHeader]) !== null && _a !== void 0 ? _a : [];
|
|
28
|
+
if (value === null || value === void 0 ? void 0 : value.trim()) {
|
|
28
29
|
values.push(value.trim());
|
|
29
30
|
}
|
|
30
31
|
headers[normalizedHeader] = values;
|
|
@@ -33,11 +34,12 @@ function headerStringToHeaders(rawHeader) {
|
|
|
33
34
|
}
|
|
34
35
|
exports.headerStringToHeaders = headerStringToHeaders;
|
|
35
36
|
function headerStringToProtocol(rawHeader) {
|
|
37
|
+
var _a, _b, _c;
|
|
36
38
|
if (!rawHeader) {
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
|
-
const firstRowTrimmed = rawHeader.split(/\r?\n/, 2)
|
|
40
|
-
return firstRowTrimmed
|
|
41
|
+
const firstRowTrimmed = (_b = (_a = rawHeader.split(/\r?\n/, 2)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.trim();
|
|
42
|
+
return (_c = firstRowTrimmed === null || firstRowTrimmed === void 0 ? void 0 : firstRowTrimmed.match(/\s(\S+)$/)) === null || _c === void 0 ? void 0 : _c[1];
|
|
41
43
|
}
|
|
42
44
|
exports.headerStringToProtocol = headerStringToProtocol;
|
|
43
45
|
function headerRecordToHeaderMultiMap(input) {
|
|
@@ -48,7 +50,7 @@ function headerRecordToHeaderMultiMap(input) {
|
|
|
48
50
|
return result;
|
|
49
51
|
}
|
|
50
52
|
function handleRawResponseBody(body) {
|
|
51
|
-
body = body
|
|
53
|
+
body = body !== null && body !== void 0 ? body : '';
|
|
52
54
|
switch (typeof body) {
|
|
53
55
|
case 'number':
|
|
54
56
|
return { body: body.toString(), responseSize: 8 };
|
|
@@ -112,15 +114,16 @@ class RequestInterceptor {
|
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
handleRequest(config) {
|
|
117
|
+
var _a, _b, _c;
|
|
115
118
|
try {
|
|
116
119
|
const requestId = (0, uuid_1.v4)();
|
|
117
120
|
config.mablRequestId = requestId;
|
|
118
121
|
const requestResponseChain = {
|
|
119
122
|
requestId,
|
|
120
123
|
request: {
|
|
121
|
-
headers: config.headers
|
|
122
|
-
url: config
|
|
123
|
-
method: config.method
|
|
124
|
+
headers: (_a = config.headers) !== null && _a !== void 0 ? _a : {},
|
|
125
|
+
url: (_b = config === null || config === void 0 ? void 0 : config.url) !== null && _b !== void 0 ? _b : '<Unknown URL>',
|
|
126
|
+
method: (_c = config.method) === null || _c === void 0 ? void 0 : _c.toUpperCase(),
|
|
124
127
|
request_sent_time: Date.now(),
|
|
125
128
|
},
|
|
126
129
|
};
|
|
@@ -141,7 +144,7 @@ class RequestInterceptor {
|
|
|
141
144
|
const request = response.request;
|
|
142
145
|
if (request) {
|
|
143
146
|
chainEntry.request.headers = headerStringToHeaders(request._header);
|
|
144
|
-
chainEntry.request.protocol = request
|
|
147
|
+
chainEntry.request.protocol = (request === null || request === void 0 ? void 0 : request._header)
|
|
145
148
|
? headerStringToProtocol(request._header)
|
|
146
149
|
: '<Unknown protocol>';
|
|
147
150
|
}
|
|
@@ -151,7 +154,7 @@ class RequestInterceptor {
|
|
|
151
154
|
headers: headerRecordToHeaderMultiMap(response.headers),
|
|
152
155
|
status: response.status,
|
|
153
156
|
response_received_time: responseReceivedTime,
|
|
154
|
-
response_size: contentLength
|
|
157
|
+
response_size: contentLength !== null && contentLength !== void 0 ? contentLength : responseSize,
|
|
155
158
|
body,
|
|
156
159
|
};
|
|
157
160
|
}
|
|
@@ -161,6 +164,7 @@ class RequestInterceptor {
|
|
|
161
164
|
return response;
|
|
162
165
|
}
|
|
163
166
|
handleError(error) {
|
|
167
|
+
var _a;
|
|
164
168
|
try {
|
|
165
169
|
const config = error.config;
|
|
166
170
|
let chainEntry;
|
|
@@ -173,7 +177,7 @@ class RequestInterceptor {
|
|
|
173
177
|
}
|
|
174
178
|
if (chainEntry) {
|
|
175
179
|
chainEntry.error = {
|
|
176
|
-
code: error.code
|
|
180
|
+
code: (_a = error.code) !== null && _a !== void 0 ? _a : httpUtil_1.GENERAL_API_STEP_EXECUTION_ERROR_CODE,
|
|
177
181
|
message: error.message,
|
|
178
182
|
error_received_time: Date.now(),
|
|
179
183
|
};
|