@mablhq/mabl-cli 2.79.1 → 2.79.9
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/mablApiClient.js +10 -10
- package/browserLauncher/index.js +1 -1
- package/commands/mcp/mcp_cmds/utils/testUtils.js +4 -3
- package/commands/tests/testsUtil.js +31 -56
- package/core/trainer/openUtils.js +10 -5
- package/execution/index.js +1 -1
- package/http/axiosProxyConfig.js +32 -8
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ exports.getTestOutputUrl = getTestOutputUrl;
|
|
|
7
7
|
exports.getCreateTestOutputText = getCreateTestOutputText;
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
9
|
const env_1 = require("../../../../env/env");
|
|
10
|
+
const openUtils_1 = require("../../../../core/trainer/openUtils");
|
|
10
11
|
exports.testOutputSchema = zod_1.z.object({
|
|
11
12
|
id: zod_1.z.string(),
|
|
12
13
|
name: zod_1.z.string(),
|
|
@@ -53,7 +54,7 @@ function getTestOutputUrl(workspaceId, testRunId) {
|
|
|
53
54
|
return `${env_1.BASE_APP_URL}/workspaces/${workspaceId}/output/test-runs/${testRunId}`;
|
|
54
55
|
}
|
|
55
56
|
function getCreateTestOutputText(trainerUrl) {
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
return process.platform === openUtils_1.WIN32_PLATFORM
|
|
58
|
+
? `Tell the user to open the following URL to launch the mabl trainer: ${trainerUrl}. Show it using a link, trying to hide the full URL. If you have a tool that can open a link use it.`
|
|
59
|
+
: `A mabl trainer was launched. If you don't see the trainer running, open the following URL: ${trainerUrl} to open the trainer manually (Show the URL to the user using and explain to the user how to open it. If you have a tool that can open a link use it.).`;
|
|
59
60
|
}
|
|
@@ -408,44 +408,42 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
408
408
|
}
|
|
409
409
|
return true;
|
|
410
410
|
}
|
|
411
|
-
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const testDatatablevariables = journeyRun?.journey_parameters?.user_variables &&
|
|
415
|
-
(0, utils_1.variableRowAsScenario)(journeyRun?.journey_parameters?.user_variables);
|
|
416
|
-
const dataTableId = testDatatablevariables?.table_id;
|
|
417
|
-
if (dataTableId) {
|
|
418
|
-
await apiClient.getDataTable(dataTableId);
|
|
419
|
-
}
|
|
411
|
+
function buildTestRunConfig(testRun, filterHttpRequests, planRun) {
|
|
412
|
+
const testDatatablevariables = testRun.journey_parameters?.user_variables &&
|
|
413
|
+
(0, utils_1.variableRowAsScenario)(testRun.journey_parameters?.user_variables);
|
|
420
414
|
return {
|
|
421
|
-
basicAuthCredentialsId:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
415
|
+
basicAuthCredentialsId: testRun.journey_parameters?.http_auth_credentials_id ??
|
|
416
|
+
(planRun?.run_policy?.http_auth_credentials_required
|
|
417
|
+
? planRun?.run_policy?.http_auth_credentials_id
|
|
418
|
+
: undefined),
|
|
419
|
+
branchName: testRun.journey_parameters?.source_control_tag,
|
|
420
|
+
credentialsId: testRun.journey_parameters?.credentials_id ??
|
|
421
|
+
(planRun?.run_policy?.credentials_required
|
|
422
|
+
? planRun?.run_policy?.credentials_id
|
|
423
|
+
: undefined),
|
|
428
424
|
dataTableVariables: testDatatablevariables,
|
|
429
|
-
deviceEmulation:
|
|
430
|
-
environmentId:
|
|
425
|
+
deviceEmulation: testRun.journey_parameters?.device_emulation,
|
|
426
|
+
environmentId: testRun.journey_parameters?.deployment?.environment_id,
|
|
431
427
|
extraHttpHeaders: planRun?.run_policy?.http_headers_required === true
|
|
432
|
-
? planRun?.run_policy?.http_headers
|
|
433
|
-
...headers,
|
|
434
|
-
[header.name]: header.value ?? '',
|
|
435
|
-
}), {})
|
|
428
|
+
? headerArrayToRecord(planRun?.run_policy?.http_headers)
|
|
436
429
|
: undefined,
|
|
437
|
-
filterHttpRequests
|
|
438
|
-
importedVariables:
|
|
439
|
-
linkCrawlerStartingUrlOverride: getLinkCrawlerUrlOverride(
|
|
440
|
-
localizationOptions:
|
|
441
|
-
pageLoadWait:
|
|
442
|
-
runId:
|
|
443
|
-
testId:
|
|
444
|
-
url:
|
|
430
|
+
filterHttpRequests,
|
|
431
|
+
importedVariables: testRun.journey_parameters?.imported_variables,
|
|
432
|
+
linkCrawlerStartingUrlOverride: getLinkCrawlerUrlOverride(testRun),
|
|
433
|
+
localizationOptions: testRun.localization_options,
|
|
434
|
+
pageLoadWait: testRun.journey_parameters?.page_load_wait,
|
|
435
|
+
runId: testRun.id,
|
|
436
|
+
testId: testRun.journey?.invariant_id,
|
|
437
|
+
url: testRun.journey_parameters?.deployment?.uri,
|
|
445
438
|
};
|
|
446
439
|
}
|
|
440
|
+
async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
441
|
+
const testRun = await apiClient.getTestRun(testRunId);
|
|
442
|
+
const planRun = await apiClient.getPlanRun(testRun.parent_execution);
|
|
443
|
+
return buildTestRunConfig(testRun, false, planRun);
|
|
444
|
+
}
|
|
447
445
|
async function extractTestRunConfig(executionMessage, apiClient) {
|
|
448
|
-
const
|
|
446
|
+
const testRun = executionMessage.journey_run ??
|
|
449
447
|
(await apiClient.getTestRun(executionMessage.journey_run_id));
|
|
450
448
|
const planRun = executionMessage.plan_run;
|
|
451
449
|
const maybeRunnerType = planRun?.run_policy
|
|
@@ -453,31 +451,8 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
453
451
|
?
|
|
454
452
|
planRun?.run_policy?.nodejs_runtime_variant
|
|
455
453
|
: undefined;
|
|
456
|
-
const config =
|
|
457
|
-
|
|
458
|
-
? planRun?.run_policy?.http_auth_credentials_id
|
|
459
|
-
: undefined,
|
|
460
|
-
branchName: journeyRun?.journey_parameters?.source_control_tag,
|
|
461
|
-
credentialsId: planRun?.run_policy?.credentials_required
|
|
462
|
-
? planRun?.run_policy?.credentials_id
|
|
463
|
-
: undefined,
|
|
464
|
-
dataTableVariables: journeyRun?.journey_parameters?.user_variables &&
|
|
465
|
-
(0, utils_1.variableRowAsScenario)(journeyRun?.journey_parameters?.user_variables),
|
|
466
|
-
deviceEmulation: journeyRun?.journey_parameters?.device_emulation,
|
|
467
|
-
environmentId: journeyRun?.journey_parameters?.deployment?.environment_id,
|
|
468
|
-
extraHttpHeaders: planRun?.run_policy?.http_headers_required === true
|
|
469
|
-
? headerArrayToRecord(planRun?.run_policy?.http_headers)
|
|
470
|
-
: undefined,
|
|
471
|
-
filterHttpRequests: true,
|
|
472
|
-
importedVariables: journeyRun.journey_parameters?.imported_variables,
|
|
473
|
-
linkCrawlerStartingUrlOverride: getLinkCrawlerUrlOverride(journeyRun),
|
|
474
|
-
localizationOptions: journeyRun.localization_options,
|
|
475
|
-
pageLoadWait: journeyRun.journey_parameters?.page_load_wait,
|
|
476
|
-
runId: journeyRun.id,
|
|
477
|
-
runnerType: maybeRunnerType,
|
|
478
|
-
testId: journeyRun?.journey?.invariant_id,
|
|
479
|
-
url: journeyRun?.journey_parameters?.deployment?.uri,
|
|
480
|
-
};
|
|
454
|
+
const config = buildTestRunConfig(testRun, true, planRun);
|
|
455
|
+
config.runnerType = maybeRunnerType;
|
|
481
456
|
if (executionMessage.test_type === mablApi_1.TestTypeEnum.Mobile) {
|
|
482
457
|
const mobileMessage = executionMessage;
|
|
483
458
|
config.mobileConfig = {
|
|
@@ -63,12 +63,17 @@ async function createConfigServer(config) {
|
|
|
63
63
|
return new Promise((resolve, reject) => {
|
|
64
64
|
server.listen(0, () => {
|
|
65
65
|
const port = server.address().port;
|
|
66
|
-
const requestPromise = new Promise((resolveRequest
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const requestPromise = new Promise((resolveRequest) => {
|
|
67
|
+
let timeout;
|
|
68
|
+
if (process.platform !== exports.WIN32_PLATFORM) {
|
|
69
|
+
timeout = (0, timers_1.setTimeout)(() => {
|
|
70
|
+
resolveRequest();
|
|
71
|
+
}, 20_000);
|
|
72
|
+
}
|
|
70
73
|
server.on('close', () => {
|
|
71
|
-
|
|
74
|
+
if (timeout) {
|
|
75
|
+
global.clearTimeout(timeout);
|
|
76
|
+
}
|
|
72
77
|
resolveRequest();
|
|
73
78
|
});
|
|
74
79
|
});
|