@mablhq/mabl-cli 1.25.15 → 1.26.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/Globals.js +20 -0
  2. package/api/basicApiClient.js +1 -0
  3. package/api/featureSet.js +2 -2
  4. package/api/mablApiClient.js +9 -2
  5. package/api/mablApiClientFactory.js +5 -4
  6. package/browserLauncher/browserLauncherFactory.js +3 -3
  7. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
  8. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +18 -0
  9. package/browserLauncher/types.js +5 -1
  10. package/commands/config/config_cmds/configKeys.js +7 -1
  11. package/commands/config/config_cmds/set.js +6 -0
  12. package/commands/tests/testsUtil.js +43 -58
  13. package/domUtil/index.js +1 -2
  14. package/execution/index.js +1 -1
  15. package/index.d.ts +2 -0
  16. package/mablApi/index.js +1 -1
  17. package/mablscript/MablAction.js +31 -1
  18. package/mablscript/actions/ConditionAction.js +4 -0
  19. package/mablscript/actions/FindAction.js +3 -0
  20. package/mablscript/actions/GenerateRandomStringAction.js +3 -0
  21. package/mablscript/actions/GetVariableValue.js +3 -0
  22. package/mablscript/actions/JavaScriptAction.js +7 -0
  23. package/mablscript/importer.js +10 -3
  24. package/mablscript/steps/AssertStep.js +10 -0
  25. package/mablscript/steps/ClickAndHoldStep.js +3 -0
  26. package/mablscript/steps/ClickStep.js +3 -0
  27. package/mablscript/steps/CreateVariableStep.js +6 -0
  28. package/mablscript/steps/DoubleClickStep.js +3 -0
  29. package/mablscript/steps/DownloadStep.js +4 -0
  30. package/mablscript/steps/EchoStep.js +3 -0
  31. package/mablscript/steps/EnterTextStep.js +6 -0
  32. package/mablscript/steps/EvaluateJavaScriptStep.js +3 -0
  33. package/mablscript/steps/HoverStep.js +3 -0
  34. package/mablscript/steps/IfConditionStep.js +9 -0
  35. package/mablscript/steps/OpenEmailStep.js +3 -0
  36. package/mablscript/steps/ReleaseStep.js +3 -0
  37. package/mablscript/steps/RemoveCookieStep.js +4 -0
  38. package/mablscript/steps/SelectStep.js +7 -0
  39. package/mablscript/steps/SendHttpRequestStep.js +8 -0
  40. package/mablscript/steps/SendKeyStep.js +3 -0
  41. package/mablscript/steps/SetCookieStep.js +7 -0
  42. package/mablscript/steps/SetFilesStep.js +3 -0
  43. package/mablscript/steps/SwitchContextStep.js +4 -0
  44. package/mablscript/steps/VisitUrlStep.js +4 -0
  45. package/mablscript/steps/WaitUntilStep.js +3 -0
  46. package/mablscriptFind/index.js +1 -1
  47. package/package.json +5 -4
  48. package/providers/cliConfigProvider.js +6 -0
  49. package/resources/mablFind.js +1 -1
  50. package/util/asyncUtil.js +7 -6
  51. package/util/httpUtil.js +32 -12
  52. package/browserLauncher/runnerType.js +0 -7
  53. package/domUtil/index.js.LICENSE.txt +0 -14
  54. package/mablscript/AttributesConstants.js +0 -115
package/Globals.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Globals = void 0;
4
+ class Globals {
5
+ static getFindOverallTimeoutMs() {
6
+ return Globals.findOverallTimeoutMs;
7
+ }
8
+ static setFindOverallTimeoutMs(timeout) {
9
+ Globals.findOverallTimeoutMs = timeout;
10
+ }
11
+ static getPlaywrightInteractionWarningMs() {
12
+ return Globals.playwrightInteractionWarningMs;
13
+ }
14
+ static setPlaywrightInteractionWarningMs(timeout) {
15
+ Globals.playwrightInteractionWarningMs = timeout;
16
+ }
17
+ }
18
+ exports.Globals = Globals;
19
+ Globals.findOverallTimeoutMs = 18.5 * 60 * 1000;
20
+ Globals.playwrightInteractionWarningMs = 30 * 1000;
@@ -58,6 +58,7 @@ class BasicApiClient {
58
58
  const config = (0, httpUtil_1.axiosProxyConfig)({
59
59
  sslVerify: (_a = options.sslVerify) !== null && _a !== void 0 ? _a : DEFAULT_SSL_VERIFY,
60
60
  proxyHost: options.proxyUrl,
61
+ proxyType: options.proxyType,
61
62
  });
62
63
  if (!config.headers) {
63
64
  config.headers = {};
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 runnerType_1 = require("../browserLauncher/runnerType");
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 runnerType_1.RunnerType.Playwright;
17
+ return types_1.RunnerType.Playwright;
18
18
  }
19
19
  getFindImplementationVersion() {
20
20
  return this.featureFlags.has(SMARTER_WAIT_FEATURE_FLAG)
@@ -329,6 +329,14 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
329
329
  throw toApiError(`Failed to get account`, error);
330
330
  }
331
331
  }
