@mablhq/mabl-cli 1.12.20 → 1.13.14
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 -11
- package/api/mablApiClient.js +9 -9
- package/api/mablApiClientFactory.js +1 -0
- package/auth/AuthClient.js +1 -4
- package/browserLauncher/browserLauncherFactory.js +7 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +61 -21
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +24 -17
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +72 -68
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +7 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +13 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +7 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +4 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +23 -16
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/types.js +6 -1
- package/cli.js +6 -4
- package/commands/applications/applications_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/create.js +1 -1
- package/commands/branches/branches_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/merge.js +1 -1
- package/commands/commandUtil/awaitCompletion.js +2 -2
- package/commands/commandUtil/codeInsights.js +6 -6
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +12 -12
- package/commands/config/config_cmds/list.js +1 -1
- package/commands/constants.js +1 -1
- package/commands/credentials/credentials_cmds/list.js +1 -1
- package/commands/deploy/deploy_cmds/create.js +2 -2
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +7 -7
- package/commands/deploy/deploy_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/create.js +3 -3
- package/commands/environments/environments_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/urls_cmds/add.js +1 -1
- package/commands/flows/flows_cmds/list.js +1 -1
- package/commands/plans/plans_cmds/list.js +1 -1
- package/commands/test-runs/test-runs_cmds/export.js +1 -1
- package/commands/tests/executionUtil.js +1 -1
- package/commands/tests/testsUtil.js +16 -20
- package/commands/tests/tests_cmds/edit.js +1 -1
- package/commands/tests/tests_cmds/export.js +1 -1
- package/commands/tests/tests_cmds/import.js +13 -13
- package/commands/tests/tests_cmds/list.js +2 -2
- package/commands/tests/tests_cmds/run-alpha.js +1 -1
- package/commands/tests/tests_cmds/run-cloud.js +7 -7
- package/commands/tests/tests_cmds/run-legacy.js +2 -2
- package/commands/tests/tests_cmds/run.js +25 -7
- package/commands/workspaces/workspace_cmds/copy.js +1 -1
- package/commands/workspaces/workspace_cmds/list.js +1 -1
- package/configGenerators/flowConfigGenerator.js +3 -3
- package/configGenerators/selIdeGenerator.js +1 -1
- package/configGenerators/testConfigGenerator.js +7 -8
- package/core/execution/ApiTestUtils.js +2 -2
- package/core/trainer/openUtils.js +47 -0
- package/core/trainer/trainingSessions.js +36 -61
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +12 -0
- package/index.d.ts +7 -0
- package/mablApi/index.js +1 -1
- package/mablscript/MablStep.js +11 -7
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +4 -4
- package/mablscript/importer.js +16 -14
- package/mablscript/steps/AccessibilityCheck.js +88 -0
- package/mablscript/steps/AssertStep.js +6 -5
- package/mablscript/steps/CreateVariableStep.js +2 -3
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/IfConditionStep.js +3 -3
- package/mablscript/steps/SendHttpRequestStep.js +11 -3
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetFilesStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +2 -1
- package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
- package/mablscript/types/AccessibilityCheckTypes.js +9 -0
- package/mablscript/types/VariableDataType.js +1 -8
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +8 -5
- package/popupDismissal/index.js +16 -17
- package/providers/authenticationProvider.js +2 -3
- package/providers/cliConfigProvider.js +1 -1
- package/providers/exportRequestProvider.js +1 -1
- package/providers/logging/loggingProvider.js +2 -2
- package/providers/scmContextProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +10 -6
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +2 -2
- package/util/actionabilityUtil.js +36 -7
- package/util/asyncUtil.js +45 -0
- package/util/downloadUtil.js +1 -1
- package/util/logUtils.js +20 -1
- package/util/markdownUtil.js +3 -3
- package/util/pureUtil.js +6 -6
- package/util/resourceUtil.js +18 -1
- package/core/trainer/trainerBrowserUtil.js +0 -33
|
@@ -36,7 +36,7 @@ exports.builder = (yargs) => {
|
|
|
36
36
|
nargs: 1,
|
|
37
37
|
type: 'string',
|
|
38
38
|
})
|
|
39
|
-
.check(argv => {
|
|
39
|
+
.check((argv) => {
|
|
40
40
|
const fromBranchName = argv[CommandArgFrom];
|
|
41
41
|
if (!branches_1.isValidMablBranchName(fromBranchName)) {
|
|
42
42
|
throw new Error(`[${fromBranchName}] is not a valid mabl branch name. Please specify a valid name`);
|
|
@@ -59,8 +59,8 @@ class AwaitCompletion {
|
|
|
59
59
|
}
|
|
60
60
|
return new Promise((resolve, reject) => {
|
|
61
61
|
setTimeout(() => this.awaitCompletion(seedId)
|
|
62
|
-
.then(result => resolve(result))
|
|
63
|
-
.catch(error => reject(error)), this.pollingIntervalMilliseconds);
|
|
62
|
+
.then((result) => resolve(result))
|
|
63
|
+
.catch((error) => reject(error)), this.pollingIntervalMilliseconds);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -65,13 +65,13 @@ function generateCodeReportForCommit(executionEventId, outputLink, executionResu
|
|
|
65
65
|
}
|
|
66
66
|
if (executionResult.executions) {
|
|
67
67
|
const minStartTimes = [];
|
|
68
|
-
executionResult.executions.forEach(execution => {
|
|
68
|
+
executionResult.executions.forEach((execution) => {
|
|
69
69
|
if (execution.start_time) {
|
|
70
70
|
minStartTimes.push(execution.start_time);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
const maxStartTimes = [];
|
|
74
|
-
executionResult.executions.forEach(execution => {
|
|
74
|
+
executionResult.executions.forEach((execution) => {
|
|
75
75
|
if (execution.stop_time) {
|
|
76
76
|
maxStartTimes.push(execution.stop_time);
|
|
77
77
|
}
|
|
@@ -91,9 +91,9 @@ exports.generateCodeReportForCommit = generateCodeReportForCommit;
|
|
|
91
91
|
function generateCodeAnnotationsForReport(executionResult) {
|
|
92
92
|
const codeAnnotations = [];
|
|
93
93
|
if (executionResult.executions) {
|
|
94
|
-
executionResult.executions.forEach(execution => {
|
|
94
|
+
executionResult.executions.forEach((execution) => {
|
|
95
95
|
if (execution.journey_executions) {
|
|
96
|
-
execution.journey_executions.forEach(testExecution => {
|
|
96
|
+
execution.journey_executions.forEach((testExecution) => {
|
|
97
97
|
const codeAnnotation = {
|
|
98
98
|
external_id: `${testExecution.journey_execution_id}-ca`,
|
|
99
99
|
annotation_type: CodeAnnotation_1.CodeInsightsAnnotationType.BUG,
|
|
@@ -123,7 +123,7 @@ function generateAnnotationDetails(testExecution) {
|
|
|
123
123
|
function generateAnnotationSummary(testExecution, journeySummaries) {
|
|
124
124
|
let testForAnnotation;
|
|
125
125
|
if (journeySummaries) {
|
|
126
|
-
testForAnnotation = journeySummaries.find(test => test.id === testExecution.journey_id);
|
|
126
|
+
testForAnnotation = journeySummaries.find((test) => test.id === testExecution.journey_id);
|
|
127
127
|
}
|
|
128
128
|
if (testForAnnotation) {
|
|
129
129
|
return `${testForAnnotation.name}`;
|
|
@@ -135,7 +135,7 @@ async function putCodeReportAndAnnotations(executionResult, executionEventId, ou
|
|
|
135
135
|
const bitBucketApiClient = getBitBucketApiClient(isCustomBitBucketPipe, noProxy);
|
|
136
136
|
const codeReportResponse = await bitBucketApiClient.putCodeReport(codeReport, workspace, repoSlug, node);
|
|
137
137
|
const codeAnnotations = generateCodeAnnotationsForReport(executionResult);
|
|
138
|
-
const requests = codeAnnotations.map(annotation => bitBucketApiClient.putCodeAnnotation(annotation, workspace, repoSlug, node, codeReportResponse.external_id));
|
|
138
|
+
const requests = codeAnnotations.map((annotation) => bitBucketApiClient.putCodeAnnotation(annotation, workspace, repoSlug, node, codeReportResponse.external_id));
|
|
139
139
|
await Promise.all(requests).catch(() => new Error('Error writing Code Annotations to Bitbucket'));
|
|
140
140
|
return codeReportResponse;
|
|
141
141
|
}
|
|
@@ -25,7 +25,7 @@ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
|
25
25
|
const chalk = require('chalk');
|
|
26
26
|
function writeExportedEntityToFile(output, fileExtension, entityId) {
|
|
27
27
|
const fileName = `${entityId}.mabl.${fileExtension}`.replace(':', '-');
|
|
28
|
-
fs.writeFile(`./${fileName}`, output, err => {
|
|
28
|
+
fs.writeFile(`./${fileName}`, output, (err) => {
|
|
29
29
|
if (err) {
|
|
30
30
|
loggingProvider_1.logger.info(chalk.red.bold(`Error exporting flow to filesystem: ${err}`));
|
|
31
31
|
}
|
|
@@ -42,11 +42,11 @@ async function getJourneyFlowArray(journey, apiClient, branchName) {
|
|
|
42
42
|
throw new Error(exports.TEST_INFO_NOT_FOUND);
|
|
43
43
|
}
|
|
44
44
|
const flows = {};
|
|
45
|
-
const requests = journey.flows.map(flowId => apiClient
|
|
45
|
+
const requests = journey.flows.map((flowId) => apiClient
|
|
46
46
|
.getFlow(flowId, branchName)
|
|
47
|
-
.then(result => (flows[flowId] = result)));
|
|
47
|
+
.then((result) => (flows[flowId] = result)));
|
|
48
48
|
await Promise.all(requests);
|
|
49
|
-
return journey.flows.map(flowId => flows[flowId]).filter(flow => flow);
|
|
49
|
+
return journey.flows.map((flowId) => flows[flowId]).filter((flow) => flow);
|
|
50
50
|
}
|
|
51
51
|
exports.getJourneyFlowArray = getJourneyFlowArray;
|
|
52
52
|
async function getWorkspaceIdFromAppOrEnv(apiClient, applicationId, environmentId) {
|
|
@@ -64,7 +64,7 @@ exports.getWorkspaceIdFromAppOrEnv = getWorkspaceIdFromAppOrEnv;
|
|
|
64
64
|
function validateArrayInputs(possibleInput, errorMessage) {
|
|
65
65
|
if (possibleInput !== undefined) {
|
|
66
66
|
const labels = possibleInput;
|
|
67
|
-
if (labels.some(label => /[,|;]/.test(label))) {
|
|
67
|
+
if (labels.some((label) => /[,|;]/.test(label))) {
|
|
68
68
|
throw new Error(errorMessage);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -73,27 +73,27 @@ exports.validateArrayInputs = validateArrayInputs;
|
|
|
73
73
|
function validateValuePairInputs(inputName, inputs) {
|
|
74
74
|
if (inputs) {
|
|
75
75
|
const missingColonInputs = inputs
|
|
76
|
-
.map(input => input.trim())
|
|
77
|
-
.filter(input => !/^([^:]+)?:(.+)?$/m.test(input));
|
|
76
|
+
.map((input) => input.trim())
|
|
77
|
+
.filter((input) => !/^([^:]+)?:(.+)?$/m.test(input));
|
|
78
78
|
if (missingColonInputs.length > 0) {
|
|
79
79
|
throw new Error(`${inputName} ${pluralize_1.default('value', missingColonInputs.length)} must separate kev/value with a colon ':', [${missingColonInputs.join(',')}]`);
|
|
80
80
|
}
|
|
81
81
|
const missingNameInputs = inputs
|
|
82
|
-
.map(input => input.replace(/^[ ]+/, ''))
|
|
83
|
-
.filter(input => !/^([^:]+):(.+)?$/m.test(input));
|
|
82
|
+
.map((input) => input.replace(/^[ ]+/, ''))
|
|
83
|
+
.filter((input) => !/^([^:]+):(.+)?$/m.test(input));
|
|
84
84
|
if (missingNameInputs.length > 0) {
|
|
85
85
|
throw new Error(`${inputName} ${pluralize_1.default('name', missingNameInputs.length)} cannot be blank [${missingNameInputs.join(',')}]`);
|
|
86
86
|
}
|
|
87
|
-
const illegalCharacterHeaders = inputs.filter(input => /[\n\r]/m.test(input));
|
|
87
|
+
const illegalCharacterHeaders = inputs.filter((input) => /[\n\r]/m.test(input));
|
|
88
88
|
if (illegalCharacterHeaders.length > 0) {
|
|
89
|
-
const escapedHeaders = illegalCharacterHeaders.map(input => input.replace('\n', '\\n').replace('\r', '\\r'));
|
|
89
|
+
const escapedHeaders = illegalCharacterHeaders.map((input) => input.replace('\n', '\\n').replace('\r', '\\r'));
|
|
90
90
|
throw new Error(`${inputName} shouldn't contain carriage return or line feed characters [${escapedHeaders.join(',')}]`);
|
|
91
91
|
}
|
|
92
|
-
const wrappingWhitespace = inputs.filter(header => !/^([^\s:]{1,2}|[^\s:][^:]+[^\s:]):([^\s:]{1,2}|[^\s:][^:]+[^\s:])?$/m.test(header));
|
|
92
|
+
const wrappingWhitespace = inputs.filter((header) => !/^([^\s:]{1,2}|[^\s:][^:]+[^\s:]):([^\s:]{1,2}|[^\s:][^:]+[^\s:])?$/m.test(header));
|
|
93
93
|
if (wrappingWhitespace.length > 0) {
|
|
94
94
|
const cleanFunction = (header) => header
|
|
95
95
|
.split(':', 2)
|
|
96
|
-
.map(part => part.trim())
|
|
96
|
+
.map((part) => part.trim())
|
|
97
97
|
.join(':');
|
|
98
98
|
const cleaned = inputs.map(cleanFunction);
|
|
99
99
|
const cleanedAffectedHeaders = wrappingWhitespace.map(cleanFunction);
|
|
@@ -14,7 +14,7 @@ function listConfig() {
|
|
|
14
14
|
head: ['Config', 'Value', 'Details'],
|
|
15
15
|
colWidths: [null, 60],
|
|
16
16
|
});
|
|
17
|
-
Object.values(set_1.configKeys).forEach(propertyKey => {
|
|
17
|
+
Object.values(set_1.configKeys).forEach((propertyKey) => {
|
|
18
18
|
let value;
|
|
19
19
|
let details;
|
|
20
20
|
switch (propertyKey) {
|
package/commands/constants.js
CHANGED
|
@@ -34,7 +34,7 @@ function printCredentials(credentials, output) {
|
|
|
34
34
|
head: ['ID', 'Name', 'Description', 'Created time'],
|
|
35
35
|
wordWrap: true,
|
|
36
36
|
});
|
|
37
|
-
credentials.forEach(credential => {
|
|
37
|
+
credentials.forEach((credential) => {
|
|
38
38
|
table.push([
|
|
39
39
|
{ rowSpan: 1, content: credential.id, vAlign: 'center' },
|
|
40
40
|
{ rowSpan: 1, content: credential.name, vAlign: 'center' },
|
|
@@ -165,7 +165,7 @@ exports.builder = (yargs) => {
|
|
|
165
165
|
.implies(constants_1.CommandArgMablAutoBranch, constants_1.CommandArgMablBranch)
|
|
166
166
|
.implies(CommandArgSnapshotBranch, constants_1.CommandArgEnvironmentId)
|
|
167
167
|
.implies(constants_1.CommandArgOverrideEnvironmentId, constants_1.CommandArgApplicationId)
|
|
168
|
-
.check(argv => {
|
|
168
|
+
.check((argv) => {
|
|
169
169
|
if (!(argv[constants_1.CommandArgApplicationId] || argv[constants_1.CommandArgEnvironmentId])) {
|
|
170
170
|
throw new Error(`At least one of ${constants_1.CommandArgApplicationId} or ${constants_1.CommandArgEnvironmentId} required`);
|
|
171
171
|
}
|
|
@@ -207,7 +207,7 @@ async function createDeployment(parsed) {
|
|
|
207
207
|
const environmentOverride = parsed[constants_1.CommandArgOverrideEnvironmentId];
|
|
208
208
|
let deploymentIds;
|
|
209
209
|
if (environmentOverride) {
|
|
210
|
-
deploymentIds = (_a = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments) === null || _a === void 0 ? void 0 : _a.map(deployment => deployment.id);
|
|
210
|
+
deploymentIds = (_a = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments) === null || _a === void 0 ? void 0 : _a.map((deployment) => deployment.id);
|
|
211
211
|
if (!deploymentIds || deploymentIds.length === 0) {
|
|
212
212
|
loggingProvider_1.logger.error(chalk.red.bold(`Application ${applicationId} is not defined in override environment ${environmentOverride}`));
|
|
213
213
|
process.exit(1);
|
|
@@ -27,14 +27,14 @@ class ExecutionResultPresenter {
|
|
|
27
27
|
}
|
|
28
28
|
const table = new Table(tableConfig);
|
|
29
29
|
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
30
|
-
finalExecutions.forEach(summary => {
|
|
30
|
+
finalExecutions.forEach((summary) => {
|
|
31
31
|
var _a, _b, _c, _d, _e;
|
|
32
32
|
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
33
33
|
const planId = summary.plan.id;
|
|
34
34
|
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
35
35
|
const planRunStatus = summary.plan_execution.status;
|
|
36
36
|
const journeyMap = new Map();
|
|
37
|
-
(_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
|
+
(_d = summary === null || summary === void 0 ? void 0 : summary.journeys) === null || _d === void 0 ? void 0 : _d.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
38
38
|
const statusChalk = this.mapPlanRunStatusToColor(planRunStatus);
|
|
39
39
|
table.push([
|
|
40
40
|
`${planName}`,
|
|
@@ -44,13 +44,13 @@ class ExecutionResultPresenter {
|
|
|
44
44
|
statusChalk(this.maybeCapitalize(planRunStatus.toString())),
|
|
45
45
|
this.summaryToElapsedTime(summary),
|
|
46
46
|
]);
|
|
47
|
-
(_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach(journeyRun => {
|
|
48
|
-
var _a, _b, _c;
|
|
47
|
+
(_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
49
|
const journeyId = journeyRun.journey_execution_id;
|
|
50
|
-
const journeyStatus = (_a =
|
|
51
|
-
const journeyBrowser = this.maybeCapitalize((
|
|
50
|
+
const journeyStatus = this.maybeCapitalize((_b = (_a = journeyRun.status) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '<status unavailable>');
|
|
51
|
+
const journeyBrowser = this.maybeCapitalize((_c = journeyRun.browser_type) !== null && _c !== void 0 ? _c : '<unknown browser>');
|
|
52
52
|
const journeySummary = journeyMap.get(journeyRun.journey_id);
|
|
53
|
-
const journeyName = `${retryPrefix}${(
|
|
53
|
+
const journeyName = `${retryPrefix}${(_d = journeySummary === null || journeySummary === void 0 ? void 0 : journeySummary.name) !== null && _d !== void 0 ? _d : '<test name >'}`;
|
|
54
54
|
const statusChalk = this.mapJourneyRunStatusToColor(journeyRun.status);
|
|
55
55
|
table.push([
|
|
56
56
|
'',
|
|
@@ -33,7 +33,7 @@ function printDeployments(deployments, output) {
|
|
|
33
33
|
const table = new Table({
|
|
34
34
|
head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
|
|
35
35
|
});
|
|
36
|
-
deployments.forEach(deployment => {
|
|
36
|
+
deployments.forEach((deployment) => {
|
|
37
37
|
var _a, _b, _c, _d, _e, _f;
|
|
38
38
|
table.push([
|
|
39
39
|
{ rowSpan: 2, content: deployment.id, vAlign: 'center' },
|
|
@@ -77,7 +77,7 @@ function addUpdateEnvCommands(argv) {
|
|
|
77
77
|
boolean: true,
|
|
78
78
|
default: false,
|
|
79
79
|
})
|
|
80
|
-
.check(argv => {
|
|
80
|
+
.check((argv) => {
|
|
81
81
|
const branchName = argv[constants_1.CommandArgMablBranch];
|
|
82
82
|
if (branchName !== undefined && !branches_1.isValidMablBranchName(branchName)) {
|
|
83
83
|
throw new Error(`[${branchName}] is not a valid mabl branch name. Please specify a valid name`);
|
|
@@ -119,8 +119,8 @@ async function createEnvironment(parsed) {
|
|
|
119
119
|
if (applicationId) {
|
|
120
120
|
loggingProvider_1.logger.info('Associating URLs with environment');
|
|
121
121
|
const createDeploymentsPromises = (parsed[constants_1.CommandArgUrlApp] || [])
|
|
122
|
-
.map(url => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.WebApplication))
|
|
123
|
-
.concat((parsed[constants_1.CommandArgUrlApi] || []).map(url => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.Api)));
|
|
122
|
+
.map((url) => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.WebApplication))
|
|
123
|
+
.concat((parsed[constants_1.CommandArgUrlApi] || []).map((url) => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.Api)));
|
|
124
124
|
await Promise.all(createDeploymentsPromises);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -34,7 +34,7 @@ function printEnvironments(environments, output) {
|
|
|
34
34
|
head: ['ID', 'Name', 'Created time'],
|
|
35
35
|
wordWrap: true,
|
|
36
36
|
});
|
|
37
|
-
environments.forEach(environment => {
|
|
37
|
+
environments.forEach((environment) => {
|
|
38
38
|
table.push([
|
|
39
39
|
{ rowSpan: 1, content: environment.id, vAlign: 'center' },
|
|
40
40
|
{ rowSpan: 1, content: environment.name, vAlign: 'center' },
|
|
@@ -36,7 +36,7 @@ function addEnvironmentUrlOptions(yargs) {
|
|
|
36
36
|
describe: 'api urls to associate with the application-environment pair',
|
|
37
37
|
type: 'array',
|
|
38
38
|
})
|
|
39
|
-
.check(argv => {
|
|
39
|
+
.check((argv) => {
|
|
40
40
|
const applicationId = argv[constants_1.CommandArgApplicationId];
|
|
41
41
|
const appUrls = argv[constants_1.CommandArgUrlApp];
|
|
42
42
|
const apiUrls = argv[constants_1.CommandArgUrlApi];
|
|
@@ -46,7 +46,7 @@ function printFlows(flows) {
|
|
|
46
46
|
head: ['ID', 'Description', 'Created time'],
|
|
47
47
|
wordWrap: true,
|
|
48
48
|
});
|
|
49
|
-
flows.forEach(flow => {
|
|
49
|
+
flows.forEach((flow) => {
|
|
50
50
|
table.push([
|
|
51
51
|
{ rowSpan: 1, content: flow.invariant_id, vAlign: 'center' },
|
|
52
52
|
{ rowSpan: 1, content: flow.description, vAlign: 'center' },
|
|
@@ -45,7 +45,7 @@ function printPlans(plans) {
|
|
|
45
45
|
head: ['ID', 'Name', 'Created time'],
|
|
46
46
|
wordWrap: true,
|
|
47
47
|
});
|
|
48
|
-
plans.forEach(plan => {
|
|
48
|
+
plans.forEach((plan) => {
|
|
49
49
|
table.push([
|
|
50
50
|
{ rowSpan: 1, content: plan.id, vAlign: 'center' },
|
|
51
51
|
{ rowSpan: 1, content: plan.name, vAlign: 'center' },
|
|
@@ -33,7 +33,7 @@ exports.builder = (yargs) => {
|
|
|
33
33
|
})
|
|
34
34
|
.example('$0 test-runs export <id>', 'export test run screenshots to file')
|
|
35
35
|
.example('$0 test-runs export <id> --type screenshots doms', 'export test run screenshots and doms to file')
|
|
36
|
-
.check(argv => {
|
|
36
|
+
.check((argv) => {
|
|
37
37
|
util_1.validateArrayInputs(argv[constants_1.CommandArgContentTypes], 'export types must be SPACE delimited, e.g. "--types=screenshots doms"');
|
|
38
38
|
return true;
|
|
39
39
|
});
|
|
@@ -24,7 +24,7 @@ async function runTheTestInNewWindow(test, flows, branchName, url, credentialsId
|
|
|
24
24
|
loggingProvider_1.logger.info(chalk_1.default.yellowBright('Closing local run of test'));
|
|
25
25
|
trainingBrowser
|
|
26
26
|
.close()
|
|
27
|
-
.catch(error => loggingProvider_1.logger.info('Error shutting down browser on CTRL + C: ' + error));
|
|
27
|
+
.catch((error) => loggingProvider_1.logger.info('Error shutting down browser on CTRL + C: ' + error));
|
|
28
28
|
});
|
|
29
29
|
await testsUtil_1.runTheTest(trainingBrowser, backgroundPage, test, flows, branchName, url, credentialsId, environment);
|
|
30
30
|
}
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.
|
|
25
|
+
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.downloadUploadFile = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.setUpAuthTokenForExtension = exports.connectToExistingBrowserWebsocket = exports.connectToExistingBrowser = exports.createBrowserForExecutionEngine = exports.addExecutionEngineLaunchArgs = exports.createBrowser = exports.prepareChromePreferencesDirectory = exports.createBrowserWithAuthedExtension = exports.findChrome = exports.searchForChrome = exports.getFinalUrl = exports.getTempChromePrefDirectory = void 0;
|
|
26
26
|
const os = __importStar(require("os"));
|
|
27
27
|
const trainerUtil_1 = require("./tests_cmds/trainer_cmds/trainerUtil");
|
|
28
28
|
const fs = __importStar(require("fs-extra"));
|
|
@@ -81,7 +81,7 @@ function getFinalUrl(test, parsedUrl) {
|
|
|
81
81
|
exports.getFinalUrl = getFinalUrl;
|
|
82
82
|
function searchForChrome() {
|
|
83
83
|
const chromes = chromeFinder[launchUtils.getPlatform()]();
|
|
84
|
-
return chromes.filter(chrome => {
|
|
84
|
+
return chromes.filter((chrome) => {
|
|
85
85
|
const lowCase = chrome.toLowerCase();
|
|
86
86
|
return !(lowCase.includes('canary') ||
|
|
87
87
|
lowCase.includes('dev') ||
|
|
@@ -134,11 +134,12 @@ async function createBrowserWithAuthedExtension(accessToken, browserWidth, brows
|
|
|
134
134
|
}
|
|
135
135
|
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
136
136
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
137
|
-
const { defaultDeviceDescriptor, ignoreDefaultArgs, runnerType, loggerFunc } = options || {};
|
|
137
|
+
const { defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, } = options || {};
|
|
138
138
|
let browser;
|
|
139
139
|
try {
|
|
140
140
|
browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
141
141
|
defaultDeviceDescriptor,
|
|
142
|
+
extraHttpHeaders,
|
|
142
143
|
ignoreDefaultArgs,
|
|
143
144
|
runnerType,
|
|
144
145
|
loggerFunc,
|
|
@@ -152,7 +153,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
152
153
|
defaultDeviceDescriptor,
|
|
153
154
|
ignoreDefaultArgs,
|
|
154
155
|
runnerType,
|
|
155
|
-
}).catch(error => {
|
|
156
|
+
}).catch((error) => {
|
|
156
157
|
messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
|
|
157
158
|
messaging_1.mablEventEmitter.log(error.message);
|
|
158
159
|
});
|
|
@@ -161,10 +162,11 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
161
162
|
return browser;
|
|
162
163
|
}
|
|
163
164
|
function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
164
|
-
const { defaultDeviceDescriptor, ignoreDefaultArgs, runnerType, loggerFunc } = options || {};
|
|
165
|
+
const { defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, } = options || {};
|
|
165
166
|
return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
|
|
166
167
|
defaultDeviceDescriptor,
|
|
167
168
|
executablePath: chromePath,
|
|
169
|
+
extraHttpHeaders,
|
|
168
170
|
headless,
|
|
169
171
|
args: launchArgs,
|
|
170
172
|
ignoreDefaultArgs,
|
|
@@ -195,7 +197,7 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
198
|
-
const { credentials, browserPath, disableIsolation, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, } = options || {};
|
|
200
|
+
const { credentials, browserPath, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, } = options || {};
|
|
199
201
|
const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : findChrome();
|
|
200
202
|
if (!chromePath.length) {
|
|
201
203
|
messaging_1.mablEventEmitter.log(chalk.yellow('Could not find a local install of Chrome to use, please ensure you have it installed and try again'));
|
|
@@ -220,6 +222,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
220
222
|
}
|
|
221
223
|
const maybeBrowser = await launchBrowserInstance(chromePath, launchArgs, tempBrowserPreferencesDirectory, headless, credentials, {
|
|
222
224
|
defaultDeviceDescriptor,
|
|
225
|
+
extraHttpHeaders,
|
|
223
226
|
ignoreDefaultArgs,
|
|
224
227
|
runnerType,
|
|
225
228
|
loggerFunc,
|
|
@@ -298,7 +301,7 @@ function connectToExistingBrowserWebsocket(websocketEndpoint, currentDownloadPat
|
|
|
298
301
|
exports.connectToExistingBrowserWebsocket = connectToExistingBrowserWebsocket;
|
|
299
302
|
async function setUpAuthTokenForExtension(browser, accessToken) {
|
|
300
303
|
const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
|
|
301
|
-
await backgroundPage.evaluate(token => {
|
|
304
|
+
await backgroundPage.evaluate((token) => {
|
|
302
305
|
localStorage.setItem('authResult', JSON.stringify({ idToken: token }));
|
|
303
306
|
localStorage.setItem('trainerWorld', 'mablCLI');
|
|
304
307
|
}, accessToken);
|
|
@@ -342,7 +345,7 @@ exports.cleanUpInitialPages = cleanUpInitialPages;
|
|
|
342
345
|
async function exposeMessagingFunctionToTrainer(backgroundPage, browser) {
|
|
343
346
|
await backgroundPage
|
|
344
347
|
.exposeFunction('postMessageToCli', (message) => handleExtensionMessage(message, browser))
|
|
345
|
-
.catch(error => messaging_1.mablEventEmitter.log('Error on the handle' + error));
|
|
348
|
+
.catch((error) => messaging_1.mablEventEmitter.log('Error on the handle' + error));
|
|
346
349
|
}
|
|
347
350
|
async function createTrainingSession(backgroundPage, trainingSessionOptions, environment, plan, deployment, application, autoLoginFlow) {
|
|
348
351
|
var _a;
|
|
@@ -350,7 +353,7 @@ async function createTrainingSession(backgroundPage, trainingSessionOptions, env
|
|
|
350
353
|
autoLogin: trainingSessionOptions.autoLogin,
|
|
351
354
|
datatables: trainingSessionOptions.dataTableIds,
|
|
352
355
|
flowIndexToTrain: 0,
|
|
353
|
-
labels: (_a = trainingSessionOptions.labels) === null || _a === void 0 ? void 0 : _a.map(label => ({ name: label })),
|
|
356
|
+
labels: (_a = trainingSessionOptions.labels) === null || _a === void 0 ? void 0 : _a.map((label) => ({ name: label })),
|
|
354
357
|
description: trainingSessionOptions.testDescription,
|
|
355
358
|
name: trainingSessionOptions.testName,
|
|
356
359
|
flows: autoLoginFlow ? [autoLoginFlow.id] : [],
|
|
@@ -437,7 +440,7 @@ async function shutItDown(trainingBrowser) {
|
|
|
437
440
|
await trainingBrowser.close().catch(() => 'Shutdown was a little bumpy');
|
|
438
441
|
}
|
|
439
442
|
function sleep(milliseconds) {
|
|
440
|
-
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
443
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
441
444
|
}
|
|
442
445
|
exports.sleep = sleep;
|
|
443
446
|
const TRAINER_SHUTDOWN = 'TRAINER_SHUTDOWN';
|
|
@@ -586,17 +589,14 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
586
589
|
function cleanLabels(input) {
|
|
587
590
|
const distinctLabels = new Set();
|
|
588
591
|
input
|
|
589
|
-
.map((label) => label
|
|
590
|
-
.
|
|
591
|
-
.trim()
|
|
592
|
-
.toLowerCase())
|
|
593
|
-
.forEach(label => distinctLabels.add(label));
|
|
592
|
+
.map((label) => label.toString().trim().toLowerCase())
|
|
593
|
+
.forEach((label) => distinctLabels.add(label));
|
|
594
594
|
return [...distinctLabels];
|
|
595
595
|
}
|
|
596
596
|
const labelsInclude = cleanLabels(suppliedLabelsInclude !== null && suppliedLabelsInclude !== void 0 ? suppliedLabelsInclude : []);
|
|
597
597
|
const labelsExclude = cleanLabels(suppliedLabelsExclude !== null && suppliedLabelsExclude !== void 0 ? suppliedLabelsExclude : []);
|
|
598
598
|
if (labelsInclude.length > 0 && labelsExclude.length > 0) {
|
|
599
|
-
const intersection = labelsInclude.filter(label => labelsExclude.includes(label));
|
|
599
|
+
const intersection = labelsInclude.filter((label) => labelsExclude.includes(label));
|
|
600
600
|
if (intersection.length > 0) {
|
|
601
601
|
throw new Error(`Include labels --${constants_1.CommandArgLabelsInclude} and exclude labels --${constants_1.CommandArgLabelsExclude} have overlapping values [${intersection.join(',')}]`);
|
|
602
602
|
}
|
|
@@ -671,10 +671,6 @@ function logTestInfoIfPresent(description, infoArg) {
|
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
exports.logTestInfoIfPresent = logTestInfoIfPresent;
|
|
674
|
-
function logCtlCLine() {
|
|
675
|
-
messaging_1.mablEventEmitter.log(chalk.yellowBright('Session started (Press CTRL + C to cancel)'));
|
|
676
|
-
}
|
|
677
|
-
exports.logCtlCLine = logCtlCLine;
|
|
678
674
|
function generateChromiumPreferencesFile(windowPlacement) {
|
|
679
675
|
const preferences = {
|
|
680
676
|
download: {
|
|
@@ -76,7 +76,7 @@ exports.builder = (yargs) => {
|
|
|
76
76
|
default: false,
|
|
77
77
|
type: 'boolean',
|
|
78
78
|
})
|
|
79
|
-
.check(argv => testsUtil_1.validateRunEditCommand(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
|
|
79
|
+
.check((argv) => testsUtil_1.validateRunEditCommand(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
|
|
80
80
|
};
|
|
81
81
|
exports.handler = util_1.failWrapper(launchEditTrainingSession);
|
|
82
82
|
async function launchEditTrainingSession(parsed) {
|
|
@@ -54,7 +54,7 @@ async function pullJourney(parsed) {
|
|
|
54
54
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
55
55
|
const flowArray = await util_1.getJourneyFlowArray(journey, apiClient, branchName);
|
|
56
56
|
if (flowArray
|
|
57
|
-
.map(flow => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript ||
|
|
57
|
+
.map((flow) => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript ||
|
|
58
58
|
flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Api)
|
|
59
59
|
.includes(false)) {
|
|
60
60
|
loggingProvider_1.logger.info(chalk.red(`Default mabl tests can not be exported`));
|
|
@@ -128,7 +128,7 @@ function getTestName(name) {
|
|
|
128
128
|
validate: nameValidator,
|
|
129
129
|
},
|
|
130
130
|
])
|
|
131
|
-
.then(answers => answers.name);
|
|
131
|
+
.then((answers) => answers.name);
|
|
132
132
|
}
|
|
133
133
|
async function importTests(port, debug, importMultipleTests) {
|
|
134
134
|
const importedTests = [];
|
|
@@ -215,10 +215,10 @@ function saveTests(workspaceId, name, apiClient, importedTests) {
|
|
|
215
215
|
loggingProvider_1.logger.info(`Saving ${pluralize_1.default('test', importedTests.length, true)}...`);
|
|
216
216
|
const savePromises = importedTests.map((steps, index) => apiClient
|
|
217
217
|
.createFlow(stepsToFlow(workspaceId, steps))
|
|
218
|
-
.then(flow => apiClient.createJourney(flowToJourney(importedTests.length === 1
|
|
218
|
+
.then((flow) => apiClient.createJourney(flowToJourney(importedTests.length === 1
|
|
219
219
|
? name
|
|
220
220
|
: `${name} (${index + 1} of ${importedTests.length})`, flow)))
|
|
221
|
-
.then(journey => {
|
|
221
|
+
.then((journey) => {
|
|
222
222
|
loggingProvider_1.logger.info(`Saved test ${journey.invariant_id} : ${env_1.BASE_APP_URL}/workspaces/${journey.organization_id}/train/journeys/${journey.invariant_id}/current`);
|
|
223
223
|
return journey;
|
|
224
224
|
}));
|
|
@@ -229,14 +229,14 @@ function displayTestDescriptions(importedTests) {
|
|
|
229
229
|
if (importedTests.length > 1) {
|
|
230
230
|
loggingProvider_1.logger.info(`Test ${index + 1} of ${importedTests.length}:`);
|
|
231
231
|
}
|
|
232
|
-
loggingProvider_1.logger.info(steps.map(step => step.description).join('\n'));
|
|
232
|
+
loggingProvider_1.logger.info(steps.map((step) => step.description).join('\n'));
|
|
233
233
|
loggingProvider_1.logger.logNewLine();
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
async function runTests(workspaceId, name, importedTests) {
|
|
237
237
|
var _a, _b;
|
|
238
|
-
const flows = importedTests.map(steps => stepsToFlow(workspaceId, steps));
|
|
239
|
-
const firstUrl = (_a = flows.find(flow => flow.url)) === null || _a === void 0 ? void 0 : _a.url;
|
|
238
|
+
const flows = importedTests.map((steps) => stepsToFlow(workspaceId, steps));
|
|
239
|
+
const firstUrl = (_a = flows.find((flow) => flow.url)) === null || _a === void 0 ? void 0 : _a.url;
|
|
240
240
|
for (let flowIndex = 0; flowIndex < flows.length; flowIndex++) {
|
|
241
241
|
loggingProvider_1.logger.info(`Running test ${flowIndex + 1} of ${flows.length}.`);
|
|
242
242
|
const flow = flows[flowIndex];
|
|
@@ -257,13 +257,13 @@ function stepsToFlow(workspaceId, steps) {
|
|
|
257
257
|
organization_id: workspaceId,
|
|
258
258
|
reusable: false,
|
|
259
259
|
selectors: steps
|
|
260
|
-
.map(step => step.selector)
|
|
261
|
-
.map(selector => selector === null || selector === void 0 ? void 0 : selector.toMablscriptSelector())
|
|
262
|
-
.filter(selector => !!selector)
|
|
263
|
-
.map(selector => selector),
|
|
264
|
-
script: steps.map(step => step.mablscript).join('\n'),
|
|
265
|
-
script_description: steps.map(step => step.description).join('\n'),
|
|
266
|
-
url: steps.map(step => step.url).find(url => url),
|
|
260
|
+
.map((step) => step.selector)
|
|
261
|
+
.map((selector) => selector === null || selector === void 0 ? void 0 : selector.toMablscriptSelector())
|
|
262
|
+
.filter((selector) => !!selector)
|
|
263
|
+
.map((selector) => selector),
|
|
264
|
+
script: steps.map((step) => step.mablscript).join('\n'),
|
|
265
|
+
script_description: steps.map((step) => step.description).join('\n'),
|
|
266
|
+
url: steps.map((step) => step.url).find((url) => url),
|
|
267
267
|
};
|
|
268
268
|
return prototype;
|
|
269
269
|
}
|
|
@@ -48,7 +48,7 @@ async function listTests(parsed) {
|
|
|
48
48
|
limit,
|
|
49
49
|
include_labels: labels,
|
|
50
50
|
});
|
|
51
|
-
const outputJourneys = journeys.map(journey => ({
|
|
51
|
+
const outputJourneys = journeys.map((journey) => ({
|
|
52
52
|
created_time: journey.created_time,
|
|
53
53
|
id: journey.invariant_id,
|
|
54
54
|
name: journey.name,
|
|
@@ -76,7 +76,7 @@ function printTestsAsTable(tests) {
|
|
|
76
76
|
head: ['ID', 'Name', 'Created time'],
|
|
77
77
|
wordWrap: true,
|
|
78
78
|
});
|
|
79
|
-
tests.forEach(test => {
|
|
79
|
+
tests.forEach((test) => {
|
|
80
80
|
table.push([
|
|
81
81
|
{ rowSpan: 1, content: test.invariant_id, vAlign: 'center' },
|
|
82
82
|
{ rowSpan: 1, content: test.name, vAlign: 'center' },
|
|
@@ -119,7 +119,7 @@ exports.builder = (yargs) => {
|
|
|
119
119
|
default: false,
|
|
120
120
|
type: 'boolean',
|
|
121
121
|
})
|
|
122
|
-
.check(argv => testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, argv[constants_1.CommandArgTestFile]));
|
|
122
|
+
.check((argv) => testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, argv[constants_1.CommandArgTestFile]));
|
|
123
123
|
};
|
|
124
124
|
const exitCodeOnError = 1;
|
|
125
125
|
exports.handler = util_1.failWrapper(runAlpha, exitCodeOnError);
|
|
@@ -130,7 +130,7 @@ exports.builder = (yargs) => {
|
|
|
130
130
|
type: 'boolean',
|
|
131
131
|
alias: constants_1.CommandArgAliases.NoPrompt,
|
|
132
132
|
})
|
|
133
|
-
.check(argv => testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude]));
|
|
133
|
+
.check((argv) => testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude]));
|
|
134
134
|
};
|
|
135
135
|
exports.handler = util_1.failWrapper(runInCloud);
|
|
136
136
|
async function runInCloud(parsed) {
|
|
@@ -217,17 +217,17 @@ async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeD
|
|
|
217
217
|
if (applicationId || environmentId) {
|
|
218
218
|
const deploymentsResult = await apiClient.queryDeploymentEntities(workspaceId);
|
|
219
219
|
const foundDeployments = deploymentsResult.deployments
|
|
220
|
-
? deploymentsResult.deployments.filter(deployment => (!applicationId || deployment.application_id === applicationId) &&
|
|
220
|
+
? deploymentsResult.deployments.filter((deployment) => (!applicationId || deployment.application_id === applicationId) &&
|
|
221
221
|
(!environmentId || deployment.environment_id === environmentId))
|
|
222
222
|
: [];
|
|
223
223
|
if (!foundDeployments.length) {
|
|
224
224
|
throw new Error('No configuration was found for the applicationId/environmentId specified');
|
|
225
225
|
}
|
|
226
|
-
deploymentIds = foundDeployments.map(deployment => deployment.id);
|
|
226
|
+
deploymentIds = foundDeployments.map((deployment) => deployment.id);
|
|
227
227
|
}
|
|
228
228
|
const planRun = await apiClient.postPlanRun(workspaceId, testId, branchName, browsers, effectiveAppUrl, apiUrl, maybeDeploymentId, credentialsId, deploymentIds, basicAuthCredentialsId);
|
|
229
229
|
return planRun.scripts
|
|
230
|
-
? planRun.scripts.map(script => `${env_1.BASE_APP_URL}/workspaces/${planRun.organization_id}/test/journey-runs/${script.id}`)
|
|
230
|
+
? planRun.scripts.map((script) => `${env_1.BASE_APP_URL}/workspaces/${planRun.organization_id}/test/journey-runs/${script.id}`)
|
|
231
231
|
: [];
|
|
232
232
|
}
|
|
233
233
|
async function getJourneysForLabels(workspaceId, branchName, branchChangesOnly, labelsInclude, labelsExclude, limit, prompt, apiClient) {
|
|
@@ -237,7 +237,7 @@ async function getJourneysForLabels(workspaceId, branchName, branchChangesOnly,
|
|
|
237
237
|
organization_id: workspaceId,
|
|
238
238
|
include_labels: labelsInclude,
|
|
239
239
|
exclude_labels: labelsExclude,
|
|
240
|
-
|
|
240
|
+
branch: branchName,
|
|
241
241
|
branch_changes_only: branchChangesOnly,
|
|
242
242
|
});
|
|
243
243
|
switch (journeys.length) {
|
|
@@ -262,10 +262,10 @@ async function getJourneysForLabels(workspaceId, branchName, branchChangesOnly,
|
|
|
262
262
|
message: `Run these [${journeys.length}] tests?`,
|
|
263
263
|
pageSize: 20,
|
|
264
264
|
choices: journeyChoices,
|
|
265
|
-
default: journeyChoices.map(choice => choice.value),
|
|
265
|
+
default: journeyChoices.map((choice) => choice.value),
|
|
266
266
|
},
|
|
267
267
|
]);
|
|
268
|
-
const selectedJourneys = (_a = journeys.filter(journey => { var _a; return (_a = testsToRun === null || testsToRun === void 0 ? void 0 : testsToRun.test_selection) === null || _a === void 0 ? void 0 : _a.includes(journey.id); })) !== null && _a !== void 0 ? _a : [];
|
|
268
|
+
const selectedJourneys = (_a = journeys.filter((journey) => { var _a; return (_a = testsToRun === null || testsToRun === void 0 ? void 0 : testsToRun.test_selection) === null || _a === void 0 ? void 0 : _a.includes(journey.id); })) !== null && _a !== void 0 ? _a : [];
|
|
269
269
|
if (selectedJourneys.length === 0) {
|
|
270
270
|
return [];
|
|
271
271
|
}
|