@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
|
@@ -15,12 +15,13 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
15
15
|
this.isSilent = !!isSilent;
|
|
16
16
|
}
|
|
17
17
|
async pollingFunction(mablApi, lastEntity, seedId) {
|
|
18
|
+
var _a, _b;
|
|
18
19
|
if (!seedId) {
|
|
19
20
|
throw new Error('event id must be passed');
|
|
20
21
|
}
|
|
21
22
|
const latestResults = await mablApi.getDeploymentResults(seedId);
|
|
22
23
|
if (this.exitOnFirstFailure) {
|
|
23
|
-
if (latestResults.plan_execution_metrics
|
|
24
|
+
if ((_b = (_a = latestResults.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.failed) !== null && _b !== void 0 ? _b : 0 > 0) {
|
|
24
25
|
this.exitOnFirstFailurePresenter(latestResults);
|
|
25
26
|
return {
|
|
26
27
|
newEntity: latestResults,
|
|
@@ -28,8 +29,8 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
const hasOutcomePayload = latestResults
|
|
32
|
-
Object.keys(latestResults
|
|
32
|
+
const hasOutcomePayload = (latestResults === null || latestResults === void 0 ? void 0 : latestResults.event_status) &&
|
|
33
|
+
Object.keys(latestResults === null || latestResults === void 0 ? void 0 : latestResults.event_status).length > 0;
|
|
33
34
|
const status = hasOutcomePayload
|
|
34
35
|
? awaitCompletion_1.PollingOutcomeType.Complete
|
|
35
36
|
: awaitCompletion_1.PollingOutcomeType.Running;
|
|
@@ -39,13 +40,14 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
statusPresenter(lastEntity) {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
44
|
if (this.isSilent) {
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
47
|
const elapsedTimeString = (0, timeUtil_1.elapsedTimeDurationToString)(this.getElapsedMilliseconds());
|
|
46
|
-
const passed = lastEntity.plan_execution_metrics
|
|
47
|
-
const failed = lastEntity.plan_execution_metrics
|
|
48
|
-
const total = lastEntity.plan_execution_metrics
|
|
48
|
+
const passed = (_b = (_a = lastEntity.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : 0;
|
|
49
|
+
const failed = (_d = (_c = lastEntity.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed) !== null && _d !== void 0 ? _d : 0;
|
|
50
|
+
const total = (_f = (_e = lastEntity.plan_execution_metrics) === null || _e === void 0 ? void 0 : _e.total) !== null && _f !== void 0 ? _f : 0;
|
|
49
51
|
const passedColor = passed === 0 ? 'gray' : 'green';
|
|
50
52
|
const failedColor = failed === 0 ? 'gray' : 'red';
|
|
51
53
|
let totalColor = 'gray';
|
|
@@ -189,6 +189,7 @@ exports.builder = (yargs) => {
|
|
|
189
189
|
};
|
|
190
190
|
exports.handler = (0, util_1.failWrapper)(createDeployment);
|
|
191
191
|
async function createDeployment(parsed) {
|
|
192
|
+
var _a, _b, _c;
|
|
192
193
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
|
|
193
194
|
if (parsed.output) {
|
|
194
195
|
parsed.silent = true;
|
|
@@ -203,7 +204,7 @@ async function createDeployment(parsed) {
|
|
|
203
204
|
const environmentOverride = parsed[constants_1.CommandArgOverrideEnvironmentId];
|
|
204
205
|
let deploymentIds;
|
|
205
206
|
if (environmentOverride) {
|
|
206
|
-
deploymentIds = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments
|
|
207
|
+
deploymentIds = (_a = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments) === null || _a === void 0 ? void 0 : _a.map((deployment) => deployment.id);
|
|
207
208
|
if (!deploymentIds || deploymentIds.length === 0) {
|
|
208
209
|
loggingProvider_1.logger.error(chalk.red.bold(`Application ${applicationId} is not defined in override environment ${environmentOverride}`));
|
|
209
210
|
process.exit(1);
|
|
@@ -241,7 +242,7 @@ async function createDeployment(parsed) {
|
|
|
241
242
|
}
|
|
242
243
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
243
244
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
244
|
-
const isSuccess = pollingResult
|
|
245
|
+
const isSuccess = ((_c = (_b = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _b === void 0 ? void 0 : _b.event_status) === null || _c === void 0 ? void 0 : _c.succeeded) || false;
|
|
245
246
|
try {
|
|
246
247
|
await (0, codeInsights_1.maybeOutputToBitbucket)(pollingResult.newEntity, deploymentEvent.id, outputWebappLink);
|
|
247
248
|
}
|
|
@@ -249,7 +250,7 @@ async function createDeployment(parsed) {
|
|
|
249
250
|
loggingProvider_1.logger.info(chalk.yellow.bold('Unable to generate code insights due to BitBucket integration API error'));
|
|
250
251
|
loggingProvider_1.logger.info(`details: ${error}`);
|
|
251
252
|
}
|
|
252
|
-
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult
|
|
253
|
+
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity);
|
|
253
254
|
if (!isSuccess) {
|
|
254
255
|
process.exit(1);
|
|
255
256
|
}
|
|
@@ -271,19 +272,20 @@ function printDeploymentEventResultOutput(deploymentEventId, outputWebappLink, o
|
|
|
271
272
|
}
|
|
272
273
|
exports.printDeploymentEventResultOutput = printDeploymentEventResultOutput;
|
|
273
274
|
async function collectSourceControlMetadataIfEnabled(parsed) {
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
274
276
|
const userSuppliedRepositoryUrl = parsed['repository-url'];
|
|
275
277
|
if (await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.enableSourceControlMetadataCollection)) {
|
|
276
278
|
const buildInfo = await new scmContextProvider_1.ScmContextProvider(process.env).extractScmAndBuildInfo();
|
|
277
|
-
const sourceControlBranch = buildInfo
|
|
278
|
-
const sourceControlTag = buildInfo
|
|
279
|
+
const sourceControlBranch = ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _a === void 0 ? void 0 : _a.branchName) || ((_b = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _b === void 0 ? void 0 : _b.branchName);
|
|
280
|
+
const sourceControlTag = ((_c = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _c === void 0 ? void 0 : _c.tagName) || ((_d = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _d === void 0 ? void 0 : _d.tagName);
|
|
279
281
|
const sourceControlRepoUrl = userSuppliedRepositoryUrl ||
|
|
280
|
-
buildInfo
|
|
281
|
-
buildInfo
|
|
282
|
-
const sourceControlRepoName = buildInfo
|
|
282
|
+
((_e = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _e === void 0 ? void 0 : _e.repoUrl) ||
|
|
283
|
+
((_f = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _f === void 0 ? void 0 : _f.repoUrl);
|
|
284
|
+
const sourceControlRepoName = ((_g = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _g === void 0 ? void 0 : _g.repoName) || ((_h = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _h === void 0 ? void 0 : _h.repoName);
|
|
283
285
|
const revision = parsed.revision ||
|
|
284
|
-
buildInfo
|
|
285
|
-
buildInfo
|
|
286
|
-
buildInfo
|
|
286
|
+
((_j = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _j === void 0 ? void 0 : _j.commitSha) ||
|
|
287
|
+
((_k = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _k === void 0 ? void 0 : _k.commitSha) ||
|
|
288
|
+
((_l = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _l === void 0 ? void 0 : _l.revision);
|
|
287
289
|
return {
|
|
288
290
|
branchName: sourceControlBranch,
|
|
289
291
|
tag: sourceControlTag,
|
|
@@ -11,6 +11,7 @@ const timeUtil_1 = require("../../../util/timeUtil");
|
|
|
11
11
|
const chalk = require('chalk');
|
|
12
12
|
class ExecutionResultPresenter {
|
|
13
13
|
entityToString(results, columnWidth) {
|
|
14
|
+
var _a;
|
|
14
15
|
const columnLabels = [
|
|
15
16
|
'Plan Name',
|
|
16
17
|
'Test Name',
|
|
@@ -26,14 +27,15 @@ class ExecutionResultPresenter {
|
|
|
26
27
|
tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
|
|
27
28
|
}
|
|
28
29
|
const table = new cli_table3_1.default(tableConfig);
|
|
29
|
-
const finalExecutions = results
|
|
30
|
+
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
30
31
|
finalExecutions.forEach((summary) => {
|
|
31
|
-
|
|
32
|
+
var _a, _b, _c, _d, _e;
|
|
33
|
+
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
32
34
|
const planId = summary.plan.id;
|
|
33
|
-
const planName = retryPrefix + (summary.plan
|
|
35
|
+
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
34
36
|
const planRunStatus = summary.plan_execution.status;
|
|
35
37
|
const journeyMap = new Map();
|
|
36
|
-
summary
|
|
38
|
+
(_d = summary === null || summary === void 0 ? void 0 : summary.journeys) === null || _d === void 0 ? void 0 : _d.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
37
39
|
const statusChalk = this.mapPlanRunStatusToColor(planRunStatus);
|
|
38
40
|
table.push([
|
|
39
41
|
`${planName}`,
|
|
@@ -43,12 +45,13 @@ class ExecutionResultPresenter {
|
|
|
43
45
|
statusChalk(this.maybeCapitalize(planRunStatus.toString())),
|
|
44
46
|
summaryToElapsedTime(summary),
|
|
45
47
|
]);
|
|
46
|
-
summary
|
|
48
|
+
(_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
47
50
|
const journeyId = journeyRun.journey_execution_id;
|
|
48
|
-
const journeyStatus = this.maybeCapitalize(journeyRun.status
|
|
49
|
-
const journeyBrowser = this.maybeCapitalize(journeyRun.browser_type
|
|
51
|
+
const journeyStatus = this.maybeCapitalize((_b = (_a = journeyRun.status) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '<status unavailable>');
|
|
52
|
+
const journeyBrowser = this.maybeCapitalize((_c = journeyRun.browser_type) !== null && _c !== void 0 ? _c : '<unknown browser>');
|
|
50
53
|
const journeySummary = journeyMap.get(journeyRun.journey_id);
|
|
51
|
-
const journeyName = `${retryPrefix}${journeySummary
|
|
54
|
+
const journeyName = `${retryPrefix}${(_d = journeySummary === null || journeySummary === void 0 ? void 0 : journeySummary.name) !== null && _d !== void 0 ? _d : '<test name >'}`;
|
|
52
55
|
const statusChalk = this.mapJourneyRunStatusToColor(journeyRun.status);
|
|
53
56
|
table.push([
|
|
54
57
|
'',
|
|
@@ -37,6 +37,7 @@ function printDeployments(deployments, output) {
|
|
|
37
37
|
head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
|
|
38
38
|
});
|
|
39
39
|
deployments.forEach((deployment) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40
41
|
table.push([
|
|
41
42
|
{ rowSpan: 2, content: deployment.id, vAlign: 'center' },
|
|
42
43
|
{
|
|
@@ -49,19 +50,19 @@ function printDeployments(deployments, output) {
|
|
|
49
50
|
deployment.application_id || 'none',
|
|
50
51
|
{
|
|
51
52
|
rowSpan: 2,
|
|
52
|
-
content: deployment.run_result
|
|
53
|
+
content: (_b = (_a = deployment.run_result) === null || _a === void 0 ? void 0 : _a.journey_execution_metrics) === null || _b === void 0 ? void 0 : _b.passed,
|
|
53
54
|
vAlign: 'center',
|
|
54
55
|
hAlign: 'center',
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
rowSpan: 2,
|
|
58
|
-
content: deployment.run_result
|
|
59
|
+
content: (_d = (_c = deployment.run_result) === null || _c === void 0 ? void 0 : _c.journey_execution_metrics) === null || _d === void 0 ? void 0 : _d.failed,
|
|
59
60
|
vAlign: 'center',
|
|
60
61
|
hAlign: 'center',
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
rowSpan: 2,
|
|
64
|
-
content: deployment.run_result
|
|
65
|
+
content: (_f = (_e = deployment.run_result) === null || _e === void 0 ? void 0 : _e.journey_execution_metrics) === null || _f === void 0 ? void 0 : _f.total,
|
|
65
66
|
vAlign: 'center',
|
|
66
67
|
hAlign: 'center',
|
|
67
68
|
},
|
|
@@ -29,13 +29,14 @@ exports.builder = (yargs) => {
|
|
|
29
29
|
};
|
|
30
30
|
exports.handler = (0, util_1.failWrapper)(getWatch);
|
|
31
31
|
async function getWatch(parsed) {
|
|
32
|
+
var _a, _b;
|
|
32
33
|
const deploymentId = parsed.id;
|
|
33
34
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
34
35
|
const deploymentEvent = await apiClient.getDeploymentEvent(deploymentId);
|
|
35
36
|
const outputWebappLink = (0, create_1.getDeploymentEventWebappUrl)(deploymentEvent);
|
|
36
37
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
37
38
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
38
|
-
const isSuccess = pollingResult
|
|
39
|
+
const isSuccess = ((_b = (_a = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _a === void 0 ? void 0 : _a.event_status) === null || _b === void 0 ? void 0 : _b.succeeded) || false;
|
|
39
40
|
if (!isSuccess) {
|
|
40
41
|
process.exit(1);
|
|
41
42
|
}
|
|
@@ -98,6 +98,7 @@ function addUpdateEnvCommands(argv) {
|
|
|
98
98
|
}
|
|
99
99
|
exports.addUpdateEnvCommands = addUpdateEnvCommands;
|
|
100
100
|
async function createEnvironment(parsed) {
|
|
101
|
+
var _a;
|
|
101
102
|
let environment;
|
|
102
103
|
try {
|
|
103
104
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -120,7 +121,7 @@ async function createEnvironment(parsed) {
|
|
|
120
121
|
variables: parsed[constants_1.CommandArgVariables],
|
|
121
122
|
};
|
|
122
123
|
environment = await apiClient.createEnvironment(environment);
|
|
123
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
124
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} CREATED`));
|
|
124
125
|
const applicationId = parsed[constants_1.CommandArgApplicationId];
|
|
125
126
|
if (applicationId) {
|
|
126
127
|
loggingProvider_1.logger.info('Associating URLs with environment');
|
|
@@ -18,11 +18,12 @@ exports.builder = (yargs) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.handler = (0, util_1.failWrapper)(deleteEnvironment);
|
|
20
20
|
async function deleteEnvironment(parsed) {
|
|
21
|
+
var _a;
|
|
21
22
|
let environment;
|
|
22
23
|
try {
|
|
23
24
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
24
25
|
environment = await apiClient.deleteEnvironment(parsed.id);
|
|
25
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
26
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} DELETED`));
|
|
26
27
|
}
|
|
27
28
|
catch (error) {
|
|
28
29
|
throw new Error(`Error deleting environment: ${error}`);
|
|
@@ -21,6 +21,7 @@ exports.builder = (yargs) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.handler = (0, util_1.failWrapper)(updateEnvironment);
|
|
23
23
|
async function updateEnvironment(parsed) {
|
|
24
|
+
var _a;
|
|
24
25
|
let environment;
|
|
25
26
|
try {
|
|
26
27
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -36,7 +37,7 @@ async function updateEnvironment(parsed) {
|
|
|
36
37
|
variables: parsed[constants_1.CommandArgVariables],
|
|
37
38
|
};
|
|
38
39
|
environment = await apiClient.updateEnvironment(parsed[constants_1.CommandArgId], environment);
|
|
39
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
40
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} UPDATED`));
|
|
40
41
|
}
|
|
41
42
|
catch (error) {
|
|
42
43
|
throw new Error(`Error updating environment: ${error}`);
|
|
@@ -35,10 +35,11 @@ exports.builder = (yargs) => {
|
|
|
35
35
|
};
|
|
36
36
|
exports.handler = (0, util_1.failWrapper)(queryDeployments);
|
|
37
37
|
async function queryDeployments(parsed) {
|
|
38
|
+
var _a;
|
|
38
39
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
39
40
|
try {
|
|
40
41
|
const environment = await apiClient.getEnvironment(parsed.id);
|
|
41
|
-
const deploymentEntities = await apiClient.queryDeploymentEntities(environment.organization_id
|
|
42
|
+
const deploymentEntities = await apiClient.queryDeploymentEntities((_a = environment.organization_id) !== null && _a !== void 0 ? _a : '', environment.id, parsed[constants_1.CommandArgApplicationId], parsed.limit);
|
|
42
43
|
(0, describe_1.outputEntity)(deploymentEntities.deployments, parsed.output);
|
|
43
44
|
}
|
|
44
45
|
catch (error) {
|
|
@@ -4,7 +4,7 @@ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
|
4
4
|
const util_1 = require("../../commandUtil/util");
|
|
5
5
|
const js_yaml_1 = require("js-yaml");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
-
const
|
|
7
|
+
const execution_1 = require("../../../execution");
|
|
8
8
|
const fileUtil_1 = require("../../commandUtil/fileUtil");
|
|
9
9
|
const os = require('os');
|
|
10
10
|
const JSON_REPLACER = null;
|
|
@@ -36,11 +36,12 @@ exports.builder = (yargs) => {
|
|
|
36
36
|
};
|
|
37
37
|
exports.handler = (0, util_1.failWrapper)(pullFlow);
|
|
38
38
|
async function pullFlow(parsed) {
|
|
39
|
+
var _a;
|
|
39
40
|
const flowId = parsed.id;
|
|
40
41
|
const format = parsed.format;
|
|
41
42
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
42
43
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
43
|
-
const branchName = parsed['mabl-branch']
|
|
44
|
+
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
44
45
|
const flow = await apiClient.getFlow(flowId, branchName);
|
|
45
46
|
switch (format) {
|
|
46
47
|
case constants_1.OutputFormats.Csv:
|
|
@@ -54,7 +55,7 @@ async function pullFlow(parsed) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
function dumpYamlOrJsonToFile(type, flow, detailLevel) {
|
|
57
|
-
const flowConfig = new
|
|
58
|
+
const flowConfig = new execution_1.FlowConfig(flow, false);
|
|
58
59
|
const configGenerated = detailLevel === constants_1.DetailLevelFormats.Full
|
|
59
60
|
? flowConfig.generateConfigFile()
|
|
60
61
|
: flowConfig.generateSimpleFormat();
|
|
@@ -71,7 +72,7 @@ function dumpYamlOrJsonToFile(type, flow, detailLevel) {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
function dumpToCsv(flow) {
|
|
74
|
-
const flowConfig = new
|
|
75
|
+
const flowConfig = new execution_1.FlowConfig(flow, false);
|
|
75
76
|
const output = flowConfig.generateSimpleCsv();
|
|
76
77
|
(0, fileUtil_1.writeExportedEntityToFile)(output.join(os.EOL), 'csv', flow.id);
|
|
77
78
|
}
|
|
@@ -8,13 +8,14 @@ exports.describe = (0, util_1.getDescribeDescriptions)('plan');
|
|
|
8
8
|
exports.builder = (0, describe_1.getDescribeBuilderOptions)();
|
|
9
9
|
exports.handler = (0, util_1.failWrapper)(getPlan);
|
|
10
10
|
async function getPlan(parsed) {
|
|
11
|
+
var _a;
|
|
11
12
|
try {
|
|
12
13
|
const planId = parsed.id;
|
|
13
14
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
14
15
|
const plan = await apiClient.getPlan(planId);
|
|
15
16
|
delete plan.journeys_ddt_migration_backup;
|
|
16
17
|
(0, describe_1.outputEntity)(plan, parsed.output);
|
|
17
|
-
return plan.id
|
|
18
|
+
return (_a = plan.id) !== null && _a !== void 0 ? _a : '';
|
|
18
19
|
}
|
|
19
20
|
catch (error) {
|
|
20
21
|
throw new Error(`Error getting plan: ${error}`);
|
|
@@ -3,30 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDeviceDescriptorForEmulation = exports.getProperScreenConfig = void 0;
|
|
4
4
|
const mablApi_1 = require("../../mablApi");
|
|
5
5
|
function getProperScreenConfig(emulationConfig) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
6
7
|
switch (emulationConfig.orientation) {
|
|
7
8
|
case mablApi_1.DeviceEmulation.OrientationEnum.LandscapePrimary:
|
|
8
9
|
case mablApi_1.DeviceEmulation.OrientationEnum.LandscapeSecondary:
|
|
9
|
-
return emulationConfig.device_config
|
|
10
|
+
return (_b = (_a = emulationConfig.device_config) === null || _a === void 0 ? void 0 : _a.screen) === null || _b === void 0 ? void 0 : _b.horizontal;
|
|
10
11
|
case mablApi_1.DeviceEmulation.OrientationEnum.PortraitPrimary:
|
|
11
12
|
case mablApi_1.DeviceEmulation.OrientationEnum.PortraitSecondary:
|
|
12
|
-
return emulationConfig.device_config
|
|
13
|
+
return (_d = (_c = emulationConfig.device_config) === null || _c === void 0 ? void 0 : _c.screen) === null || _d === void 0 ? void 0 : _d.vertical;
|
|
13
14
|
default:
|
|
14
15
|
throw new Error(`Unhandled mobile orientation type [${emulationConfig.orientation}]`);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.getProperScreenConfig = getProperScreenConfig;
|
|
18
19
|
function getDeviceDescriptorForEmulation(emulationConfig) {
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
19
21
|
if (emulationConfig) {
|
|
20
22
|
const screenConfig = getProperScreenConfig(emulationConfig);
|
|
21
|
-
if (!screenConfig
|
|
23
|
+
if (!(screenConfig === null || screenConfig === void 0 ? void 0 : screenConfig.height) && !(screenConfig === null || screenConfig === void 0 ? void 0 : screenConfig.width)) {
|
|
22
24
|
throw new Error('Could not get viewport settings - invalid emulation config supplied with missing height or width');
|
|
23
25
|
}
|
|
24
26
|
return {
|
|
25
27
|
width: screenConfig.width,
|
|
26
28
|
height: screenConfig.height,
|
|
27
|
-
deviceScaleFactor: emulationConfig.device_config
|
|
29
|
+
deviceScaleFactor: (_c = (_b = (_a = emulationConfig.device_config) === null || _a === void 0 ? void 0 : _a.screen) === null || _b === void 0 ? void 0 : _b.device_pixel_ratio) !== null && _c !== void 0 ? _c : 1,
|
|
28
30
|
isMobile: isMobile(emulationConfig),
|
|
29
|
-
hasTouch: emulationConfig.device_config
|
|
31
|
+
hasTouch: (_e = (_d = emulationConfig.device_config) === null || _d === void 0 ? void 0 : _d.capabilities) === null || _e === void 0 ? void 0 : _e.includes(mablApi_1.DeviceEmulationConfiguration.CapabilitiesEnum.Touch),
|
|
30
32
|
isLandscape: emulationConfig.orientation ===
|
|
31
33
|
mablApi_1.DeviceEmulation.OrientationEnum.LandscapePrimary ||
|
|
32
34
|
emulationConfig.orientation ===
|
|
@@ -29,21 +29,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.parseBrowserType = exports.toBasicHttpAuthenticationCredentials = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.cleanupTestResources = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.createBrowser = exports.getFinalUrl = void 0;
|
|
30
30
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
31
31
|
const fs = __importStar(require("fs-extra"));
|
|
32
|
-
const mablApi_1 = require("../../mablApi");
|
|
33
32
|
const os = __importStar(require("os"));
|
|
34
33
|
const path = __importStar(require("path"));
|
|
35
34
|
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
36
35
|
const trainingSessionActions_1 = require("../../core/messaging/actions/trainingSessionActions");
|
|
37
36
|
const logLineMessaging_1 = require("../../core/messaging/logLineMessaging");
|
|
38
37
|
const messaging_1 = require("../../core/messaging/messaging");
|
|
38
|
+
const mablApi_1 = require("../../mablApi");
|
|
39
39
|
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
40
40
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
41
41
|
const fileUploadUtil_1 = require("../../util/fileUploadUtil");
|
|
42
42
|
const logUtils_1 = require("../../util/logUtils");
|
|
43
43
|
const browserTypes_1 = require("../browserTypes");
|
|
44
44
|
const constants_1 = require("../constants");
|
|
45
|
-
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
46
45
|
const utils_1 = require("../datatables/utils");
|
|
46
|
+
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
47
47
|
const chalk = require('chalk');
|
|
48
48
|
let RUNNING_TEST = false;
|
|
49
49
|
function getFinalUrl(test, parsedUrl) {
|
|
@@ -55,6 +55,7 @@ function getFinalUrl(test, parsedUrl) {
|
|
|
55
55
|
}
|
|
56
56
|
exports.getFinalUrl = getFinalUrl;
|
|
57
57
|
async function launchBrowserInstance(options) {
|
|
58
|
+
var _a;
|
|
58
59
|
const optionsProxy = await maybeGetProxyOptions(options);
|
|
59
60
|
if (optionsProxy) {
|
|
60
61
|
options = {
|
|
@@ -68,7 +69,7 @@ async function launchBrowserInstance(options) {
|
|
|
68
69
|
}
|
|
69
70
|
catch (error) {
|
|
70
71
|
if (error.message.includes('Running as root without --no-sandbox is not supported')) {
|
|
71
|
-
options.commandLineArgs
|
|
72
|
+
(_a = options.commandLineArgs) === null || _a === void 0 ? void 0 : _a.push('--no-sandbox');
|
|
72
73
|
messaging_1.mablEventEmitter.log('Unable to initialize browser with standard settings, attempting to run with --no-sandbox setting', Date.now(), logLineMessaging_1.LogLineColor.yellow);
|
|
73
74
|
return maybeLaunchBrowser(options).catch((error) => {
|
|
74
75
|
messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
|
|
@@ -84,7 +85,7 @@ async function maybeGetProxyOptions(options) {
|
|
|
84
85
|
const proxyServer = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.test
|
|
85
86
|
.proxyHost;
|
|
86
87
|
let optionsProxy;
|
|
87
|
-
if (options
|
|
88
|
+
if (options === null || options === void 0 ? void 0 : options.proxy) {
|
|
88
89
|
optionsProxy = {
|
|
89
90
|
server: options.proxy.server,
|
|
90
91
|
username: options.proxy.username,
|
|
@@ -101,7 +102,7 @@ async function maybeGetProxyOptions(options) {
|
|
|
101
102
|
return optionsProxy;
|
|
102
103
|
}
|
|
103
104
|
function maybeLaunchBrowser(options) {
|
|
104
|
-
return browserLauncher_1.BrowserLauncherFactory.createRunner(options
|
|
105
|
+
return browserLauncher_1.BrowserLauncherFactory.createRunner(options === null || options === void 0 ? void 0 : options.runnerType, options === null || options === void 0 ? void 0 : options.loggerFunc).launch(options);
|
|
105
106
|
}
|
|
106
107
|
function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
107
108
|
try {
|
|
@@ -367,8 +368,8 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
367
368
|
.forEach((label) => distinctLabels.add(label));
|
|
368
369
|
return [...distinctLabels];
|
|
369
370
|
}
|
|
370
|
-
const labelsInclude = cleanLabels(suppliedLabelsInclude
|
|
371
|
-
const labelsExclude = cleanLabels(suppliedLabelsExclude
|
|
371
|
+
const labelsInclude = cleanLabels(suppliedLabelsInclude !== null && suppliedLabelsInclude !== void 0 ? suppliedLabelsInclude : []);
|
|
372
|
+
const labelsExclude = cleanLabels(suppliedLabelsExclude !== null && suppliedLabelsExclude !== void 0 ? suppliedLabelsExclude : []);
|
|
372
373
|
if (labelsInclude.length > 0 && labelsExclude.length > 0) {
|
|
373
374
|
const intersection = labelsInclude.filter((label) => labelsExclude.includes(label));
|
|
374
375
|
if (intersection.length > 0) {
|
|
@@ -395,58 +396,60 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
395
396
|
}
|
|
396
397
|
exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
|
|
397
398
|
async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
399
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
398
400
|
const journeyRun = await apiClient.getTestRun(testRunId);
|
|
399
401
|
const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
|
|
400
|
-
const testDatatablevariables = journeyRun
|
|
401
|
-
(0, utils_1.variableRowAsScenario)(journeyRun
|
|
402
|
+
const testDatatablevariables = ((_a = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _a === void 0 ? void 0 : _a.user_variables) &&
|
|
403
|
+
(0, utils_1.variableRowAsScenario)((_b = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _b === void 0 ? void 0 : _b.user_variables);
|
|
402
404
|
return {
|
|
403
|
-
basicAuthCredentialsId: planRun
|
|
404
|
-
? planRun
|
|
405
|
+
basicAuthCredentialsId: ((_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.http_auth_credentials_required)
|
|
406
|
+
? (_d = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _d === void 0 ? void 0 : _d.http_auth_credentials_id
|
|
405
407
|
: undefined,
|
|
406
|
-
branchName: journeyRun.journey_parameters
|
|
407
|
-
credentialsId: planRun.run_policy
|
|
408
|
-
? planRun.run_policy
|
|
408
|
+
branchName: (_e = journeyRun.journey_parameters) === null || _e === void 0 ? void 0 : _e.source_control_tag,
|
|
409
|
+
credentialsId: ((_f = planRun.run_policy) === null || _f === void 0 ? void 0 : _f.credentials_required)
|
|
410
|
+
? (_g = planRun.run_policy) === null || _g === void 0 ? void 0 : _g.credentials_id
|
|
409
411
|
: undefined,
|
|
410
412
|
dataTableVariables: testDatatablevariables,
|
|
411
|
-
deviceEmulation: journeyRun.journey_parameters
|
|
412
|
-
environmentId: journeyRun.journey_parameters
|
|
413
|
+
deviceEmulation: (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.device_emulation,
|
|
414
|
+
environmentId: (_k = (_j = journeyRun.journey_parameters) === null || _j === void 0 ? void 0 : _j.deployment) === null || _k === void 0 ? void 0 : _k.environment_id,
|
|
413
415
|
filterHttpRequests: false,
|
|
414
|
-
importedVariables: journeyRun.journey_parameters
|
|
415
|
-
|
|
416
|
+
importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
|
|
417
|
+
localizationOptions: journeyRun.localization_options,
|
|
418
|
+
pageLoadWait: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.page_load_wait,
|
|
416
419
|
runId: journeyRun.id,
|
|
417
|
-
testId: journeyRun.journey
|
|
418
|
-
url: journeyRun.journey_parameters
|
|
420
|
+
testId: (_o = journeyRun.journey) === null || _o === void 0 ? void 0 : _o.invariant_id,
|
|
421
|
+
url: (_q = (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.deployment) === null || _q === void 0 ? void 0 : _q.uri,
|
|
419
422
|
};
|
|
420
423
|
}
|
|
421
424
|
exports.pullDownTestRunConfig = pullDownTestRunConfig;
|
|
422
425
|
async function extractTestRunConfig(executionMessage, apiClient) {
|
|
423
|
-
|
|
424
|
-
|
|
426
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
427
|
+
const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
|
|
425
428
|
const planRun = executionMessage.plan_run;
|
|
426
|
-
const maybeRunnerType = planRun
|
|
427
|
-
?.nodejs_runtime_variant
|
|
429
|
+
const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
|
|
428
430
|
?
|
|
429
|
-
planRun
|
|
431
|
+
(_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.nodejs_runtime_variant
|
|
430
432
|
: undefined;
|
|
431
433
|
return {
|
|
432
|
-
branchName: journeyRun
|
|
433
|
-
basicAuthCredentialsId: planRun
|
|
434
|
-
? planRun
|
|
434
|
+
branchName: (_d = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _d === void 0 ? void 0 : _d.source_control_tag,
|
|
435
|
+
basicAuthCredentialsId: ((_e = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _e === void 0 ? void 0 : _e.http_auth_credentials_required)
|
|
436
|
+
? (_f = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _f === void 0 ? void 0 : _f.http_auth_credentials_id
|
|
435
437
|
: undefined,
|
|
436
|
-
credentialsId: planRun
|
|
437
|
-
? planRun
|
|
438
|
+
credentialsId: ((_g = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _g === void 0 ? void 0 : _g.credentials_required)
|
|
439
|
+
? (_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.credentials_id
|
|
438
440
|
: undefined,
|
|
439
|
-
dataTableVariables: journeyRun
|
|
440
|
-
(0, utils_1.variableRowAsScenario)(journeyRun
|
|
441
|
-
deviceEmulation: journeyRun
|
|
442
|
-
environmentId: journeyRun
|
|
441
|
+
dataTableVariables: ((_j = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _j === void 0 ? void 0 : _j.user_variables) &&
|
|
442
|
+
(0, utils_1.variableRowAsScenario)((_k = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.user_variables),
|
|
443
|
+
deviceEmulation: (_l = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.device_emulation,
|
|
444
|
+
environmentId: (_o = (_m = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.deployment) === null || _o === void 0 ? void 0 : _o.environment_id,
|
|
443
445
|
filterHttpRequests: true,
|
|
444
|
-
importedVariables: journeyRun.journey_parameters
|
|
445
|
-
|
|
446
|
+
importedVariables: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.imported_variables,
|
|
447
|
+
localizationOptions: journeyRun.localization_options,
|
|
448
|
+
pageLoadWait: (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.page_load_wait,
|
|
446
449
|
runId: journeyRun.id,
|
|
447
450
|
runnerType: maybeRunnerType,
|
|
448
|
-
testId: journeyRun
|
|
449
|
-
url: journeyRun
|
|
451
|
+
testId: (_r = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _r === void 0 ? void 0 : _r.invariant_id,
|
|
452
|
+
url: (_t = (_s = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _s === void 0 ? void 0 : _s.deployment) === null || _t === void 0 ? void 0 : _t.uri,
|
|
450
453
|
};
|
|
451
454
|
}
|
|
452
455
|
exports.extractTestRunConfig = extractTestRunConfig;
|
|
@@ -455,7 +458,7 @@ function calculateTotalTimeSeconds(startTimeMillis, endTimeMillis) {
|
|
|
455
458
|
}
|
|
456
459
|
exports.calculateTotalTimeSeconds = calculateTotalTimeSeconds;
|
|
457
460
|
function milliSecondsToSeconds(timeMs) {
|
|
458
|
-
return Math.round((timeMs
|
|
461
|
+
return Math.round((timeMs !== null && timeMs !== void 0 ? timeMs : 0) / 100) / 10;
|
|
459
462
|
}
|
|
460
463
|
exports.milliSecondsToSeconds = milliSecondsToSeconds;
|
|
461
464
|
function logTestInfoIfPresent(description, infoArg) {
|
|
@@ -468,13 +471,14 @@ function createDownloadDirectory() {
|
|
|
468
471
|
return fs.mkdtempSync(path.join(os.tmpdir(), `mablTestRun-${Date.now()}-`));
|
|
469
472
|
}
|
|
470
473
|
function toBasicHttpAuthenticationCredentials(credentials) {
|
|
474
|
+
var _a, _b, _c, _d, _e;
|
|
471
475
|
if (credentials === undefined ||
|
|
472
|
-
credentials.properties
|
|
476
|
+
((_a = credentials.properties) === null || _a === void 0 ? void 0 : _a.username) === undefined) {
|
|
473
477
|
return undefined;
|
|
474
478
|
}
|
|
475
479
|
return {
|
|
476
|
-
username: credentials.properties
|
|
477
|
-
password: credentials.properties
|
|
480
|
+
username: (_c = (_b = credentials.properties) === null || _b === void 0 ? void 0 : _b.username) !== null && _c !== void 0 ? _c : '',
|
|
481
|
+
password: (_e = (_d = credentials.properties) === null || _d === void 0 ? void 0 : _d.password) !== null && _e !== void 0 ? _e : '',
|
|
478
482
|
};
|
|
479
483
|
}
|
|
480
484
|
exports.toBasicHttpAuthenticationCredentials = toBasicHttpAuthenticationCredentials;
|
|
@@ -56,13 +56,14 @@ exports.builder = (yargs) => {
|
|
|
56
56
|
};
|
|
57
57
|
exports.handler = (0, util_1.failWrapper)(exportTest);
|
|
58
58
|
async function exportTest(parsed) {
|
|
59
|
+
var _a;
|
|
59
60
|
const testId = parsed.id;
|
|
60
61
|
const format = parsed.format;
|
|
61
62
|
const environmentId = parsed[constants_1.CommandArgEnvironmentId];
|
|
62
63
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
63
64
|
const fileName = parsed[constants_1.CommandArgOutputFilePath];
|
|
64
65
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
65
|
-
const branchName = parsed['mabl-branch']
|
|
66
|
+
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
66
67
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
67
68
|
if (journey.test_type === mablApi_1.TestTypeEnum.Performance) {
|
|
68
69
|
throw new Error('Export functionality is not yet available for performance tests.');
|
|
@@ -124,7 +124,7 @@ async function importTest(parsed) {
|
|
|
124
124
|
return handlePostImportActions(workspaceId, name, apiClient, importedTests, parsed.autoSave);
|
|
125
125
|
}
|
|
126
126
|
function getTestName(name) {
|
|
127
|
-
const nameValidator = (value) => !value
|
|
127
|
+
const nameValidator = (value) => !(value === null || value === void 0 ? void 0 : value.length) ? 'Name must not be empty' : true;
|
|
128
128
|
return name
|
|
129
129
|
? Promise.resolve(name)
|
|
130
130
|
: inquirer
|
|
@@ -242,8 +242,9 @@ function displayTestDescriptions(importedTests) {
|
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
async function runTests(workspaceId, name, apiClient, importedTests) {
|
|
245
|
+
var _a, _b;
|
|
245
246
|
const flows = importedTests.map((steps) => stepsToFlow(workspaceId, steps));
|
|
246
|
-
const firstUrl = flows.find((flow) => flow.url)
|
|
247
|
+
const firstUrl = (_a = flows.find((flow) => flow.url)) === null || _a === void 0 ? void 0 : _a.url;
|
|
247
248
|
const browserPath = await new chromiumBrowserEngine_1.ChromiumBrowserEngine().findBrowserExecutable();
|
|
248
249
|
for (let flowIndex = 0; flowIndex < flows.length; flowIndex++) {
|
|
249
250
|
loggingProvider_1.logger.info(`Running test ${flowIndex + 1} of ${flows.length}.`);
|
|
@@ -252,7 +253,7 @@ async function runTests(workspaceId, name, apiClient, importedTests) {
|
|
|
252
253
|
organization_id: workspaceId,
|
|
253
254
|
name,
|
|
254
255
|
flows: [],
|
|
255
|
-
url: flow.url
|
|
256
|
+
url: (_b = flow.url) !== null && _b !== void 0 ? _b : firstUrl,
|
|
256
257
|
};
|
|
257
258
|
const testRunner = await createTestRunner(apiClient, journey, flow, journey.url, workspaceId, browserPath);
|
|
258
259
|
const results = await testRunner.run();
|
|
@@ -268,7 +269,7 @@ function stepsToFlow(workspaceId, steps) {
|
|
|
268
269
|
reusable: false,
|
|
269
270
|
selectors: steps
|
|
270
271
|
.map((step) => step.selector)
|
|
271
|
-
.map((selector) => selector
|
|
272
|
+
.map((selector) => selector === null || selector === void 0 ? void 0 : selector.toMablscriptSelector())
|
|
272
273
|
.filter((selector) => selector)
|
|
273
274
|
.map((selector) => selector),
|
|
274
275
|
script: steps.map((step) => step.mablscript).join('\n'),
|