332
+ async getAccountByWorkspaceId(workspaceId) {
333
+ try {
334
+ return await this.makeGetRequest(`${this.baseApiUrl}/organizations/${workspaceId}/account`);
335
+ }
336
+ catch (error) {
337
+ throw toApiError(`Failed to get account from workspace id`, error);
338
+ }
339
+ }
332
340
  async getApiKeyDetails() {
333
341
  try {
334
342
  return await this.makeGetRequest(`${this.baseApiUrl}/apiKeys/self`);
@@ -727,8 +735,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
727
735
  }
728
736
  async getEffectiveFeaturesByWorkspaceId(workspaceId) {
729
737
  try {
730
- const workspace = await this.getWorkspace(workspaceId);
731
- const account = await this.getAccount(workspace.account_id);
738
+ const account = await this.getAccountByWorkspaceId(workspaceId);
732
739
  const features = account.effective_features
733
740
  ? new Set(account.effective_features)
734
741
  : new Set();
@@ -32,11 +32,11 @@ class MablApiClientFactory {
32
32
  });
33
33
  }
34
34
  static async createApiClient(opts) {
35
- const { proxyHost, sslVerify } = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http
36
- .mabl;
35
+ const { mabl } = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
37
36
  const optsFromCliHttpConfig = {
38
- proxyUrl: proxyHost,
39
- sslVerify,
37
+ proxyUrl: mabl.proxyHost,
38
+ sslVerify: mabl.sslVerify,
39
+ proxyType: mabl.proxyType,
40
40
  };
41
41
  if (opts) {
42
42
  return new mablApiClient_1.MablApiClient({
@@ -68,6 +68,7 @@ class MablApiClientFactory {
68
68
  token: accessToken,
69
69
  proxyUrl: httpConfig.proxyHost,
70
70
  sslVerify: httpConfig.sslVerify,
71
+ proxyType: httpConfig.proxyType,
71
72
  });
72
73
  }
73
74
  static throwUserAuthTypeError() {
@@ -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 runnerType_1 = require("./runnerType");
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 = runnerType_1.RunnerType.Playwright, loggerFunc) {
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 === runnerType_1.RunnerType.Playwright) {
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 runnerType_1.RunnerType.Playwright;
64
+ return types_1.RunnerType.Playwright;
65
65
  }
66
66
  makeCdpCall(method, paramArgs) {
67
67
  return this.cdpSession.send(method, paramArgs);
@@ -304,10 +304,28 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
304
304
  const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
305
305
  return (0, pureUtil_1.isNullish)(result) ? undefined : result;
306
306
  }
307
+ async getElementText() {
308
+ const innerText = await this.getInnerText();
309
+ return innerText ? innerText : this.getSlotText();
310
+ }
307
311
  async getInnerText() {
308
312
  const result = await this.element.evaluate((el) => el.innerText);
309
313
  return (0, pureUtil_1.isNullish)(result) ? undefined : result;
310
314
  }
315
+ async getSlotText() {
316
+ const result = await this.element.evaluate((el) => {
317
+ const slots = el.querySelectorAll('slot');
318
+ if (slots.length !== 1) {
319
+ return '';
320
+ }
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;
326
+ });
327
+ return (0, pureUtil_1.isNullish)(result) ? undefined : result;
328
+ }
311
329
  getActionTimeout(options) {
312
330
  var _a;
313
331
  const defaultTimeout = (options === null || options === void 0 ? void 0 : options.trial)
@@ -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";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidProxyMode = exports.proxyModes = exports.validConfigKeyChoices = exports.configKeys = void 0;
3
+ exports.isValidProxyType = exports.isValidProxyMode = exports.proxyTypes = exports.proxyModes = exports.validConfigKeyChoices = exports.configKeys = void 0;
4
4
  exports.configKeys = Object.freeze({
5
5
  browserPath: 'browser.path',
6
6
  enableSourceControlMetadataCollection: 'alpha.scm_metadata.enable',
@@ -8,6 +8,7 @@ exports.configKeys = Object.freeze({
8
8
  proxy: 'http.proxy',
9
9
  sslVerify: 'http.sslVerify',
10
10
  proxyMode: 'http.proxyMode',
11
+ proxyType: 'http.proxyType',
11
12
  });
12
13
  exports.validConfigKeyChoices = Object.values(exports.configKeys);
13
14
  exports.proxyModes = [
@@ -16,7 +17,12 @@ exports.proxyModes = [
16
17
  'all',
17
18
  'none',
18
19
  ];
20
+ exports.proxyTypes = ['legacy', 'current'];
19
21
  function isValidProxyMode(value) {
20
22
  return exports.proxyModes.indexOf(value) !== -1;
21
23
  }
22
24
  exports.isValidProxyMode = isValidProxyMode;
25
+ function isValidProxyType(value) {
26
+ return exports.proxyTypes.indexOf(value) !== -1;
27
+ }
28
+ exports.isValidProxyType = isValidProxyType;
@@ -55,6 +55,12 @@ async function setConfig(parsed) {
55
55
  }
56
56
  await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
57
57
  break;
58
+ case configKeys_1.configKeys.proxyType:
59
+ if (!(0, configKeys_1.isValidProxyType)(value)) {
60
+ throw new Error(`Invalid proxy type. The value must be one of ${JSON.stringify(configKeys_1.proxyTypes)}`);
61
+ }
62
+ await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
63
+ break;
58
64
  default:
59
65
  throw new Error(`<${exports.configKeyCommandArg}> value not one of supported types: ${JSON.stringify(configKeys_1.validConfigKeyChoices)}`);
60
66
  }
@@ -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 os = __importStar(require("os"));
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 constants_1 = require("../constants");
34
- const messaging_1 = require("../../core/messaging/messaging");
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 async_retry_1 = __importDefault(require("async-retry"));
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 axios_1 = __importDefault(require("axios"));
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 cli_table3_1 = __importDefault(require("cli-table3"));
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');
@@ -61,6 +61,7 @@ const baseExecutionEngineLaunchArgs = [
61
61
  '--v=0',
62
62
  '--enable-features=NetworkService,NetworkServiceInProcess',
63
63
  '--disable-features=site-per-process',
64
+ '--disable-component-update',
64
65
  ];
65
66
  const ExecutionEngineFakeAudioFilePath = '/opt/media/mabl_test_audio.wav';
66
67
  const ExecutionEngineFakeVideoFilePath = '/opt/media/mabl_test_pattern.y4m';
@@ -107,27 +108,24 @@ async function findChrome() {
107
108
  exports.findChrome = findChrome;
108
109
  async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
109
110
  var _a;
110
- const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
111
111
  let browser;
112
112
  const proxyServer = (_a = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.test
113
113
  .proxyHost) === null || _a === void 0 ? void 0 : _a.href;
114
- let proxy;
115
- if (proxyServer) {
116
- proxy = {
114
+ let optionsProxy;
115
+ if ((options === null || options === void 0 ? void 0 : options.proxy) !== undefined) {
116
+ optionsProxy = {
117
+ server: options.proxy.server,
118
+ };
119
+ }
120
+ else if (proxyServer !== undefined) {
121
+ optionsProxy = {
117
122
  server: proxyServer,
118
123
  };
119
124
  }
120
125
  try {
121
126
  browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
122
- bypassContentSecurityPolicy,
123
- defaultDeviceDescriptor,
124
- disableFocusEmulation,
125
- extraHttpHeaders,
126
- ignoreDefaultArgs,
127
- runnerType,
128
- loggerFunc,
129
- proxy,
130
- userAgent,
127
+ ...options,
128
+ proxy: optionsProxy,
131
129
  });
132
130
  }
133
131
  catch (error) {
@@ -135,11 +133,11 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
135
133
  launchArgs.push('--no-sandbox');
136
134
  messaging_1.mablEventEmitter.log('Unable to initialize browser with standard settings, attempting to run with --no-sandbox setting', Date.now(), logLineMessaging_1.LogLineColor.yellow);
137
135
  return maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
138
- bypassContentSecurityPolicy,
139
- defaultDeviceDescriptor,
140
- ignoreDefaultArgs,
141
- proxy,
142
- runnerType,
136
+ bypassContentSecurityPolicy: options === null || options === void 0 ? void 0 : options.bypassContentSecurityPolicy,
137
+ defaultDeviceDescriptor: options === null || options === void 0 ? void 0 : options.defaultDeviceDescriptor,
138
+ ignoreDefaultArgs: options === null || options === void 0 ? void 0 : options.ignoreDefaultArgs,
139
+ proxy: options === null || options === void 0 ? void 0 : options.proxy,
140
+ runnerType: options === null || options === void 0 ? void 0 : options.runnerType,
143
141
  }).catch((error) => {
144
142
  messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
145
143
  messaging_1.mablEventEmitter.log(error.message);
@@ -151,21 +149,14 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
151
149
  return browser;
152
150
  }
153
151
  function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
154
- const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, proxy, userAgent, } = options || {};
155
- return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
156
- bypassContentSecurityPolicy,
157
- defaultDeviceDescriptor,
158
- disableFocusEmulation,
152
+ return browserLauncher_1.BrowserLauncherFactory.createRunner(options === null || options === void 0 ? void 0 : options.runnerType, options === null || options === void 0 ? void 0 : options.loggerFunc).launch({
153
+ ...options,
159
154
  executablePath: chromePath,
160
- extraHttpHeaders,
161
155
  headless,
162
156
  args: launchArgs,
163
- ignoreDefaultArgs,
164
157
  userDataDir,
165
158
  downloadPath: createDownloadDirectory(),
166
159
  credentials,
167
- proxy,
168
- userAgent,
169
160
  });
170
161
  }
171
162
  async function prepareChromePreferencesDirectory(browserPreferences) {
@@ -190,7 +181,8 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
190
181
  }
191
182
  }
192
183
  async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
193
- const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, proxy, userAgent, } = options || {};
184
+ var _a;
185
+ const { credentials, browserPath, disableIsolation, ignoreCertificateErrors, emulationConfig, enableExtensions, resourcesDirectoryOverride, } = options || {};
194
186
  const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : (await findChrome());
195
187
  if (!chromePath.length) {
196
188
  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'));
@@ -217,15 +209,10 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
217
209
  ignoreDefaultArgs = ['--disable-extensions'];
218
210
  }
219
211
  const maybeBrowser = await launchBrowserInstance(chromePath, launchArgs, tempBrowserPreferencesDirectory, headless, credentials, {
220
- bypassContentSecurityPolicy,
212
+ ...options,
221
213
  defaultDeviceDescriptor,
222
- disableFocusEmulation,
223
- extraHttpHeaders,
224
214
  ignoreDefaultArgs,
225
- runnerType,
226
- loggerFunc,
227
- proxy,
228
- userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
215
+ 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,
229
216
  });
230
217
  if (!maybeBrowser) {
231
218
  throw new Error('Unable to start Chrome session');
@@ -593,7 +580,7 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
593
580
  }
594
581
  exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
595
582
  async function pullDownTestRunConfig(testRunId, apiClient) {
596
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
583
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
597
584
  const journeyRun = await apiClient.getTestRun(testRunId);
598
585
  const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
599
586
  return {
@@ -608,16 +595,15 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
608
595
  deviceEmulation: (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
609
596
  environmentId: (_j = (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
610
597
  filterHttpRequests: false,
611
- journeyUserDefinedVariables: (_l = (_k = journeyRun.journey) === null || _k === void 0 ? void 0 : _k.variables) === null || _l === void 0 ? void 0 : _l.inputs,
612
- importedVariables: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.imported_variables,
613
- pageLoadWait: (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.page_load_wait,
614
- testId: (_p = journeyRun.journey) === null || _p === void 0 ? void 0 : _p.invariant_id,
615
- url: (_r = (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.deployment) === null || _r === void 0 ? void 0 : _r.uri,
598
+ importedVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.imported_variables,
599
+ pageLoadWait: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.page_load_wait,
600
+ testId: (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.invariant_id,
601
+ url: (_p = (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.deployment) === null || _p === void 0 ? void 0 : _p.uri,
616
602
  };
617
603
  }
618
604
  exports.pullDownTestRunConfig = pullDownTestRunConfig;
619
605
  async function extractTestRunConfig(executionMessage, apiClient) {
620
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
606
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
621
607
  const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
622
608
  const planRun = executionMessage.plan_run;
623
609
  const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
@@ -634,11 +620,10 @@ async function extractTestRunConfig(executionMessage, apiClient) {
634
620
  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,
635
621
  filterHttpRequests: true,
636
622
  importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
637
- journeyUserDefinedVariables: (_o = (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.inputs,
638
- pageLoadWait: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.page_load_wait,
623
+ pageLoadWait: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.page_load_wait,
639
624
  runnerType: maybeRunnerType,
640
- testId: (_q = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _q === void 0 ? void 0 : _q.invariant_id,
641
- url: (_s = (_r = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _r === void 0 ? void 0 : _r.deployment) === null || _s === void 0 ? void 0 : _s.uri,
625
+ testId: (_o = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _o === void 0 ? void 0 : _o.invariant_id,
626
+ 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,
642
627
  };
643
628
  }
644
629
  exports.extractTestRunConfig = extractTestRunConfig;