@mablhq/mabl-cli 1.16.32 → 1.17.0
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 +9 -4
- package/api/mablApiClient.js +14 -7
- package/browserLauncher/browserLauncherFactory.js +2 -1
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +5 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +22 -18
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +10 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +5 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +13 -9
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +10 -10
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +6 -6
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +12 -11
- package/cli.js +12 -8
- package/commands/applications/applications_cmds/describe.js +4 -4
- package/commands/applications/applications_cmds/list.js +4 -4
- package/commands/auth/auth_cmds/activate-key.js +1 -1
- package/commands/branches/branches_cmds/create.js +4 -4
- package/commands/branches/branches_cmds/describe.js +3 -3
- package/commands/branches/branches_cmds/list.js +3 -3
- package/commands/branches/branches_cmds/merge.js +4 -4
- package/commands/commandUtil/codeInsights.js +4 -2
- package/commands/commandUtil/describe.js +1 -1
- package/commands/commandUtil/fileUtil.js +5 -1
- package/commands/commandUtil/util.js +2 -2
- package/commands/config/config_cmds/delete.js +1 -1
- package/commands/config/config_cmds/set.js +1 -1
- package/commands/constants.js +2 -1
- package/commands/credentials/credentials_cmds/list.js +4 -4
- package/commands/deploy/deploy_cmds/create.js +18 -13
- package/commands/deploy/deploy_cmds/describe.js +5 -5
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +1 -1
- package/commands/deploy/deploy_cmds/list.js +4 -4
- package/commands/deploy/deploy_cmds/watch.js +2 -2
- package/commands/environments/environments_cmds/create.js +7 -7
- package/commands/environments/environments_cmds/delete.js +1 -1
- package/commands/environments/environments_cmds/describe.js +4 -4
- package/commands/environments/environments_cmds/list.js +4 -4
- package/commands/environments/environments_cmds/update.js +2 -2
- package/commands/environments/environments_cmds/urls_cmds/add.js +3 -3
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -2
- package/commands/flows/flows_cmds/export.js +5 -5
- package/commands/flows/flows_cmds/list.js +2 -2
- package/commands/link-agents/link-agents_cmds/delete.js +1 -1
- package/commands/plans/plans_cmds/describe.js +4 -4
- package/commands/plans/plans_cmds/list.js +2 -2
- package/commands/test-runs/test-runs_cmds/export.js +2 -2
- package/commands/tests/executionUtil.js +5 -5
- package/commands/tests/testsUtil.js +19 -12
- package/commands/tests/tests_cmds/create.js +3 -3
- package/commands/tests/tests_cmds/edit.js +3 -3
- package/commands/tests/tests_cmds/export.js +7 -7
- package/commands/tests/tests_cmds/import.js +35 -14
- package/commands/tests/tests_cmds/list.js +3 -3
- package/commands/tests/tests_cmds/run-alpha.js +3 -3
- package/commands/tests/tests_cmds/run-cloud.js +4 -4
- package/commands/tests/tests_cmds/run-legacy.js +8 -8
- package/commands/tests/tests_cmds/run.js +8 -8
- package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +2 -2
- package/commands/tests/tests_cmds/trainer_cmds/update.js +1 -1
- package/commands/tests/tests_cmds/trainer_cmds/version.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -2
- package/commands/workspaces/workspace_cmds/describe.js +4 -4
- package/commands/workspaces/workspace_cmds/list.js +2 -2
- package/configGenerators/flowConfigGenerator.js +1 -1
- package/configGenerators/selIdeGenerator.js +6 -6
- package/core/messaging/actions/runnerActions.js +2 -2
- package/core/trainer/openUtils.js +2 -2
- package/core/trainer/trainingSessions.js +26 -26
- package/domUtil/index.js +1 -1
- package/env/env.js +5 -1
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/mablscript/AttributesConstants.js +2 -1
- package/mablscript/MablStep.js +6 -12
- package/mablscript/actions/ConditionAction.js +1 -1
- package/mablscript/actions/FindAction.js +25 -32
- package/mablscript/actions/GetUrlAction.js +1 -1
- package/mablscript/actions/GetVariableValue.js +1 -1
- package/mablscript/actions/JavaScriptAction.js +16 -16
- package/mablscript/importer.js +7 -7
- package/mablscript/steps/AccessibilityCheck.js +4 -2
- package/mablscript/steps/AssertStep.js +16 -16
- package/mablscript/steps/AssertStepOld.js +2 -2
- package/mablscript/steps/ClickStep.js +1 -1
- package/mablscript/steps/CreateVariableStep.js +6 -6
- package/mablscript/steps/DoubleClickStep.js +1 -1
- package/mablscript/steps/EchoStep.js +2 -2
- package/mablscript/steps/EnterTextStep.js +3 -3
- package/mablscript/steps/HoverStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +2 -1
- package/mablscript/steps/NavigateStep.js +1 -1
- package/mablscript/steps/SendHttpRequestStep.js +1 -1
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +9 -9
- package/mablscript/steps/VisitUrlStep.js +1 -1
- package/mablscript/steps/WaitStep.js +1 -1
- package/mablscript/steps/WaitUntilStep.js +1 -1
- package/mablscript/types/OperatingSystemDescriptor.js +5 -1
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/observers/mockObserver.js +4 -2
- package/package.json +55 -56
- package/popupDismissal/index.js +3 -3
- package/providers/authenticationProvider.js +3 -3
- package/providers/logging/loggingProvider.js +5 -1
- package/proxy/index.js +2 -1
- package/proxy/index.js.LICENSE.txt +5 -0
- package/reporters/mochAwesome/mochAwesomeReporter.js +11 -7
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +1 -0
- package/util/actionabilityUtil.js +18 -14
- package/util/analytics.js +7 -3
- package/util/downloadUtil.js +6 -2
- package/util/httpUtil.js +6 -2
- package/util/markdownUtil.js +1 -1
- package/util/pureUtil.js +5 -1
- package/util/resourceUtil.js +5 -1
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -28,13 +32,17 @@ const pluralize_1 = __importDefault(require("pluralize"));
|
|
|
28
32
|
const inquirer = __importStar(require("inquirer"));
|
|
29
33
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
30
34
|
const util_1 = require("../../commandUtil/util");
|
|
31
|
-
const executionUtil_1 = require("../executionUtil");
|
|
32
35
|
const mablApi_1 = require("../../../mablApi");
|
|
33
36
|
const index_1 = require("../../../proxy/index");
|
|
34
37
|
const RichPromise_1 = __importDefault(require("../../../util/RichPromise"));
|
|
35
38
|
const pureUtil_1 = require("../../../util/pureUtil");
|
|
36
39
|
const constants_1 = require("../../constants");
|
|
40
|
+
const authenticationProvider_1 = require("../../../providers/authenticationProvider");
|
|
41
|
+
const testsUtil_1 = require("../testsUtil");
|
|
42
|
+
const asyncUtil_1 = require("../../../util/asyncUtil");
|
|
37
43
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
44
|
+
const { MablTestRunner, MablTestsRunner } = require('../../../execution');
|
|
45
|
+
const DEFAULT_ASYNC_TIMEOUT_MILLIS = 120000;
|
|
38
46
|
const CommandArgAuto = 'auto-save';
|
|
39
47
|
const CommandArgDebug = 'debug';
|
|
40
48
|
const CommandArgMulti = 'multi';
|
|
@@ -97,11 +105,11 @@ exports.builder = (yargs) => {
|
|
|
97
105
|
type: 'string',
|
|
98
106
|
});
|
|
99
107
|
};
|
|
100
|
-
exports.handler = util_1.failWrapper(importTest);
|
|
108
|
+
exports.handler = (0, util_1.failWrapper)(importTest);
|
|
101
109
|
async function importTest(parsed) {
|
|
102
|
-
const workspaceId = util_1.getWorkspaceId(parsed);
|
|
110
|
+
const workspaceId = (0, util_1.getWorkspaceId)(parsed);
|
|
103
111
|
const importMultipleTests = parsed.multi;
|
|
104
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.
|
|
112
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
105
113
|
const name = await getTestName(parsed.name);
|
|
106
114
|
const importedTests = await importTests(parsed.port, parsed.debug, importMultipleTests);
|
|
107
115
|
if (!importedTests.length) {
|
|
@@ -111,7 +119,7 @@ async function importTest(parsed) {
|
|
|
111
119
|
loggingProvider_1.logger.info(`Imported ${importedTests.length} tests.\n`);
|
|
112
120
|
}
|
|
113
121
|
else {
|
|
114
|
-
loggingProvider_1.logger.info(`Imported ${pluralize_1.default('step', importedTests[0].length, true)}.\n`);
|
|
122
|
+
loggingProvider_1.logger.info(`Imported ${(0, pluralize_1.default)('step', importedTests[0].length, true)}.\n`);
|
|
115
123
|
}
|
|
116
124
|
return handlePostImportActions(workspaceId, name, apiClient, importedTests, parsed.autoSave);
|
|
117
125
|
}
|
|
@@ -139,7 +147,7 @@ async function importTests(port, debug, importMultipleTests) {
|
|
|
139
147
|
if (steps.length) {
|
|
140
148
|
importedTests.push(steps);
|
|
141
149
|
if (importMultipleTests) {
|
|
142
|
-
loggingProvider_1.logger.info(`Detected end of test ${importedTests.length} with ${pluralize_1.default('step', steps.length, true)}.`);
|
|
150
|
+
loggingProvider_1.logger.info(`Detected end of test ${importedTests.length} with ${(0, pluralize_1.default)('step', steps.length, true)}.`);
|
|
143
151
|
loggingProvider_1.logger.info('Press CTRL+C to end multiple test import.');
|
|
144
152
|
}
|
|
145
153
|
}
|
|
@@ -151,7 +159,7 @@ async function importTests(port, debug, importMultipleTests) {
|
|
|
151
159
|
loggingProvider_1.logger.logNewLine();
|
|
152
160
|
importCancelPromise.resolve();
|
|
153
161
|
});
|
|
154
|
-
seleniumProxy.start();
|
|
162
|
+
await seleniumProxy.start();
|
|
155
163
|
loggingProvider_1.logger.info(`Configure your test to use a selenium proxy at localhost:${port} and run the test now.`);
|
|
156
164
|
if (importMultipleTests) {
|
|
157
165
|
loggingProvider_1.logger.info('Press CTRL+C to end multiple test import.');
|
|
@@ -187,7 +195,7 @@ async function handlePostImportActions(workspaceId, name, apiClient, importedTes
|
|
|
187
195
|
displayTestDescriptions(importedTests);
|
|
188
196
|
break;
|
|
189
197
|
case PostImportActions.Run:
|
|
190
|
-
await runTests(workspaceId, name, importedTests);
|
|
198
|
+
await runTests(workspaceId, name, apiClient, importedTests);
|
|
191
199
|
break;
|
|
192
200
|
case PostImportActions.Discard:
|
|
193
201
|
loggingProvider_1.logger.info('Exiting without saving.');
|
|
@@ -212,7 +220,7 @@ async function getNextAction(autoSave) {
|
|
|
212
220
|
return answer.action;
|
|
213
221
|
}
|
|
214
222
|
function saveTests(workspaceId, name, apiClient, importedTests) {
|
|
215
|
-
loggingProvider_1.logger.info(`Saving ${pluralize_1.default('test', importedTests.length, true)}...`);
|
|
223
|
+
loggingProvider_1.logger.info(`Saving ${(0, pluralize_1.default)('test', importedTests.length, true)}...`);
|
|
216
224
|
const savePromises = importedTests.map((steps, index) => apiClient
|
|
217
225
|
.createFlow(stepsToFlow(workspaceId, steps))
|
|
218
226
|
.then((flow) => apiClient.createJourney(flowToJourney(importedTests.length === 1
|
|
@@ -233,10 +241,11 @@ function displayTestDescriptions(importedTests) {
|
|
|
233
241
|
loggingProvider_1.logger.logNewLine();
|
|
234
242
|
});
|
|
235
243
|
}
|
|
236
|
-
async function runTests(workspaceId, name, importedTests) {
|
|
244
|
+
async function runTests(workspaceId, name, apiClient, importedTests) {
|
|
237
245
|
var _a, _b;
|
|
238
246
|
const flows = importedTests.map((steps) => stepsToFlow(workspaceId, steps));
|
|
239
247
|
const firstUrl = (_a = flows.find((flow) => flow.url)) === null || _a === void 0 ? void 0 : _a.url;
|
|
248
|
+
const browserPath = (0, testsUtil_1.findChrome)();
|
|
240
249
|
for (let flowIndex = 0; flowIndex < flows.length; flowIndex++) {
|
|
241
250
|
loggingProvider_1.logger.info(`Running test ${flowIndex + 1} of ${flows.length}.`);
|
|
242
251
|
const flow = flows[flowIndex];
|
|
@@ -246,20 +255,22 @@ async function runTests(workspaceId, name, importedTests) {
|
|
|
246
255
|
flows: [],
|
|
247
256
|
url: (_b = flow.url) !== null && _b !== void 0 ? _b : firstUrl,
|
|
248
257
|
};
|
|
249
|
-
await
|
|
258
|
+
const testRunner = await createTestRunner(apiClient, journey, flow, journey.url, workspaceId, browserPath);
|
|
259
|
+
const results = await testRunner.run();
|
|
260
|
+
loggingProvider_1.logger.info(`Test result: ${results.status}`);
|
|
250
261
|
}
|
|
251
262
|
}
|
|
252
263
|
function stepsToFlow(workspaceId, steps) {
|
|
253
264
|
const prototype = {
|
|
254
265
|
import_source_id: mablApi_1.Flow.ImportSourceIdEnum.SeleniumNodeProxy,
|
|
255
|
-
import_source_version: pureUtil_1.getCliVersion(),
|
|
266
|
+
import_source_version: (0, pureUtil_1.getCliVersion)(),
|
|
256
267
|
flow_type: mablApi_1.Flow.FlowTypeEnum.Mablscript,
|
|
257
268
|
organization_id: workspaceId,
|
|
258
269
|
reusable: false,
|
|
259
270
|
selectors: steps
|
|
260
271
|
.map((step) => step.selector)
|
|
261
272
|
.map((selector) => selector === null || selector === void 0 ? void 0 : selector.toMablscriptSelector())
|
|
262
|
-
.filter((selector) =>
|
|
273
|
+
.filter((selector) => selector)
|
|
263
274
|
.map((selector) => selector),
|
|
264
275
|
script: steps.map((step) => step.mablscript).join('\n'),
|
|
265
276
|
script_description: steps.map((step) => step.description).join('\n'),
|
|
@@ -276,3 +287,13 @@ function flowToJourney(name, flow) {
|
|
|
276
287
|
};
|
|
277
288
|
return prototype;
|
|
278
289
|
}
|
|
290
|
+
async function createTestRunner(apiClient, test, flow, url, workspaceId, browserPath) {
|
|
291
|
+
const authConfig = await (0, asyncUtil_1.promiseWithTimeout)(new authenticationProvider_1.AuthenticationProvider().getAuthConfigWithAutoRenew(), DEFAULT_ASYNC_TIMEOUT_MILLIS, 'Get auth config with auto renew');
|
|
292
|
+
await (0, asyncUtil_1.promiseWithTimeout)(MablTestsRunner.validateAuth(apiClient, authConfig), DEFAULT_ASYNC_TIMEOUT_MILLIS, 'Validate auth');
|
|
293
|
+
const runner = new MablTestRunner({
|
|
294
|
+
mablApiClient: apiClient,
|
|
295
|
+
testRunConfig: { imported: true, url, workspaceId },
|
|
296
|
+
});
|
|
297
|
+
await runner.initializeTestRunner(test, [flow], 'master', apiClient, browserPath, false, { url });
|
|
298
|
+
return runner;
|
|
299
|
+
}
|
|
@@ -39,10 +39,10 @@ exports.builder = (yargs) => {
|
|
|
39
39
|
type: 'string',
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
exports.handler = util_1.failWrapper(listTests);
|
|
42
|
+
exports.handler = (0, util_1.failWrapper)(listTests);
|
|
43
43
|
async function listTests(parsed) {
|
|
44
44
|
const limit = parsed.limit;
|
|
45
|
-
const workspaceId = util_1.getWorkspaceId(parsed);
|
|
45
|
+
const workspaceId = (0, util_1.getWorkspaceId)(parsed);
|
|
46
46
|
const labels = parsed[constants_1.CommandArgLabels];
|
|
47
47
|
const output = parsed[constants_1.CommandArgOutput];
|
|
48
48
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -61,7 +61,7 @@ async function listTests(parsed) {
|
|
|
61
61
|
loggingProvider_1.logger.info(JSON.stringify(outputJourneys, null, 2));
|
|
62
62
|
break;
|
|
63
63
|
case constants_1.OutputFormats.Yaml:
|
|
64
|
-
loggingProvider_1.logger.info(js_yaml_1.dump(outputJourneys));
|
|
64
|
+
loggingProvider_1.logger.info((0, js_yaml_1.dump)(outputJourneys));
|
|
65
65
|
break;
|
|
66
66
|
case constants_1.OutputFormats.Table:
|
|
67
67
|
default:
|
|
@@ -119,11 +119,11 @@ 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) => (0, 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
|
-
exports.handler = util_1.failWrapper(runAlpha, exitCodeOnError);
|
|
125
|
+
exports.handler = (0, util_1.failWrapper)(runAlpha, exitCodeOnError);
|
|
126
126
|
function runAlpha(parsed) {
|
|
127
127
|
loggingProvider_1.logger.info(chalk.bgYellow.black(`DEPRECATION NOTICE: 'run-alpha' moved to 'run'. 'run-alpha' will be removed in a future release`));
|
|
128
|
-
return run_1.run(parsed);
|
|
128
|
+
return (0, run_1.run)(parsed);
|
|
129
129
|
}
|
|
@@ -130,9 +130,9 @@ 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) => (0, testsUtil_1.validateRunCommandWithLabels)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude]));
|
|
134
134
|
};
|
|
135
|
-
exports.handler = util_1.failWrapper(runInCloud);
|
|
135
|
+
exports.handler = (0, util_1.failWrapper)(runInCloud);
|
|
136
136
|
async function runInCloud(parsed) {
|
|
137
137
|
var _a, _b, _c;
|
|
138
138
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
|
|
@@ -172,8 +172,8 @@ async function runInCloud(parsed) {
|
|
|
172
172
|
return 'no-tests-to-run';
|
|
173
173
|
}
|
|
174
174
|
loggingProvider_1.logger.info('\n');
|
|
175
|
-
branches_1.printBranchRunningInfo(branchName);
|
|
176
|
-
loggingProvider_1.logger.info(`Executing ${pluralize_1.default('test', testCount, true)} in the mabl cloud...`);
|
|
175
|
+
(0, branches_1.printBranchRunningInfo)(branchName);
|
|
176
|
+
loggingProvider_1.logger.info(`Executing ${(0, pluralize_1.default)('test', testCount, true)} in the mabl cloud...`);
|
|
177
177
|
loggingProvider_1.logger.info(chalk.cyan(`Workspace: `, chalk.magenta(workspaceId)));
|
|
178
178
|
if (applicationId) {
|
|
179
179
|
loggingProvider_1.logger.info(chalk.cyan(`Application: `, chalk.magenta(applicationId)));
|
|
@@ -60,9 +60,9 @@ exports.builder = (yargs) => {
|
|
|
60
60
|
nargs: 1,
|
|
61
61
|
type: 'string',
|
|
62
62
|
})
|
|
63
|
-
.check((argv) => testsUtil_1.validateRunEditCommand(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
|
|
63
|
+
.check((argv) => (0, testsUtil_1.validateRunEditCommand)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
|
|
64
64
|
};
|
|
65
|
-
exports.handler = util_1.failWrapper(runLegacy);
|
|
65
|
+
exports.handler = (0, util_1.failWrapper)(runLegacy);
|
|
66
66
|
async function runLegacy(parsed) {
|
|
67
67
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
68
68
|
loggingProvider_1.logger.info(chalk_1.default.bgYellow.black("DEPRECATION NOTICE: 'run-legacy' will be removed in a future release. Please migrate to 'run'"));
|
|
@@ -70,7 +70,7 @@ async function runLegacy(parsed) {
|
|
|
70
70
|
const testRunId = parsed['run-id'];
|
|
71
71
|
let testRunIdConfig = { testId: '', filterHttpRequests: false };
|
|
72
72
|
if (testRunId) {
|
|
73
|
-
testRunIdConfig = await testsUtil_1.pullDownTestRunConfig(testRunId, apiClient);
|
|
73
|
+
testRunIdConfig = await (0, testsUtil_1.pullDownTestRunConfig)(testRunId, apiClient);
|
|
74
74
|
}
|
|
75
75
|
const testId = (_a = parsed.id) !== null && _a !== void 0 ? _a : testRunIdConfig.testId;
|
|
76
76
|
const url = (_b = parsed.url) !== null && _b !== void 0 ? _b : testRunIdConfig.url;
|
|
@@ -78,14 +78,14 @@ async function runLegacy(parsed) {
|
|
|
78
78
|
const branchName = (_e = (_d = parsed['mabl-branch']) !== null && _d !== void 0 ? _d : testRunIdConfig.branchName) !== null && _e !== void 0 ? _e : constants_1.DefaultBranchName;
|
|
79
79
|
const environmentId = (_f = parsed[constants_1.CommandArgEnvironmentId]) !== null && _f !== void 0 ? _f : testRunIdConfig.environmentId;
|
|
80
80
|
const test = await apiClient.getJourney(testId, branchName);
|
|
81
|
-
branches_1.printBranchRunningInfo(branchName);
|
|
82
|
-
branches_1.crossCheckBranchWithTest(branchName, test);
|
|
81
|
+
(0, branches_1.printBranchRunningInfo)(branchName);
|
|
82
|
+
(0, branches_1.crossCheckBranchWithTest)(branchName, test);
|
|
83
83
|
let environment;
|
|
84
84
|
if (environmentId) {
|
|
85
85
|
environment = await apiClient.getEnvironment(environmentId, true);
|
|
86
86
|
}
|
|
87
|
-
const flowArray = await util_1.getJourneyFlowArray(test, apiClient, branchName);
|
|
88
|
-
const finalUrl = testsUtil_1.getFinalUrl(test, url);
|
|
87
|
+
const flowArray = await (0, util_1.getJourneyFlowArray)(test, apiClient, branchName);
|
|
88
|
+
const finalUrl = (0, testsUtil_1.getFinalUrl)(test, url);
|
|
89
89
|
if (flowArray
|
|
90
90
|
.map((flow) => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript)
|
|
91
91
|
.includes(false)) {
|
|
@@ -104,6 +104,6 @@ async function runLegacy(parsed) {
|
|
|
104
104
|
if (test.description) {
|
|
105
105
|
loggingProvider_1.logger.info(chalk_1.default.cyan(`Test description: `, chalk_1.default.magenta(test.description)));
|
|
106
106
|
}
|
|
107
|
-
await executionUtil_1.runTheTestInNewWindow(test, flowArray, branchName, finalUrl, credentialsId, environment, parsed.width, parsed.height);
|
|
107
|
+
await (0, executionUtil_1.runTheTestInNewWindow)(test, flowArray, branchName, finalUrl, credentialsId, environment, parsed.width, parsed.height);
|
|
108
108
|
return 'done';
|
|
109
109
|
}
|
|
@@ -156,15 +156,15 @@ exports.builder = (yargs) => {
|
|
|
156
156
|
choices: Object.keys(mablApi_1.JourneyParameters.PageLoadWaitEnum).map((pageLoadWait) => pageLoadWait.toLowerCase()),
|
|
157
157
|
})
|
|
158
158
|
.check((argv) => {
|
|
159
|
-
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]);
|
|
159
|
+
(0, 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]);
|
|
160
160
|
const httpHeaders = argv[constants_1.CommandArgHttpHeaders];
|
|
161
|
-
util_1.validateArrayInputs(httpHeaders, 'HTTP headers must be SPACE delimited, e.g. "--http-headers "foo:bar" "baz:qux"');
|
|
162
|
-
argv[constants_1.CommandArgHttpHeaders] = util_1.validateValuePairInputs('HTTP header', httpHeaders);
|
|
161
|
+
(0, util_1.validateArrayInputs)(httpHeaders, 'HTTP headers must be SPACE delimited, e.g. "--http-headers "foo:bar" "baz:qux"');
|
|
162
|
+
argv[constants_1.CommandArgHttpHeaders] = (0, util_1.validateValuePairInputs)('HTTP header', httpHeaders);
|
|
163
163
|
return true;
|
|
164
164
|
});
|
|
165
165
|
};
|
|
166
166
|
const exitCodeOnError = 1;
|
|
167
|
-
exports.handler = util_1.failWrapper(run, exitCodeOnError);
|
|
167
|
+
exports.handler = (0, util_1.failWrapper)(run, exitCodeOnError);
|
|
168
168
|
async function run(parsed) {
|
|
169
169
|
var _a, _b, _c;
|
|
170
170
|
const commandStartTime = Date.now();
|
|
@@ -212,7 +212,7 @@ async function run(parsed) {
|
|
|
212
212
|
if (results.numPassedTests) {
|
|
213
213
|
results.testResults.forEach((result) => {
|
|
214
214
|
if (result.status === 'passed') {
|
|
215
|
-
loggingProvider_1.logger.info(` - ${result.testName} (${testsUtil_1.calculateTotalTimeSeconds(result.startTime, result.endTime)}s)`);
|
|
215
|
+
loggingProvider_1.logger.info(` - ${result.testName} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`);
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
}
|
|
@@ -228,13 +228,13 @@ async function run(parsed) {
|
|
|
228
228
|
if (results.numFailedTests) {
|
|
229
229
|
results.testResults.forEach((result) => {
|
|
230
230
|
if (result.status === 'failed') {
|
|
231
|
-
loggingProvider_1.logger.info(chalk.red(` - ${result.testName} (${testsUtil_1.calculateTotalTimeSeconds(result.startTime, result.endTime)}s)`));
|
|
231
|
+
loggingProvider_1.logger.info(chalk.red(` - ${result.testName} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`));
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
loggingProvider_1.logger.info(`Total time: ${testsUtil_1.calculateTotalTimeSeconds(commandStartTime, Date.now())} seconds`);
|
|
235
|
+
loggingProvider_1.logger.info(`Total time: ${(0, testsUtil_1.calculateTotalTimeSeconds)(commandStartTime, Date.now())} seconds`);
|
|
236
236
|
if (parsed.reporter) {
|
|
237
|
-
await reporter_1.handleReportingForTestsRun(parsed.reporter, results, parsed['reporter-options']);
|
|
237
|
+
await (0, reporter_1.handleReportingForTestsRun)(parsed.reporter, results, parsed['reporter-options']);
|
|
238
238
|
}
|
|
239
239
|
if (!results.success && !testRunnerConfig.keepBrowserOpen) {
|
|
240
240
|
process.exit(1);
|
|
@@ -93,7 +93,7 @@ function getTrainerVersion() {
|
|
|
93
93
|
exports.getTrainerVersion = getTrainerVersion;
|
|
94
94
|
async function downloadTrainer(version) {
|
|
95
95
|
fs.ensureDirSync(getTrainerPath());
|
|
96
|
-
const client = axios_1.default.create(httpUtil_1.currentProxyConfig());
|
|
96
|
+
const client = axios_1.default.create((0, httpUtil_1.currentProxyConfig)());
|
|
97
97
|
const url = `${env_1.BASE_API_URL}/trainer/distribution?${buildQueryStringsForDistro(version)}`;
|
|
98
98
|
const finalPath = getTrainerZipFile();
|
|
99
99
|
const writer = fs.createWriteStream(finalPath);
|
|
@@ -154,7 +154,7 @@ exports.checkForTrainerUpdate = checkForTrainerUpdate;
|
|
|
154
154
|
async function getCurrentVersionChecksum() {
|
|
155
155
|
const url = `${env_1.BASE_API_URL}/trainer/distribution?${buildQueryStringsForDistro()}`;
|
|
156
156
|
return axios_1.default
|
|
157
|
-
.head(url, httpUtil_1.currentProxyConfig())
|
|
157
|
+
.head(url, (0, httpUtil_1.currentProxyConfig)())
|
|
158
158
|
.then((response) => response.headers['x-goog-hash'])
|
|
159
159
|
.catch((error) => {
|
|
160
160
|
loggingProvider_1.logger.error(chalk.red.bold(`There was an issue checking the current mabl trainer. ${error.message}`));
|
|
@@ -19,7 +19,7 @@ async function updateTrainer(parsed) {
|
|
|
19
19
|
const version = parsed['trainer-version'];
|
|
20
20
|
const printedVersion = chalk.magenta(`${version !== null && version !== void 0 ? version : 'latest'}`);
|
|
21
21
|
loggingProvider_1.logger.info(`Updating the local version of the mabl Trainer to: ${printedVersion}`);
|
|
22
|
-
const updatedVersion = await trainerUtil_1.updateMablTrainer(version);
|
|
22
|
+
const updatedVersion = await (0, trainerUtil_1.updateMablTrainer)(version);
|
|
23
23
|
const newVersion = updatedVersion !== null && updatedVersion !== void 0 ? updatedVersion : 'unknown';
|
|
24
24
|
loggingProvider_1.logger.info(`Update complete, version: ${chalk.magenta(newVersion)}, is ready`);
|
|
25
25
|
return newVersion;
|
|
@@ -9,8 +9,8 @@ exports.builder = {};
|
|
|
9
9
|
exports.handler = getVersion;
|
|
10
10
|
async function getVersion() {
|
|
11
11
|
try {
|
|
12
|
-
await trainerUtil_1.checkForTrainerUpdate();
|
|
13
|
-
const trainerVersion = trainerUtil_1.getTrainerVersion() || '';
|
|
12
|
+
await (0, trainerUtil_1.checkForTrainerUpdate)();
|
|
13
|
+
const trainerVersion = (0, trainerUtil_1.getTrainerVersion)() || '';
|
|
14
14
|
if (trainerVersion) {
|
|
15
15
|
loggingProvider_1.logger.info(`Current CLI mabl Trainer version is: ${chalk.magenta(trainerVersion)}`);
|
|
16
16
|
}
|
|
@@ -27,9 +27,9 @@ exports.builder = (yargs) => {
|
|
|
27
27
|
nargs: 1,
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
exports.handler = util_1.failWrapper(copyWorkspace);
|
|
30
|
+
exports.handler = (0, util_1.failWrapper)(copyWorkspace);
|
|
31
31
|
function getTimestamp() {
|
|
32
|
-
return moment_1.default().format('HH:mm:ss');
|
|
32
|
+
return (0, moment_1.default)().format('HH:mm:ss');
|
|
33
33
|
}
|
|
34
34
|
function hasOwnerRoleInWorkspace(user, workspaceId) {
|
|
35
35
|
var _a;
|
|
@@ -4,15 +4,15 @@ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
|
4
4
|
const describe_1 = require("../../commandUtil/describe");
|
|
5
5
|
const util_1 = require("../../commandUtil/util");
|
|
6
6
|
exports.command = 'describe <id>';
|
|
7
|
-
exports.describe = util_1.getDescribeDescriptions('workspace');
|
|
8
|
-
exports.builder = describe_1.getDescribeBuilderOptions();
|
|
9
|
-
exports.handler = util_1.failWrapper(getWorkspace);
|
|
7
|
+
exports.describe = (0, util_1.getDescribeDescriptions)('workspace');
|
|
8
|
+
exports.builder = (0, describe_1.getDescribeBuilderOptions)();
|
|
9
|
+
exports.handler = (0, util_1.failWrapper)(getWorkspace);
|
|
10
10
|
async function getWorkspace(parsed) {
|
|
11
11
|
try {
|
|
12
12
|
const workspaceId = parsed.id;
|
|
13
13
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
14
14
|
const workspace = await apiClient.getWorkspace(workspaceId);
|
|
15
|
-
describe_1.outputEntity(workspace, parsed.output);
|
|
15
|
+
(0, describe_1.outputEntity)(workspace, parsed.output);
|
|
16
16
|
return workspace.id;
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
@@ -28,7 +28,7 @@ exports.builder = (yargs) => {
|
|
|
28
28
|
nargs: 1,
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
exports.handler = util_1.failWrapper(listWorkspaces);
|
|
31
|
+
exports.handler = (0, util_1.failWrapper)(listWorkspaces);
|
|
32
32
|
async function listWorkspaces(parsed) {
|
|
33
33
|
const output = parsed.output;
|
|
34
34
|
const limit = parsed.limit;
|
|
@@ -43,7 +43,7 @@ function printWorkspaces(workspaces, output) {
|
|
|
43
43
|
loggingProvider_1.logger.info(JSON.stringify(workspaces, null, 2));
|
|
44
44
|
break;
|
|
45
45
|
case 'yaml':
|
|
46
|
-
loggingProvider_1.logger.info(js_yaml_1.dump(workspaces));
|
|
46
|
+
loggingProvider_1.logger.info((0, js_yaml_1.dump)(workspaces));
|
|
47
47
|
break;
|
|
48
48
|
default:
|
|
49
49
|
const table = new cli_table3_1.default({
|
|
@@ -18,7 +18,7 @@ class FlowConfig {
|
|
|
18
18
|
flowConfig.flowType = this.flow.flow_type;
|
|
19
19
|
flowConfig.workspaceId = this.flow.organization_id;
|
|
20
20
|
flowConfig.reusable = this.flow.reusable;
|
|
21
|
-
const loadedSteps = importer_1.parseMablScriptIntoSteps(this.flow);
|
|
21
|
+
const loadedSteps = (0, importer_1.parseMablScriptIntoSteps)(this.flow);
|
|
22
22
|
flowConfig.steps = loadedSteps.map((step) => step.getFormattedStep(this.includeLocatorInfo));
|
|
23
23
|
return flowConfig;
|
|
24
24
|
}
|
|
@@ -12,15 +12,15 @@ class SelIdeConfig {
|
|
|
12
12
|
var _a;
|
|
13
13
|
const selIdeConfig = {};
|
|
14
14
|
const selIdeTest = {};
|
|
15
|
-
selIdeTest.id = SeleniumIdeStep_1.generateIdForSeleniumEntity(this.journey.id + 'test');
|
|
15
|
+
selIdeTest.id = (0, SeleniumIdeStep_1.generateIdForSeleniumEntity)(this.journey.id + 'test');
|
|
16
16
|
selIdeTest.name = (_a = this.journey.name) !== null && _a !== void 0 ? _a : '';
|
|
17
17
|
let steps = [];
|
|
18
18
|
this.flows.forEach((flow) => {
|
|
19
|
-
const loadedSteps = importer_1.parseMablScriptIntoSteps(flow);
|
|
19
|
+
const loadedSteps = (0, importer_1.parseMablScriptIntoSteps)(flow);
|
|
20
20
|
steps = steps.concat(loadedSteps);
|
|
21
21
|
});
|
|
22
|
-
selIdeTest.commands = importer_1.seleniumIdeTheLoadedSteps(steps);
|
|
23
|
-
const storeDefaultUrl = SeleniumIdeStep_1.buildSeleniumIdeStep('store');
|
|
22
|
+
selIdeTest.commands = (0, importer_1.seleniumIdeTheLoadedSteps)(steps);
|
|
23
|
+
const storeDefaultUrl = (0, SeleniumIdeStep_1.buildSeleniumIdeStep)('store');
|
|
24
24
|
if (this.journey.url) {
|
|
25
25
|
storeDefaultUrl.target = this.journey.url;
|
|
26
26
|
selIdeConfig.url = this.journey.url;
|
|
@@ -32,7 +32,7 @@ class SelIdeConfig {
|
|
|
32
32
|
selIdeConfig.tests = [selIdeTest];
|
|
33
33
|
selIdeConfig.suites = [
|
|
34
34
|
{
|
|
35
|
-
id: SeleniumIdeStep_1.generateIdForSeleniumEntity(this.journey.id + 'suite'),
|
|
35
|
+
id: (0, SeleniumIdeStep_1.generateIdForSeleniumEntity)(this.journey.id + 'suite'),
|
|
36
36
|
name: this.journey.name,
|
|
37
37
|
persistSession: false,
|
|
38
38
|
parallel: false,
|
|
@@ -40,7 +40,7 @@ class SelIdeConfig {
|
|
|
40
40
|
tests: [selIdeTest.id],
|
|
41
41
|
},
|
|
42
42
|
];
|
|
43
|
-
selIdeConfig.id = SeleniumIdeStep_1.generateIdForSeleniumEntity(this.journey.id + 'config');
|
|
43
|
+
selIdeConfig.id = (0, SeleniumIdeStep_1.generateIdForSeleniumEntity)(this.journey.id + 'config');
|
|
44
44
|
return selIdeConfig;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -9,10 +9,10 @@ var RunnerActionMessageTypes;
|
|
|
9
9
|
})(RunnerActionMessageTypes = exports.RunnerActionMessageTypes || (exports.RunnerActionMessageTypes = {}));
|
|
10
10
|
class RunnerActionEventEmitter {
|
|
11
11
|
static stopRunningTest(eventEmitter) {
|
|
12
|
-
messaging_1.getEmitter(eventEmitter).sendToProcess(new messaging_1.MablCoreProcessAction(RunnerActionMessageTypes.RUNNER_STOP, {}));
|
|
12
|
+
(0, messaging_1.getEmitter)(eventEmitter).sendToProcess(new messaging_1.MablCoreProcessAction(RunnerActionMessageTypes.RUNNER_STOP, {}));
|
|
13
13
|
}
|
|
14
14
|
static killRunningTest(eventEmitter) {
|
|
15
|
-
messaging_1.getEmitter(eventEmitter).sendToProcess(new messaging_1.MablCoreProcessAction(RunnerActionMessageTypes.RUNNER_TERMINATE, {}));
|
|
15
|
+
(0, messaging_1.getEmitter)(eventEmitter).sendToProcess(new messaging_1.MablCoreProcessAction(RunnerActionMessageTypes.RUNNER_TERMINATE, {}));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.RunnerActionEventEmitter = RunnerActionEventEmitter;
|
|
@@ -12,11 +12,11 @@ const messaging_1 = require("../messaging/messaging");
|
|
|
12
12
|
const chalk_1 = __importDefault(require("chalk"));
|
|
13
13
|
async function openUrlInDesktopApp(url, trainingSessionOptions) {
|
|
14
14
|
const params = querystring_1.default.stringify({ ...trainingSessionOptions });
|
|
15
|
-
const childProcess = await open_1.default(`${env_1.ELECTRON_PROTOCOL}://${url}/${params}`);
|
|
15
|
+
const childProcess = await (0, open_1.default)(`${env_1.ELECTRON_PROTOCOL}://${url}/${params}`);
|
|
16
16
|
let childProcessExited = false;
|
|
17
17
|
const keepAliveUntilExited = () => {
|
|
18
18
|
if (!childProcessExited) {
|
|
19
|
-
timers_1.setTimeout(keepAliveUntilExited, 1000);
|
|
19
|
+
(0, timers_1.setTimeout)(keepAliveUntilExited, 1000);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
keepAliveUntilExited();
|
|
@@ -14,12 +14,12 @@ var ElectronProtocolUrl;
|
|
|
14
14
|
})(ElectronProtocolUrl = exports.ElectronProtocolUrl || (exports.ElectronProtocolUrl = {}));
|
|
15
15
|
async function trainNewTest(trainingSessionOptions) {
|
|
16
16
|
var _a;
|
|
17
|
-
const apiClient = await util_1.getApiClientFromOptions(trainingSessionOptions, true);
|
|
17
|
+
const apiClient = await (0, util_1.getApiClientFromOptions)(trainingSessionOptions, true);
|
|
18
18
|
if (!trainingSessionOptions.branchName) {
|
|
19
19
|
trainingSessionOptions.branchName = constants_1.DefaultBranchName;
|
|
20
20
|
}
|
|
21
21
|
if (trainingSessionOptions.branchName !== 'master') {
|
|
22
|
-
await branches_1.checkBranchNameAndAutoBranchMaybe(trainingSessionOptions.workspaceId, apiClient, trainingSessionOptions.branchName, trainingSessionOptions.autoBranch);
|
|
22
|
+
await (0, branches_1.checkBranchNameAndAutoBranchMaybe)(trainingSessionOptions.workspaceId, apiClient, trainingSessionOptions.branchName, trainingSessionOptions.autoBranch);
|
|
23
23
|
}
|
|
24
24
|
if (trainingSessionOptions.environmentId) {
|
|
25
25
|
await apiClient.getEnvironment(trainingSessionOptions.environmentId);
|
|
@@ -33,26 +33,26 @@ async function trainNewTest(trainingSessionOptions) {
|
|
|
33
33
|
if (trainingSessionOptions.applicationId) {
|
|
34
34
|
await apiClient.getApplication(trainingSessionOptions.applicationId);
|
|
35
35
|
}
|
|
36
|
-
testsUtil_1.logTestInfoIfPresent(`Creating test in desktop app: `, trainingSessionOptions.testName);
|
|
37
|
-
testsUtil_1.logTestInfoIfPresent(`Add auto login flow: `, trainingSessionOptions.autoLogin);
|
|
38
|
-
testsUtil_1.logTestInfoIfPresent(`URL: `, trainingSessionOptions.url);
|
|
39
|
-
testsUtil_1.logTestInfoIfPresent(`Workspace: `, trainingSessionOptions.workspaceId);
|
|
40
|
-
testsUtil_1.logTestInfoIfPresent(`Branch: `, trainingSessionOptions.branchName);
|
|
41
|
-
testsUtil_1.logTestInfoIfPresent(`Plan ID: `, trainingSessionOptions.planId);
|
|
42
|
-
testsUtil_1.logTestInfoIfPresent(`Application ID: `, trainingSessionOptions.applicationId);
|
|
43
|
-
testsUtil_1.logTestInfoIfPresent(`Environment ID: `, trainingSessionOptions.environmentId);
|
|
44
|
-
testsUtil_1.logTestInfoIfPresent(`Credentials ID: `, trainingSessionOptions.credentialsId);
|
|
45
|
-
testsUtil_1.logTestInfoIfPresent(`Datatable ID(s): `, (_a = trainingSessionOptions.dataTableIds) === null || _a === void 0 ? void 0 : _a.join(', '));
|
|
46
|
-
testsUtil_1.logTestInfoIfPresent(`Test description: `, trainingSessionOptions.testDescription);
|
|
47
|
-
await openUtils_1.openUrlInDesktopApp(ElectronProtocolUrl.TRAIN_NEW_TEST, trainingSessionOptions);
|
|
36
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Creating test in desktop app: `, trainingSessionOptions.testName);
|
|
37
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Add auto login flow: `, trainingSessionOptions.autoLogin);
|
|
38
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`URL: `, trainingSessionOptions.url);
|
|
39
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Workspace: `, trainingSessionOptions.workspaceId);
|
|
40
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Branch: `, trainingSessionOptions.branchName);
|
|
41
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Plan ID: `, trainingSessionOptions.planId);
|
|
42
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Application ID: `, trainingSessionOptions.applicationId);
|
|
43
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Environment ID: `, trainingSessionOptions.environmentId);
|
|
44
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Credentials ID: `, trainingSessionOptions.credentialsId);
|
|
45
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Datatable ID(s): `, (_a = trainingSessionOptions.dataTableIds) === null || _a === void 0 ? void 0 : _a.join(', '));
|
|
46
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Test description: `, trainingSessionOptions.testDescription);
|
|
47
|
+
await (0, openUtils_1.openUrlInDesktopApp)(ElectronProtocolUrl.TRAIN_NEW_TEST, trainingSessionOptions);
|
|
48
48
|
}
|
|
49
49
|
exports.trainNewTest = trainNewTest;
|
|
50
50
|
async function editTest(trainingSessionOptions) {
|
|
51
51
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
52
|
-
const apiClient = await util_1.getApiClientFromOptions(trainingSessionOptions, true);
|
|
52
|
+
const apiClient = await (0, util_1.getApiClientFromOptions)(trainingSessionOptions, true);
|
|
53
53
|
let testRunIdConfig = { testId: '', filterHttpRequests: false };
|
|
54
54
|
if (trainingSessionOptions.testRunId) {
|
|
55
|
-
testRunIdConfig = await testsUtil_1.pullDownTestRunConfig(trainingSessionOptions.testRunId, apiClient);
|
|
55
|
+
testRunIdConfig = await (0, testsUtil_1.pullDownTestRunConfig)(trainingSessionOptions.testRunId, apiClient);
|
|
56
56
|
}
|
|
57
57
|
const url = (_a = trainingSessionOptions.url) !== null && _a !== void 0 ? _a : testRunIdConfig.url;
|
|
58
58
|
const credentialsId = (_b = trainingSessionOptions.credentialsId) !== null && _b !== void 0 ? _b : testRunIdConfig.credentialsId;
|
|
@@ -70,19 +70,19 @@ async function editTest(trainingSessionOptions) {
|
|
|
70
70
|
throw new Error(util_2.TEST_INFO_NOT_FOUND);
|
|
71
71
|
}
|
|
72
72
|
if (branchName !== 'master') {
|
|
73
|
-
await branches_1.checkBranchNameAndAutoBranchMaybe(test.organization_id, apiClient, branchName, trainingSessionOptions.autoBranch);
|
|
73
|
+
await (0, branches_1.checkBranchNameAndAutoBranchMaybe)(test.organization_id, apiClient, branchName, trainingSessionOptions.autoBranch);
|
|
74
74
|
}
|
|
75
|
-
const finalUrl = testsUtil_1.getFinalUrl(test, url);
|
|
75
|
+
const finalUrl = (0, testsUtil_1.getFinalUrl)(test, url);
|
|
76
76
|
if (environmentId) {
|
|
77
77
|
await apiClient.getEnvironment(environmentId);
|
|
78
78
|
}
|
|
79
|
-
testsUtil_1.logTestInfoIfPresent(`Editing test in desktop app: `, `${test.name} - ${test.invariant_id}`);
|
|
80
|
-
testsUtil_1.logTestInfoIfPresent(`Test description: `, test.description);
|
|
81
|
-
testsUtil_1.logTestInfoIfPresent(`URL: `, finalUrl);
|
|
82
|
-
testsUtil_1.logTestInfoIfPresent(`Workspace: `, test.organization_id);
|
|
83
|
-
testsUtil_1.logTestInfoIfPresent(`Branch: `, branchName);
|
|
84
|
-
testsUtil_1.logTestInfoIfPresent(`Environment ID: `, environmentId);
|
|
85
|
-
testsUtil_1.logTestInfoIfPresent(`Credentials ID: `, credentialsId);
|
|
79
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Editing test in desktop app: `, `${test.name} - ${test.invariant_id}`);
|
|
80
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Test description: `, test.description);
|
|
81
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`URL: `, finalUrl);
|
|
82
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Workspace: `, test.organization_id);
|
|
83
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Branch: `, branchName);
|
|
84
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Environment ID: `, environmentId);
|
|
85
|
+
(0, testsUtil_1.logTestInfoIfPresent)(`Credentials ID: `, credentialsId);
|
|
86
86
|
const scriptConfig = {
|
|
87
87
|
applicationId: trainingSessionOptions.applicationId,
|
|
88
88
|
branchName,
|
|
@@ -95,6 +95,6 @@ async function editTest(trainingSessionOptions) {
|
|
|
95
95
|
planId: testRunIdConfig.fromPlanId,
|
|
96
96
|
url: finalUrl,
|
|
97
97
|
};
|
|
98
|
-
await openUtils_1.openUrlInDesktopApp(ElectronProtocolUrl.EDIT_TEST, scriptConfig);
|
|
98
|
+
await (0, openUtils_1.openUrlInDesktopApp)(ElectronProtocolUrl.EDIT_TEST, scriptConfig);
|
|
99
99
|
}
|
|
100
100
|
exports.editTest = editTest;
|