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