@mablhq/mabl-cli 1.16.32 → 1.18.3
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/featureSet.js +1 -4
- package/api/mablApiClient.js +16 -9
- package/browserLauncher/browserLauncherFactory.js +4 -4
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +8 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +11 -9
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +23 -29
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +28 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +5 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +13 -9
- package/browserLauncher/runnerType.js +0 -1
- 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 +3 -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 +30 -18
- 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 +13 -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/domUtil/index.js.LICENSE.txt +5 -5
- package/env/env.js +5 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +7 -5
- package/index.d.ts +0 -1
- package/mablApi/index.js +1 -1
- package/mablscript/AttributesConstants.js +2 -1
- package/mablscript/MablAction.js +1 -1
- package/mablscript/MablStep.js +26 -14
- package/mablscript/actions/AwaitPDFDownloadAction.js +2 -1
- package/mablscript/actions/ConditionAction.js +12 -4
- package/mablscript/actions/ExtractAction.js +16 -7
- package/mablscript/actions/FindAction.js +105 -80
- package/mablscript/actions/GenerateRandomStringAction.js +2 -1
- package/mablscript/actions/GetUrlAction.js +2 -2
- package/mablscript/actions/GetVariableValue.js +3 -3
- package/mablscript/actions/JavaScriptAction.js +16 -16
- package/mablscript/diffing/diffingUtil.js +146 -0
- package/mablscript/importer.js +26 -8
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +60 -46
- package/mablscript/steps/AssertStepOld.js +41 -23
- package/mablscript/steps/AwaitTabStep.js +7 -6
- package/mablscript/steps/ClickAndHoldStep.js +6 -6
- package/mablscript/steps/ClickStep.js +6 -6
- package/mablscript/steps/CreateVariableStep.js +8 -8
- package/mablscript/steps/DoubleClickStep.js +7 -7
- package/mablscript/steps/DownloadStep.js +3 -2
- package/mablscript/steps/EchoStep.js +5 -3
- package/mablscript/steps/ElseIfConditionStep.js +5 -2
- package/mablscript/steps/EnterTextStep.js +13 -10
- package/mablscript/steps/EvaluateFlowStep.js +40 -0
- package/mablscript/steps/HoverStep.js +6 -6
- package/mablscript/steps/IfConditionStep.js +8 -7
- package/mablscript/steps/NavigateStep.js +1 -1
- package/mablscript/steps/ReleaseStep.js +7 -6
- package/mablscript/steps/RemoveCookieStep.js +2 -3
- package/mablscript/steps/SelectStep.js +5 -5
- package/mablscript/steps/SendHttpRequestStep.js +3 -3
- package/mablscript/steps/SendKeyStep.js +9 -9
- package/mablscript/steps/SetCookieStep.js +2 -4
- package/mablscript/steps/SetFilesStep.js +5 -5
- package/mablscript/steps/SetViewportStep.js +2 -2
- package/mablscript/steps/SwitchContextStep.js +12 -12
- package/mablscript/steps/VisitUrlStep.js +3 -2
- package/mablscript/steps/WaitStep.js +2 -5
- package/mablscript/steps/WaitUntilStep.js +3 -3
- package/{browserLauncher/puppeteerBrowserLauncher/internals.js → mablscript/types/EvaluateFlowStepDescriptor.js} +0 -0
- package/mablscript/types/GetCurrentLocationDescriptor.js +4 -3
- package/mablscript/types/OperatingSystemDescriptor.js +5 -1
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/mablscriptFind/index.js.LICENSE.txt +5 -5
- 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/pdf-viewer/index.js +1 -1
- package/resources/pdf-viewer/libEmbeddedPdfHandler.js +11 -2
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +1 -0
- package/util/actionabilityUtil.js +16 -35
- 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
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +0 -134
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowserLauncher.js +0 -45
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +0 -139
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +0 -115
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +0 -38
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +0 -27
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +0 -36
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +0 -331
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +0 -25
|
@@ -34,7 +34,7 @@ exports.builder = (yargs) => {
|
|
|
34
34
|
type: 'string',
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
exports.handler = util_1.failWrapper(pullFlow);
|
|
37
|
+
exports.handler = (0, util_1.failWrapper)(pullFlow);
|
|
38
38
|
async function pullFlow(parsed) {
|
|
39
39
|
var _a;
|
|
40
40
|
const flowId = parsed.id;
|
|
@@ -61,11 +61,11 @@ function dumpYamlOrJsonToFile(type, flow, detailLevel) {
|
|
|
61
61
|
: flowConfig.generateSimpleFormat();
|
|
62
62
|
switch (type) {
|
|
63
63
|
case constants_1.OutputFormats.Yaml:
|
|
64
|
-
const yaml = js_yaml_1.dump(configGenerated, { skipInvalid: false });
|
|
65
|
-
fileUtil_1.writeExportedEntityToFile(yaml, 'yml', flow.id);
|
|
64
|
+
const yaml = (0, js_yaml_1.dump)(configGenerated, { skipInvalid: false });
|
|
65
|
+
(0, fileUtil_1.writeExportedEntityToFile)(yaml, 'yml', flow.id);
|
|
66
66
|
break;
|
|
67
67
|
case constants_1.OutputFormats.Json:
|
|
68
|
-
fileUtil_1.writeExportedEntityToFile(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', flow.id);
|
|
68
|
+
(0, fileUtil_1.writeExportedEntityToFile)(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', flow.id);
|
|
69
69
|
break;
|
|
70
70
|
default:
|
|
71
71
|
throw new Error(`Invalid Type supplied for exporting flow: ${type}`);
|
|
@@ -74,5 +74,5 @@ function dumpYamlOrJsonToFile(type, flow, detailLevel) {
|
|
|
74
74
|
function dumpToCsv(flow) {
|
|
75
75
|
const flowConfig = new flowConfigGenerator_1.FlowConfig(flow, false);
|
|
76
76
|
const output = flowConfig.generateSimpleCsv();
|
|
77
|
-
fileUtil_1.writeExportedEntityToFile(output.join(os.EOL), 'csv', flow.id);
|
|
77
|
+
(0, fileUtil_1.writeExportedEntityToFile)(output.join(os.EOL), 'csv', flow.id);
|
|
78
78
|
}
|
|
@@ -27,10 +27,10 @@ exports.builder = (yargs) => {
|
|
|
27
27
|
type: 'string',
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
exports.handler = util_1.failWrapper(listFlows);
|
|
30
|
+
exports.handler = (0, util_1.failWrapper)(listFlows);
|
|
31
31
|
async function listFlows(parsed) {
|
|
32
32
|
const limit = parsed.limit;
|
|
33
|
-
const workspaceId = util_1.getWorkspaceId(parsed);
|
|
33
|
+
const workspaceId = (0, util_1.getWorkspaceId)(parsed);
|
|
34
34
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
35
35
|
const flows = await apiClient.getFlows({
|
|
36
36
|
organization_id: workspaceId,
|
|
@@ -4,9 +4,9 @@ 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('plan');
|
|
8
|
-
exports.builder = describe_1.getDescribeBuilderOptions();
|
|
9
|
-
exports.handler = util_1.failWrapper(getPlan);
|
|
7
|
+
exports.describe = (0, util_1.getDescribeDescriptions)('plan');
|
|
8
|
+
exports.builder = (0, describe_1.getDescribeBuilderOptions)();
|
|
9
|
+
exports.handler = (0, util_1.failWrapper)(getPlan);
|
|
10
10
|
async function getPlan(parsed) {
|
|
11
11
|
var _a;
|
|
12
12
|
try {
|
|
@@ -15,7 +15,7 @@ async function getPlan(parsed) {
|
|
|
15
15
|
const plan = await apiClient.getPlan(planId);
|
|
16
16
|
delete plan.execution_graph;
|
|
17
17
|
delete plan.journeys_ddt_migration_backup;
|
|
18
|
-
describe_1.outputEntity(plan, parsed.output);
|
|
18
|
+
(0, describe_1.outputEntity)(plan, parsed.output);
|
|
19
19
|
return (_a = plan.id) !== null && _a !== void 0 ? _a : '';
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
@@ -27,10 +27,10 @@ exports.builder = (yargs) => {
|
|
|
27
27
|
type: 'string',
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
exports.handler = util_1.failWrapper(listPlans);
|
|
30
|
+
exports.handler = (0, util_1.failWrapper)(listPlans);
|
|
31
31
|
async function listPlans(parsed) {
|
|
32
32
|
const limit = parsed.limit;
|
|
33
|
-
const workspaceId = util_1.getWorkspaceId(parsed);
|
|
33
|
+
const workspaceId = (0, util_1.getWorkspaceId)(parsed);
|
|
34
34
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
35
35
|
const plans = await apiClient.getPlans({
|
|
36
36
|
organization_id: workspaceId,
|
|
@@ -34,11 +34,11 @@ exports.builder = (yargs) => {
|
|
|
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
36
|
.check((argv) => {
|
|
37
|
-
util_1.validateArrayInputs(argv[constants_1.CommandArgContentTypes], 'export types must be SPACE delimited, e.g. "--types=screenshots doms"');
|
|
37
|
+
(0, util_1.validateArrayInputs)(argv[constants_1.CommandArgContentTypes], 'export types must be SPACE delimited, e.g. "--types=screenshots doms"');
|
|
38
38
|
return true;
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
exports.handler = util_1.failWrapper(createExport);
|
|
41
|
+
exports.handler = (0, util_1.failWrapper)(createExport);
|
|
42
42
|
async function createExport(parsed) {
|
|
43
43
|
const targetEntityId = parsed.id;
|
|
44
44
|
const targetEntityType = 'test run';
|
|
@@ -13,24 +13,24 @@ exports.DEFAULT_BROWSER_WIDTH = 1366;
|
|
|
13
13
|
exports.DEFAULT_BROWSER_HEIGHT = 768;
|
|
14
14
|
async function runTheTestInNewWindow(test, flows, branchName, url, credentialsId, environment, width, height) {
|
|
15
15
|
const authConfig = await new authenticationProvider_1.AuthenticationProvider().getAuthConfigWithAutoRenew();
|
|
16
|
-
const browserPreferences = testsUtil_1.generateChromiumPreferencesFile();
|
|
17
|
-
const browserPreferencesDirectory = await testsUtil_1.prepareChromePreferencesDirectory(browserPreferences);
|
|
16
|
+
const browserPreferences = (0, testsUtil_1.generateChromiumPreferencesFile)();
|
|
17
|
+
const browserPreferencesDirectory = await (0, testsUtil_1.prepareChromePreferencesDirectory)(browserPreferences);
|
|
18
18
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
19
19
|
if (!test.organization_id) {
|
|
20
20
|
throw new Error('The test workspace ID is required, but it is not set.');
|
|
21
21
|
}
|
|
22
22
|
const featureFlags = await apiClient.getEffectiveFeaturesByWorkspaceId(test.organization_id);
|
|
23
23
|
const runnerType = featureFlags.getRunnerType();
|
|
24
|
-
const trainingBrowser = await testsUtil_1.createBrowserWithAuthedExtension(authConfig.accessToken, width || exports.DEFAULT_BROWSER_WIDTH, height || exports.DEFAULT_BROWSER_HEIGHT, browserPreferencesDirectory, {
|
|
24
|
+
const trainingBrowser = await (0, testsUtil_1.createBrowserWithAuthedExtension)(authConfig.accessToken, width || exports.DEFAULT_BROWSER_WIDTH, height || exports.DEFAULT_BROWSER_HEIGHT, browserPreferencesDirectory, {
|
|
25
25
|
runnerType,
|
|
26
26
|
});
|
|
27
|
-
const backgroundPage = await testsUtil_1.getExtensionBackgroundPageWithCliTool(trainingBrowser);
|
|
27
|
+
const backgroundPage = await (0, testsUtil_1.getExtensionBackgroundPageWithCliTool)(trainingBrowser);
|
|
28
28
|
process.once('SIGINT', function () {
|
|
29
29
|
loggingProvider_1.logger.info(chalk_1.default.yellowBright('Closing local run of test'));
|
|
30
30
|
trainingBrowser
|
|
31
31
|
.close()
|
|
32
32
|
.catch((error) => loggingProvider_1.logger.info('Error shutting down browser on CTRL + C: ' + error));
|
|
33
33
|
});
|
|
34
|
-
await testsUtil_1.runTheTest(trainingBrowser, backgroundPage, test, flows, branchName, url, credentialsId, environment);
|
|
34
|
+
await (0, testsUtil_1.runTheTest)(trainingBrowser, backgroundPage, test, flows, branchName, url, credentialsId, environment);
|
|
35
35
|
}
|
|
36
36
|
exports.runTheTestInNewWindow = runTheTestInNewWindow;
|
|
@@ -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];
|
|
@@ -103,7 +107,7 @@ function findChrome() {
|
|
|
103
107
|
exports.findChrome = findChrome;
|
|
104
108
|
async function createBrowserWithAuthedExtension(accessToken, browserWidth, browserHeight, tempBrowserPreferencesDirectory, options) {
|
|
105
109
|
const { credentials, disableIsolation, ignoreCertificateErrors, runnerType, loggerFunc, } = options;
|
|
106
|
-
const pathToExtension = await trainerUtil_1.getMablTrainerExtensionPath();
|
|
110
|
+
const pathToExtension = await (0, trainerUtil_1.getMablTrainerExtensionPath)();
|
|
107
111
|
const chromePath = findChrome();
|
|
108
112
|
if (!chromePath.length) {
|
|
109
113
|
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'));
|
|
@@ -134,15 +138,17 @@ async function createBrowserWithAuthedExtension(accessToken, browserWidth, brows
|
|
|
134
138
|
}
|
|
135
139
|
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
136
140
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
137
|
-
const { defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, } = options || {};
|
|
141
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
138
142
|
let browser;
|
|
139
143
|
try {
|
|
140
144
|
browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
145
|
+
bypassContentSecurityPolicy,
|
|
141
146
|
defaultDeviceDescriptor,
|
|
142
147
|
extraHttpHeaders,
|
|
143
148
|
ignoreDefaultArgs,
|
|
144
149
|
runnerType,
|
|
145
150
|
loggerFunc,
|
|
151
|
+
userAgent,
|
|
146
152
|
});
|
|
147
153
|
}
|
|
148
154
|
catch (error) {
|
|
@@ -150,6 +156,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
150
156
|
launchArgs.push('--no-sandbox');
|
|
151
157
|
messaging_1.mablEventEmitter.log('Unable to initialize browser with standard settings, attempting to run with --no-sandbox setting', Date.now(), logLineMessaging_1.LogLineColor.yellow);
|
|
152
158
|
return maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
159
|
+
bypassContentSecurityPolicy,
|
|
153
160
|
defaultDeviceDescriptor,
|
|
154
161
|
ignoreDefaultArgs,
|
|
155
162
|
runnerType,
|
|
@@ -164,8 +171,9 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
164
171
|
return browser;
|
|
165
172
|
}
|
|
166
173
|
function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
167
|
-
const { defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, } = options || {};
|
|
174
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
168
175
|
return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
|
|
176
|
+
bypassContentSecurityPolicy,
|
|
169
177
|
defaultDeviceDescriptor,
|
|
170
178
|
executablePath: chromePath,
|
|
171
179
|
extraHttpHeaders,
|
|
@@ -175,10 +183,11 @@ function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, crede
|
|
|
175
183
|
userDataDir,
|
|
176
184
|
downloadPath: createDownloadDirectory(),
|
|
177
185
|
credentials,
|
|
186
|
+
userAgent,
|
|
178
187
|
});
|
|
179
188
|
}
|
|
180
189
|
async function prepareChromePreferencesDirectory(browserPreferences) {
|
|
181
|
-
return async_retry_1.default(() => {
|
|
190
|
+
return (0, async_retry_1.default)(() => {
|
|
182
191
|
const tempBrowserPreferencesDirectory = getTempChromePrefDirectory();
|
|
183
192
|
fs.ensureDirSync(path.normalize(`${tempBrowserPreferencesDirectory}/Default`));
|
|
184
193
|
const prefFilePath = path.normalize(`${tempBrowserPreferencesDirectory}/Default/Preferences`);
|
|
@@ -199,7 +208,7 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
202
|
-
const { credentials, browserPath, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, } = options || {};
|
|
211
|
+
const { bypassContentSecurityPolicy, credentials, browserPath, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, userAgent, } = options || {};
|
|
203
212
|
const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : findChrome();
|
|
204
213
|
if (!chromePath.length) {
|
|
205
214
|
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'));
|
|
@@ -215,19 +224,21 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
215
224
|
}
|
|
216
225
|
disableFeaturesFlags.push('site-per-process');
|
|
217
226
|
launchArgs.push(`--disable-features=${disableFeaturesFlags.join(',')}`);
|
|
218
|
-
const fakeMicrophoneMedia = resourceUtil_1.findResource('media/mabl_test_audio.wav', resourcesDirectoryOverride);
|
|
219
|
-
const fakeWebcamMedia = resourceUtil_1.findResource('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
|
|
227
|
+
const fakeMicrophoneMedia = (0, resourceUtil_1.findResource)('media/mabl_test_audio.wav', resourcesDirectoryOverride);
|
|
228
|
+
const fakeWebcamMedia = (0, resourceUtil_1.findResource)('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
|
|
220
229
|
const defaultDeviceDescriptor = addLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMedia, fakeWebcamMedia, ignoreCertificateErrors, emulationConfig);
|
|
221
230
|
let ignoreDefaultArgs;
|
|
222
231
|
if (enableExtensions) {
|
|
223
232
|
ignoreDefaultArgs = ['--disable-extensions'];
|
|
224
233
|
}
|
|
225
234
|
const maybeBrowser = await launchBrowserInstance(chromePath, launchArgs, tempBrowserPreferencesDirectory, headless, credentials, {
|
|
235
|
+
bypassContentSecurityPolicy,
|
|
226
236
|
defaultDeviceDescriptor,
|
|
227
237
|
extraHttpHeaders,
|
|
228
238
|
ignoreDefaultArgs,
|
|
229
239
|
runnerType,
|
|
230
240
|
loggerFunc,
|
|
241
|
+
userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
231
242
|
});
|
|
232
243
|
if (!maybeBrowser) {
|
|
233
244
|
throw new Error('Unable to start Chrome session');
|
|
@@ -238,11 +249,8 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
238
249
|
exports.createBrowser = createBrowser;
|
|
239
250
|
function addLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMediaPath, fakeWebcamMediaPath, ignoreCertificateErrors, emulationConfig) {
|
|
240
251
|
var _a, _b;
|
|
241
|
-
const defaultDeviceDescriptor = mobileEmulationUtil_1.getDeviceDescriptorForEmulation(emulationConfig);
|
|
252
|
+
const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig);
|
|
242
253
|
launchArgs.push(`--window-size=${(_a = defaultDeviceDescriptor === null || defaultDeviceDescriptor === void 0 ? void 0 : defaultDeviceDescriptor.width) !== null && _a !== void 0 ? _a : browserWidth},${(_b = defaultDeviceDescriptor === null || defaultDeviceDescriptor === void 0 ? void 0 : defaultDeviceDescriptor.height) !== null && _b !== void 0 ? _b : browserHeight}`);
|
|
243
|
-
if (emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent) {
|
|
244
|
-
launchArgs.push(`--user-agent=${emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent}`);
|
|
245
|
-
}
|
|
246
254
|
launchArgs.push('--use-fake-ui-for-media-stream');
|
|
247
255
|
launchArgs.push('--use-fake-device-for-media-stream');
|
|
248
256
|
launchArgs.push(`--use-file-for-fake-audio-capture=${fakeMicrophoneMediaPath}`);
|
|
@@ -277,6 +285,7 @@ async function createBrowserForExecutionEngine(browserWidth, browserHeight, head
|
|
|
277
285
|
defaultDeviceDescriptor,
|
|
278
286
|
runnerType,
|
|
279
287
|
loggerFunc,
|
|
288
|
+
userAgent: emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
280
289
|
});
|
|
281
290
|
if (!maybeBrowser) {
|
|
282
291
|
throw new Error('Unable to start Chrome session');
|
|
@@ -285,7 +294,7 @@ async function createBrowserForExecutionEngine(browserWidth, browserHeight, head
|
|
|
285
294
|
}
|
|
286
295
|
exports.createBrowserForExecutionEngine = createBrowserForExecutionEngine;
|
|
287
296
|
async function setUpAuthTokenForExtension(browser, accessToken) {
|
|
288
|
-
const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
|
|
297
|
+
const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
|
|
289
298
|
await backgroundPage.evaluate((token) => {
|
|
290
299
|
localStorage.setItem('authResult', JSON.stringify({ idToken: token }));
|
|
291
300
|
localStorage.setItem('trainerWorld', 'mablCLI');
|
|
@@ -294,7 +303,7 @@ async function setUpAuthTokenForExtension(browser, accessToken) {
|
|
|
294
303
|
}
|
|
295
304
|
exports.setUpAuthTokenForExtension = setUpAuthTokenForExtension;
|
|
296
305
|
async function getExtensionBackgroundPageWithCliTool(browser) {
|
|
297
|
-
const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
|
|
306
|
+
const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
|
|
298
307
|
if (backgroundPage) {
|
|
299
308
|
await checkForMablCliTool(backgroundPage);
|
|
300
309
|
await exposeMessagingFunctionToTrainer(backgroundPage, browser);
|
|
@@ -526,7 +535,7 @@ async function downloadUploadFile(fileUploadUrl, fileUpload, downloadDirectory,
|
|
|
526
535
|
client = mablApiClient.httpClient;
|
|
527
536
|
}
|
|
528
537
|
else {
|
|
529
|
-
client = axios_1.default.create(httpUtil_1.currentProxyConfig());
|
|
538
|
+
client = axios_1.default.create((0, httpUtil_1.currentProxyConfig)());
|
|
530
539
|
}
|
|
531
540
|
try {
|
|
532
541
|
const finalDirectory = path.normalize(`${downloadDirectory}/${fileUpload.id}`);
|
|
@@ -616,7 +625,9 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
|
616
625
|
filterHttpRequests: false,
|
|
617
626
|
testId: (_e = journeyRun.journey) === null || _e === void 0 ? void 0 : _e.invariant_id,
|
|
618
627
|
url: (_g = (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.deployment) === null || _g === void 0 ? void 0 : _g.uri,
|
|
619
|
-
basicAuthCredentialsId: ((_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.http_auth_credentials_required)
|
|
628
|
+
basicAuthCredentialsId: ((_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.http_auth_credentials_required)
|
|
629
|
+
? (_j = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _j === void 0 ? void 0 : _j.http_auth_credentials_id
|
|
630
|
+
: undefined,
|
|
620
631
|
dataTableVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.user_variables,
|
|
621
632
|
deviceEmulation: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.device_emulation,
|
|
622
633
|
importedVariables: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.imported_variables,
|
|
@@ -628,8 +639,9 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
628
639
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
629
640
|
const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
|
|
630
641
|
const planRun = executionMessage.plan_run;
|
|
631
|
-
const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
|
|
632
|
-
|
|
642
|
+
const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
|
|
643
|
+
?
|
|
644
|
+
(_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.nodejs_runtime_variant
|
|
633
645
|
: undefined;
|
|
634
646
|
return {
|
|
635
647
|
environmentId: (_e = (_d = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _d === void 0 ? void 0 : _d.deployment) === null || _e === void 0 ? void 0 : _e.environment_id,
|
|
@@ -90,13 +90,13 @@ exports.builder = (yargs) => {
|
|
|
90
90
|
type: 'string',
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
exports.handler = util_1.failWrapper(launchTrainingSession);
|
|
93
|
+
exports.handler = (0, util_1.failWrapper)(launchTrainingSession);
|
|
94
94
|
async function launchTrainingSession(parsed) {
|
|
95
95
|
const url = parsed.url;
|
|
96
96
|
const width = parsed.width;
|
|
97
97
|
const height = parsed.height;
|
|
98
98
|
const testName = parsed['test-name'];
|
|
99
|
-
const workspaceId = util_1.getWorkspaceId(parsed);
|
|
99
|
+
const workspaceId = (0, util_1.getWorkspaceId)(parsed);
|
|
100
100
|
const testDescription = parsed['test-description'];
|
|
101
101
|
const branchName = parsed['mabl-branch'];
|
|
102
102
|
const autoBranch = parsed['auto-branch'];
|
|
@@ -124,7 +124,7 @@ async function launchTrainingSession(parsed) {
|
|
|
124
124
|
width,
|
|
125
125
|
workspaceId,
|
|
126
126
|
};
|
|
127
|
-
await trainingSessions_1.trainNewTest(trainingSessionOptions);
|
|
127
|
+
await (0, trainingSessions_1.trainNewTest)(trainingSessionOptions);
|
|
128
128
|
return 'done';
|
|
129
129
|
}
|
|
130
130
|
exports.launchTrainingSession = launchTrainingSession;
|
|
@@ -76,9 +76,9 @@ 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) => (0, testsUtil_1.validateRunEditCommand)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
|
|
80
80
|
};
|
|
81
|
-
exports.handler = util_1.failWrapper(launchEditTrainingSession);
|
|
81
|
+
exports.handler = (0, util_1.failWrapper)(launchEditTrainingSession);
|
|
82
82
|
async function launchEditTrainingSession(parsed) {
|
|
83
83
|
const testRunId = parsed['run-id'];
|
|
84
84
|
const testId = parsed.id;
|
|
@@ -106,6 +106,6 @@ async function launchEditTrainingSession(parsed) {
|
|
|
106
106
|
url,
|
|
107
107
|
width,
|
|
108
108
|
};
|
|
109
|
-
await trainingSessions_1.editTest(editTrainingSessionOptions);
|
|
109
|
+
await (0, trainingSessions_1.editTest)(editTrainingSessionOptions);
|
|
110
110
|
return 'done';
|
|
111
111
|
}
|
|
@@ -43,7 +43,7 @@ exports.builder = (yargs) => {
|
|
|
43
43
|
type: 'string',
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
exports.handler = util_1.failWrapper(pullJourney);
|
|
46
|
+
exports.handler = (0, util_1.failWrapper)(pullJourney);
|
|
47
47
|
async function pullJourney(parsed) {
|
|
48
48
|
var _a;
|
|
49
49
|
const testId = parsed.id;
|
|
@@ -52,7 +52,7 @@ async function pullJourney(parsed) {
|
|
|
52
52
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createUserApiClient();
|
|
53
53
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
54
54
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
55
|
-
const flowArray = await util_1.getJourneyFlowArray(journey, apiClient, branchName);
|
|
55
|
+
const flowArray = await (0, util_1.getJourneyFlowArray)(journey, apiClient, branchName);
|
|
56
56
|
if (flowArray
|
|
57
57
|
.map((flow) => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript ||
|
|
58
58
|
flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Api)
|
|
@@ -78,7 +78,7 @@ function dumpToSeleniumIde(journey, flows) {
|
|
|
78
78
|
const selIdeConfig = new selIdeGenerator_1.SelIdeConfig(journey, flows);
|
|
79
79
|
const configGenerated = selIdeConfig.generateConfigFile();
|
|
80
80
|
const jsonified = JSON.stringify(configGenerated, JSON_REPLACER, 2);
|
|
81
|
-
fileUtil_1.writeExportedEntityToFile(jsonified, 'side', journey.id);
|
|
81
|
+
(0, fileUtil_1.writeExportedEntityToFile)(jsonified, 'side', journey.id);
|
|
82
82
|
}
|
|
83
83
|
function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
|
|
84
84
|
const journeyConfig = new testConfigGenerator_1.JourneyConfig(journey, flows, false);
|
|
@@ -87,11 +87,11 @@ function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
|
|
|
87
87
|
: journeyConfig.generateSimpleFormat();
|
|
88
88
|
switch (type) {
|
|
89
89
|
case constants_1.OutputFormats.Yaml:
|
|
90
|
-
const yaml = js_yaml_1.dump(configGenerated, { skipInvalid: false });
|
|
91
|
-
fileUtil_1.writeExportedEntityToFile(yaml, 'yml', journey.id);
|
|
90
|
+
const yaml = (0, js_yaml_1.dump)(configGenerated, { skipInvalid: false });
|
|
91
|
+
(0, fileUtil_1.writeExportedEntityToFile)(yaml, 'yml', journey.id);
|
|
92
92
|
break;
|
|
93
93
|
case constants_1.OutputFormats.Json:
|
|
94
|
-
fileUtil_1.writeExportedEntityToFile(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', journey.id);
|
|
94
|
+
(0, fileUtil_1.writeExportedEntityToFile)(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', journey.id);
|
|
95
95
|
break;
|
|
96
96
|
default:
|
|
97
97
|
throw new Error(`Invalid Type supplied for exporting: ${type}`);
|
|
@@ -100,5 +100,5 @@ function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
|
|
|
100
100
|
function dumpToCsv(journey, flows) {
|
|
101
101
|
const journeyConfig = new testConfigGenerator_1.JourneyConfig(journey, flows, false);
|
|
102
102
|
const output = journeyConfig.generateSimpleCsv();
|
|
103
|
-
fileUtil_1.writeExportedEntityToFile(output.join(os.EOL), 'csv', journey.id);
|
|
103
|
+
(0, fileUtil_1.writeExportedEntityToFile)(output.join(os.EOL), 'csv', journey.id);
|
|
104
104
|
}
|
|
@@ -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)));
|