@mablhq/mabl-cli 1.25.19 → 1.26.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/entities/Browser.js +1 -0
- package/api/featureSet.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +3 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +13 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +16 -16
- package/browserLauncher/types.js +5 -1
- package/commands/browserTypes.js +19 -8
- package/commands/constants.js +6 -5
- package/commands/tests/testsUtil.js +67 -85
- package/commands/tests/tests_cmds/run-cloud.js +2 -2
- package/commands/tests/tests_cmds/run.js +2 -0
- package/domUtil/index.js +1 -2
- package/execution/index.js +1 -1
- package/index.d.ts +2 -0
- package/mablscript/MablAction.js +31 -1
- package/mablscript/actions/ConditionAction.js +4 -0
- package/mablscript/actions/FindAction.js +3 -0
- package/mablscript/actions/GenerateRandomStringAction.js +3 -0
- package/mablscript/actions/GetVariableValue.js +3 -0
- package/mablscript/actions/JavaScriptAction.js +7 -0
- package/mablscript/importer.js +10 -3
- package/mablscript/steps/AssertStep.js +10 -0
- package/mablscript/steps/ClickAndHoldStep.js +3 -0
- package/mablscript/steps/ClickStep.js +3 -0
- package/mablscript/steps/CreateVariableStep.js +6 -0
- package/mablscript/steps/DoubleClickStep.js +3 -0
- package/mablscript/steps/DownloadStep.js +4 -0
- package/mablscript/steps/EchoStep.js +3 -0
- package/mablscript/steps/EnterTextStep.js +6 -0
- package/mablscript/steps/EvaluateJavaScriptStep.js +3 -0
- package/mablscript/steps/HoverStep.js +3 -0
- package/mablscript/steps/IfConditionStep.js +9 -0
- package/mablscript/steps/OpenEmailStep.js +3 -0
- package/mablscript/steps/ReleaseStep.js +3 -0
- package/mablscript/steps/RemoveCookieStep.js +4 -0
- package/mablscript/steps/SelectStep.js +7 -0
- package/mablscript/steps/SendHttpRequestStep.js +8 -0
- package/mablscript/steps/SendKeyStep.js +3 -0
- package/mablscript/steps/SetCookieStep.js +7 -0
- package/mablscript/steps/SetFilesStep.js +3 -0
- package/mablscript/steps/SwitchContextStep.js +4 -0
- package/mablscript/steps/VisitUrlStep.js +4 -0
- package/mablscript/steps/WaitUntilStep.js +3 -0
- package/mablscriptFind/index.js +1 -1
- package/package.json +2 -2
- package/resources/mablFind.js +1 -1
- package/browserLauncher/runnerType.js +0 -7
- package/domUtil/index.js.LICENSE.txt +0 -14
- package/mablscript/AttributesConstants.js +0 -115
package/api/entities/Browser.js
CHANGED
package/api/featureSet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeatureSet = exports.FindImplementationVersion = void 0;
|
|
4
|
-
const
|
|
4
|
+
const types_1 = require("../browserLauncher/types");
|
|
5
5
|
const ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
|
|
6
6
|
const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
|
|
7
7
|
var FindImplementationVersion;
|
|
@@ -14,7 +14,7 @@ class FeatureSet {
|
|
|
14
14
|
this.featureFlags = featureFlags;
|
|
15
15
|
}
|
|
16
16
|
getRunnerType() {
|
|
17
|
-
return
|
|
17
|
+
return types_1.RunnerType.Playwright;
|
|
18
18
|
}
|
|
19
19
|
getFindImplementationVersion() {
|
|
20
20
|
return this.featureFlags.has(SMARTER_WAIT_FEATURE_FLAG)
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BrowserLauncherFactory = void 0;
|
|
7
7
|
const playwrightBrowserLauncher_1 = require("./playwrightBrowserLauncher/playwrightBrowserLauncher");
|
|
8
|
-
const
|
|
8
|
+
const types_1 = require("./types");
|
|
9
9
|
const logUtils_1 = require("../util/logUtils");
|
|
10
10
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -14,12 +14,12 @@ class BrowserLauncherFactory {
|
|
|
14
14
|
var _a;
|
|
15
15
|
return (_a = process.env.MABL_RUNNER) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
16
16
|
}
|
|
17
|
-
static createRunner(runnerType =
|
|
17
|
+
static createRunner(runnerType = types_1.RunnerType.Playwright, loggerFunc) {
|
|
18
18
|
const runnerFromEnv = BrowserLauncherFactory.getRunnerFromEnvironment();
|
|
19
19
|
const runner = runnerFromEnv ? runnerFromEnv : runnerType;
|
|
20
20
|
loggerFunc =
|
|
21
21
|
loggerFunc !== null && loggerFunc !== void 0 ? loggerFunc : ((line) => (0, logUtils_1.logCliOutput)(loggingProvider_1.LogLevel.Info, line));
|
|
22
|
-
if (runner ===
|
|
22
|
+
if (runner === types_1.RunnerType.Playwright) {
|
|
23
23
|
loggerFunc(chalk_1.default.cyan(`Browser launcher:`, chalk_1.default.magenta('Playwright')));
|
|
24
24
|
return new playwrightBrowserLauncher_1.PlaywrightBrowserLauncher();
|
|
25
25
|
}
|
|
@@ -31,9 +31,9 @@ const events_1 = __importDefault(require("events"));
|
|
|
31
31
|
const playwright = __importStar(require("@playwright/test"));
|
|
32
32
|
const browserLauncher_1 = require("../browserLauncher");
|
|
33
33
|
const playwrightPage_1 = require("./playwrightPage");
|
|
34
|
+
const types_1 = require("../types");
|
|
34
35
|
const path_1 = __importDefault(require("path"));
|
|
35
36
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
36
|
-
const runnerType_1 = require("../runnerType");
|
|
37
37
|
class PlaywrightBrowser extends events_1.default {
|
|
38
38
|
constructor(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation) {
|
|
39
39
|
super();
|
|
@@ -61,7 +61,7 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
61
61
|
return browser;
|
|
62
62
|
}
|
|
63
63
|
getRunnerType() {
|
|
64
|
-
return
|
|
64
|
+
return types_1.RunnerType.Playwright;
|
|
65
65
|
}
|
|
66
66
|
makeCdpCall(method, paramArgs) {
|
|
67
67
|
return this.cdpSession.send(method, paramArgs);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlaywrightBrowserLauncher = void 0;
|
|
4
4
|
const test_1 = require("@playwright/test");
|
|
5
|
+
const browserTypes_1 = require("../../commands/browserTypes");
|
|
6
|
+
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
5
7
|
const playwrightBrowser_1 = require("./playwrightBrowser");
|
|
6
8
|
const BROWSER_LAUNCH_TIMEOUT_MS = 60000;
|
|
7
9
|
class PlaywrightBrowserLauncher {
|
|
@@ -18,13 +20,23 @@ class PlaywrightBrowserLauncher {
|
|
|
18
20
|
}
|
|
19
21
|
:
|
|
20
22
|
null;
|
|
23
|
+
if (!options.userDataDir) {
|
|
24
|
+
loggingProvider_1.logger.error('User data directory is required to launch a persistent chromium context and was not provided with LaunchOptions [{}]', options);
|
|
25
|
+
throw new Error('User data directory is required to launch a persistent chromium context');
|
|
26
|
+
}
|
|
27
|
+
if (!options.downloadPath) {
|
|
28
|
+
loggingProvider_1.logger.error('Download path is required to launch a persistent chromium context and was not provided with LaunchOptions [{}]', options);
|
|
29
|
+
throw new Error('Download path is required to launch a persistent chromium context and was not provided with LaunchOptions');
|
|
30
|
+
}
|
|
21
31
|
const defaultContext = await test_1.chromium.launchPersistentContext(options.userDataDir, {
|
|
22
32
|
acceptDownloads: true,
|
|
23
33
|
args: options.args,
|
|
24
34
|
bypassCSP: options.bypassContentSecurityPolicy,
|
|
35
|
+
channel: browserTypes_1.SupportedBrowserTypeProperties[options.browserType]
|
|
36
|
+
.browserReleaseChannel,
|
|
25
37
|
deviceScaleFactor: (_a = options.defaultDeviceDescriptor) === null || _a === void 0 ? void 0 : _a.deviceScaleFactor,
|
|
26
38
|
downloadsPath: options.downloadPath,
|
|
27
|
-
executablePath: options.
|
|
39
|
+
executablePath: options.browserPath,
|
|
28
40
|
extraHTTPHeaders: options.extraHttpHeaders,
|
|
29
41
|
hasTouch: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.hasTouch,
|
|
30
42
|
headless: options.headless,
|
|
@@ -305,27 +305,27 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
305
305
|
return (0, pureUtil_1.isNullish)(result) ? undefined : result;
|
|
306
306
|
}
|
|
307
307
|
async getElementText() {
|
|
308
|
+
const innerText = await this.getInnerText();
|
|
309
|
+
return innerText ? innerText : this.getSlotText();
|
|
310
|
+
}
|
|
311
|
+
async getInnerText() {
|
|
312
|
+
const result = await this.element.evaluate((el) => el.innerText);
|
|
313
|
+
return (0, pureUtil_1.isNullish)(result) ? undefined : result;
|
|
314
|
+
}
|
|
315
|
+
async getSlotText() {
|
|
308
316
|
const result = await this.element.evaluate((el) => {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (slots.length !== 1) {
|
|
313
|
-
return '';
|
|
314
|
-
}
|
|
315
|
-
const textNode = slots
|
|
316
|
-
.item(0)
|
|
317
|
-
.assignedNodes()
|
|
318
|
-
.find((node) => node.nodeType === Node.TEXT_NODE);
|
|
319
|
-
return textNode ? textNode.data : '';
|
|
317
|
+
const slots = el.querySelectorAll('slot');
|
|
318
|
+
if (slots.length !== 1) {
|
|
319
|
+
return '';
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
const textNode = slots
|
|
322
|
+
.item(0)
|
|
323
|
+
.assignedNodes()
|
|
324
|
+
.find((node) => node.nodeType === Node.TEXT_NODE);
|
|
325
|
+
return textNode === null || textNode === void 0 ? void 0 : textNode.data;
|
|
322
326
|
});
|
|
323
327
|
return (0, pureUtil_1.isNullish)(result) ? undefined : result;
|
|
324
328
|
}
|
|
325
|
-
async getInnerText() {
|
|
326
|
-
const result = await this.element.innerText();
|
|
327
|
-
return (0, pureUtil_1.isNullish)(result) ? undefined : result;
|
|
328
|
-
}
|
|
329
329
|
getActionTimeout(options) {
|
|
330
330
|
var _a;
|
|
331
331
|
const defaultTimeout = (options === null || options === void 0 ? void 0 : options.trial)
|
package/browserLauncher/types.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WaitForOptions = exports.LifecycleEvent = exports.DefaultTimeouts = void 0;
|
|
3
|
+
exports.WaitForOptions = exports.LifecycleEvent = exports.RunnerType = exports.DefaultTimeouts = void 0;
|
|
4
4
|
class DefaultTimeouts {
|
|
5
5
|
}
|
|
6
6
|
exports.DefaultTimeouts = DefaultTimeouts;
|
|
7
7
|
DefaultTimeouts.defaultTrialTimeoutMs = 5000;
|
|
8
8
|
DefaultTimeouts.defaultWaitTimeoutMs = 5000;
|
|
9
9
|
DefaultTimeouts.defaultActionTimeoutMs = 0;
|
|
10
|
+
var RunnerType;
|
|
11
|
+
(function (RunnerType) {
|
|
12
|
+
RunnerType["Playwright"] = "playwright";
|
|
13
|
+
})(RunnerType = exports.RunnerType || (exports.RunnerType = {}));
|
|
10
14
|
var LifecycleEvent;
|
|
11
15
|
(function (LifecycleEvent) {
|
|
12
16
|
LifecycleEvent["DomContentLoaded"] = "domcontentloaded";
|
package/commands/browserTypes.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
exports.DefaultBrowserProperties = exports.SupportedBrowserTypeProperties = exports.BrowserType = void 0;
|
|
4
|
+
var BrowserType;
|
|
5
|
+
(function (BrowserType) {
|
|
6
|
+
BrowserType["Chrome"] = "chrome";
|
|
7
|
+
BrowserType["Edge"] = "edge";
|
|
8
|
+
BrowserType["Firefox"] = "firefox";
|
|
9
|
+
BrowserType["InternetExplorer"] = "internet_explorer";
|
|
10
|
+
BrowserType["Safari"] = "safari";
|
|
11
|
+
})(BrowserType = exports.BrowserType || (exports.BrowserType = {}));
|
|
12
|
+
exports.SupportedBrowserTypeProperties = {
|
|
13
|
+
chrome: { browserName: 'chrome', browserReleaseChannel: 'chrome' },
|
|
14
|
+
edge: { browserName: 'edge', browserReleaseChannel: 'msedge' },
|
|
15
|
+
firefox: { browserName: 'firefox', browserReleaseChannel: 'firefox' },
|
|
16
|
+
safari: {
|
|
17
|
+
browserName: 'safari',
|
|
18
|
+
browserReleaseChannel: 'webkit',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
exports.DefaultBrowserProperties = exports.SupportedBrowserTypeProperties.chrome;
|
package/commands/constants.js
CHANGED
|
@@ -107,10 +107,11 @@ exports.DefaultOutputFormatChoices = [
|
|
|
107
107
|
OutputFormats.Yaml,
|
|
108
108
|
];
|
|
109
109
|
exports.DefaultBranchName = 'master';
|
|
110
|
-
exports.DefaultBrowserType = browserTypes_1.
|
|
110
|
+
exports.DefaultBrowserType = browserTypes_1.BrowserType.Chrome;
|
|
111
111
|
exports.BrowserTypeSelections = [
|
|
112
|
-
browserTypes_1.
|
|
113
|
-
browserTypes_1.
|
|
114
|
-
browserTypes_1.
|
|
115
|
-
browserTypes_1.
|
|
112
|
+
browserTypes_1.BrowserType.Chrome,
|
|
113
|
+
browserTypes_1.BrowserType.Edge,
|
|
114
|
+
browserTypes_1.BrowserType.Firefox,
|
|
115
|
+
browserTypes_1.BrowserType.InternetExplorer,
|
|
116
|
+
browserTypes_1.BrowserType.Safari,
|
|
116
117
|
].map((browser) => browser.toString());
|
|
@@ -27,25 +27,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.downloadUploadFile = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.addExecutionEngineLaunchArgs = exports.createBrowser = exports.prepareChromePreferencesDirectory = exports.findChrome = exports.searchForChrome = exports.getFinalUrl = exports.getTempChromePrefDirectory = void 0;
|
|
30
|
-
const
|
|
30
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
|
31
|
+
const axios_1 = __importDefault(require("axios"));
|
|
32
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
31
33
|
const fs = __importStar(require("fs-extra"));
|
|
34
|
+
const os = __importStar(require("os"));
|
|
32
35
|
const path = __importStar(require("path"));
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
36
|
-
const configKeys_1 = require("../config/config_cmds/configKeys");
|
|
36
|
+
const stream_1 = require("stream");
|
|
37
|
+
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
37
38
|
const trainingSessionActions_1 = require("../../core/messaging/actions/trainingSessionActions");
|
|
38
|
-
const
|
|
39
|
+
const logLineMessaging_1 = require("../../core/messaging/logLineMessaging");
|
|
40
|
+
const messaging_1 = require("../../core/messaging/messaging");
|
|
39
41
|
const env_1 = require("../../env/env");
|
|
40
|
-
const
|
|
41
|
-
const httpUtil_1 = require("../../util/httpUtil");
|
|
42
|
+
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
42
43
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
43
|
-
const
|
|
44
|
-
const logLineMessaging_1 = require("../../core/messaging/logLineMessaging");
|
|
44
|
+
const httpUtil_1 = require("../../util/httpUtil");
|
|
45
45
|
const resourceUtil_1 = require("../../util/resourceUtil");
|
|
46
|
+
const configKeys_1 = require("../config/config_cmds/configKeys");
|
|
47
|
+
const constants_1 = require("../constants");
|
|
46
48
|
const mobileEmulationUtil_1 = require("./mobileEmulationUtil");
|
|
47
|
-
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
48
|
-
const stream_1 = require("stream");
|
|
49
49
|
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
50
50
|
const chalk = require('chalk');
|
|
51
51
|
const chromeFinder = require('chrome-launcher/dist/chrome-finder');
|
|
@@ -106,42 +106,23 @@ async function findChrome() {
|
|
|
106
106
|
return chromePath;
|
|
107
107
|
}
|
|
108
108
|
exports.findChrome = findChrome;
|
|
109
|
-
async function launchBrowserInstance(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
let proxy;
|
|
116
|
-
if (proxyServer) {
|
|
117
|
-
proxy = {
|
|
118
|
-
server: proxyServer,
|
|
109
|
+
async function launchBrowserInstance(launchArgs, userDataDir, headless, credentials, options) {
|
|
110
|
+
const optionsProxy = await maybeGetProxyOptions(options);
|
|
111
|
+
if (optionsProxy) {
|
|
112
|
+
options = {
|
|
113
|
+
...options,
|
|
114
|
+
proxy: optionsProxy,
|
|
119
115
|
};
|
|
120
116
|
}
|
|
117
|
+
let browser;
|
|
121
118
|
try {
|
|
122
|
-
browser = await maybeLaunchBrowser(
|
|
123
|
-
bypassContentSecurityPolicy,
|
|
124
|
-
defaultDeviceDescriptor,
|
|
125
|
-
disableFocusEmulation,
|
|
126
|
-
extraHttpHeaders,
|
|
127
|
-
ignoreDefaultArgs,
|
|
128
|
-
runnerType,
|
|
129
|
-
loggerFunc,
|
|
130
|
-
proxy,
|
|
131
|
-
userAgent,
|
|
132
|
-
});
|
|
119
|
+
browser = await maybeLaunchBrowser(launchArgs, userDataDir, headless, credentials, options);
|
|
133
120
|
}
|
|
134
121
|
catch (error) {
|
|
135
122
|
if (error.message.includes('Running as root without --no-sandbox is not supported')) {
|
|
136
123
|
launchArgs.push('--no-sandbox');
|
|
137
124
|
messaging_1.mablEventEmitter.log('Unable to initialize browser with standard settings, attempting to run with --no-sandbox setting', Date.now(), logLineMessaging_1.LogLineColor.yellow);
|
|
138
|
-
return maybeLaunchBrowser(
|
|
139
|
-
bypassContentSecurityPolicy,
|
|
140
|
-
defaultDeviceDescriptor,
|
|
141
|
-
ignoreDefaultArgs,
|
|
142
|
-
proxy,
|
|
143
|
-
runnerType,
|
|
144
|
-
}).catch((error) => {
|
|
125
|
+
return maybeLaunchBrowser(launchArgs, userDataDir, headless, credentials, options).catch((error) => {
|
|
145
126
|
messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
|
|
146
127
|
messaging_1.mablEventEmitter.log(error.message);
|
|
147
128
|
});
|
|
@@ -151,22 +132,31 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
151
132
|
}
|
|
152
133
|
return browser;
|
|
153
134
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
135
|
+
async function maybeGetProxyOptions(options) {
|
|
136
|
+
var _a;
|
|
137
|
+
const proxyServer = (_a = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.test
|
|
138
|
+
.proxyHost) === null || _a === void 0 ? void 0 : _a.href;
|
|
139
|
+
let optionsProxy;
|
|
140
|
+
if (options === null || options === void 0 ? void 0 : options.proxy) {
|
|
141
|
+
optionsProxy = {
|
|
142
|
+
server: options.proxy.server,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else if (proxyServer) {
|
|
146
|
+
optionsProxy = {
|
|
147
|
+
server: proxyServer,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return optionsProxy;
|
|
151
|
+
}
|
|
152
|
+
function maybeLaunchBrowser(launchArgs, userDataDir, headless, credentials, options) {
|
|
153
|
+
return browserLauncher_1.BrowserLauncherFactory.createRunner(options === null || options === void 0 ? void 0 : options.runnerType, options === null || options === void 0 ? void 0 : options.loggerFunc).launch({
|
|
154
|
+
...options,
|
|
162
155
|
headless,
|
|
163
156
|
args: launchArgs,
|
|
164
|
-
ignoreDefaultArgs,
|
|
165
157
|
userDataDir,
|
|
166
158
|
downloadPath: createDownloadDirectory(),
|
|
167
159
|
credentials,
|
|
168
|
-
proxy,
|
|
169
|
-
userAgent,
|
|
170
160
|
});
|
|
171
161
|
}
|
|
172
162
|
async function prepareChromePreferencesDirectory(browserPreferences) {
|
|
@@ -191,12 +181,8 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
191
181
|
}
|
|
192
182
|
}
|
|
193
183
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
if (!chromePath.length) {
|
|
197
|
-
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'));
|
|
198
|
-
throw new Error('Chrome not found error');
|
|
199
|
-
}
|
|
184
|
+
var _a;
|
|
185
|
+
const { credentials, disableIsolation, ignoreCertificateErrors, emulationConfig, enableExtensions, resourcesDirectoryOverride, } = options || {};
|
|
200
186
|
const disableFeaturesFlags = [];
|
|
201
187
|
const launchArgs = [];
|
|
202
188
|
if (containerTesting) {
|
|
@@ -217,16 +203,11 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
217
203
|
if (enableExtensions) {
|
|
218
204
|
ignoreDefaultArgs = ['--disable-extensions'];
|
|
219
205
|
}
|
|
220
|
-
const maybeBrowser = await launchBrowserInstance(
|
|
221
|
-
|
|
206
|
+
const maybeBrowser = await launchBrowserInstance(launchArgs, tempBrowserPreferencesDirectory, headless, credentials, {
|
|
207
|
+
...options,
|
|
222
208
|
defaultDeviceDescriptor,
|
|
223
|
-
disableFocusEmulation,
|
|
224
|
-
extraHttpHeaders,
|
|
225
209
|
ignoreDefaultArgs,
|
|
226
|
-
|
|
227
|
-
loggerFunc,
|
|
228
|
-
proxy,
|
|
229
|
-
userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
210
|
+
userAgent: (_a = options === null || options === void 0 ? void 0 : options.userAgent) !== null && _a !== void 0 ? _a : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
230
211
|
});
|
|
231
212
|
if (!maybeBrowser) {
|
|
232
213
|
throw new Error('Unable to start Chrome session');
|
|
@@ -266,15 +247,18 @@ function addExecutionEngineLaunchArgs(browserWidth, browserHeight, proxyInfo, em
|
|
|
266
247
|
}
|
|
267
248
|
exports.addExecutionEngineLaunchArgs = addExecutionEngineLaunchArgs;
|
|
268
249
|
async function createBrowserForExecutionEngine(browserWidth, browserHeight, headless, tempBrowserPreferencesDirectory, proxyInfo, options) {
|
|
269
|
-
const { credentials,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
250
|
+
const { credentials, deviceEmulationConfig, userAgent } = options;
|
|
251
|
+
if (deviceEmulationConfig && !userAgent) {
|
|
252
|
+
options = {
|
|
253
|
+
...options,
|
|
254
|
+
userAgent: deviceEmulationConfig.device_config.user_agent,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const { launchArgs, defaultDeviceDescriptor } = addExecutionEngineLaunchArgs(browserWidth, browserHeight, proxyInfo, deviceEmulationConfig);
|
|
258
|
+
if (defaultDeviceDescriptor) {
|
|
259
|
+
options = { ...options, defaultDeviceDescriptor };
|
|
260
|
+
}
|
|
261
|
+
const maybeBrowser = await maybeLaunchBrowser(launchArgs, tempBrowserPreferencesDirectory, headless, credentials, options);
|
|
278
262
|
if (!maybeBrowser) {
|
|
279
263
|
throw new Error('Unable to start Chrome session');
|
|
280
264
|
}
|
|
@@ -594,7 +578,7 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
594
578
|
}
|
|
595
579
|
exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
|
|
596
580
|
async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
597
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
581
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
598
582
|
const journeyRun = await apiClient.getTestRun(testRunId);
|
|
599
583
|
const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
|
|
600
584
|
return {
|
|
@@ -609,16 +593,15 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
|
609
593
|
deviceEmulation: (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
|
|
610
594
|
environmentId: (_j = (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
|
|
611
595
|
filterHttpRequests: false,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
url: (_r = (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.deployment) === null || _r === void 0 ? void 0 : _r.uri,
|
|
596
|
+
importedVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.imported_variables,
|
|
597
|
+
pageLoadWait: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.page_load_wait,
|
|
598
|
+
testId: (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.invariant_id,
|
|
599
|
+
url: (_p = (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.deployment) === null || _p === void 0 ? void 0 : _p.uri,
|
|
617
600
|
};
|
|
618
601
|
}
|
|
619
602
|
exports.pullDownTestRunConfig = pullDownTestRunConfig;
|
|
620
603
|
async function extractTestRunConfig(executionMessage, apiClient) {
|
|
621
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
604
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
622
605
|
const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
|
|
623
606
|
const planRun = executionMessage.plan_run;
|
|
624
607
|
const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
|
|
@@ -635,11 +618,10 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
635
618
|
environmentId: (_k = (_j = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _j === void 0 ? void 0 : _j.deployment) === null || _k === void 0 ? void 0 : _k.environment_id,
|
|
636
619
|
filterHttpRequests: true,
|
|
637
620
|
importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
|
|
638
|
-
|
|
639
|
-
pageLoadWait: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.page_load_wait,
|
|
621
|
+
pageLoadWait: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.page_load_wait,
|
|
640
622
|
runnerType: maybeRunnerType,
|
|
641
|
-
testId: (
|
|
642
|
-
url: (
|
|
623
|
+
testId: (_o = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _o === void 0 ? void 0 : _o.invariant_id,
|
|
624
|
+
url: (_q = (_p = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.deployment) === null || _q === void 0 ? void 0 : _q.uri,
|
|
643
625
|
};
|
|
644
626
|
}
|
|
645
627
|
exports.extractTestRunConfig = extractTestRunConfig;
|
|
@@ -56,9 +56,9 @@ exports.builder = (yargs) => {
|
|
|
56
56
|
})
|
|
57
57
|
.option(constants_1.CommandArgBrowsers, {
|
|
58
58
|
alias: constants_1.CommandArgAliases.Browsers,
|
|
59
|
-
describe: 'Space delimited browsers to test against (e.g. "chrome firefox")',
|
|
59
|
+
describe: 'Space delimited browsers to test against (e.g. "chrome edge firefox")',
|
|
60
60
|
type: 'array',
|
|
61
|
-
default: constants_1.DefaultBrowserType
|
|
61
|
+
default: constants_1.DefaultBrowserType,
|
|
62
62
|
choices: constants_1.BrowserTypeSelections,
|
|
63
63
|
demand: 'Choose at least one browser to run on',
|
|
64
64
|
})
|
|
@@ -7,6 +7,7 @@ const constants_1 = require("../../constants");
|
|
|
7
7
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
8
8
|
const mablApi_1 = require("../../../mablApi");
|
|
9
9
|
const reporter_1 = require("../../../reporters/reporter");
|
|
10
|
+
const browserTypes_1 = require("../../browserTypes");
|
|
10
11
|
const chalk = require('chalk');
|
|
11
12
|
const execution = require('../../../execution/index');
|
|
12
13
|
exports.command = `run`;
|
|
@@ -188,6 +189,7 @@ async function run(parsed) {
|
|
|
188
189
|
_cliCreated: true,
|
|
189
190
|
basicAuthCredentialsId: parsed[constants_1.CommandArgBasicAuthCredentials],
|
|
190
191
|
branchName: parsed['mabl-branch'],
|
|
192
|
+
browserType: browserTypes_1.BrowserType.Chrome,
|
|
191
193
|
credentialsId: parsed['credentials-id'],
|
|
192
194
|
disableIsolation: parsed[constants_1.CommandArgBrowserDisableIsolation],
|
|
193
195
|
enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
|