@mablhq/mabl-cli 1.13.19 → 1.16.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 (34) hide show
  1. package/api/basicApiClient.js +20 -10
  2. package/api/featureSet.js +27 -0
  3. package/api/mablApiClient.js +22 -21
  4. package/api/mablApiClientFactory.js +0 -8
  5. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +3 -0
  6. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +2 -0
  7. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +12 -0
  8. package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +10 -0
  9. package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +12 -0
  10. package/commands/applications/applications_cmds/list.js +5 -2
  11. package/commands/branches/branches_cmds/list.js +5 -2
  12. package/commands/config/config_cmds/get.js +5 -2
  13. package/commands/config/config_cmds/list.js +5 -2
  14. package/commands/credentials/credentials_cmds/list.js +5 -2
  15. package/commands/deploy/deploy_cmds/executionResultPresenter.js +5 -2
  16. package/commands/deploy/deploy_cmds/list.js +5 -2
  17. package/commands/environments/environments_cmds/list.js +5 -2
  18. package/commands/flows/flows_cmds/list.js +5 -2
  19. package/commands/plans/plans_cmds/list.js +5 -2
  20. package/commands/tests/executionUtil.js +6 -1
  21. package/commands/tests/testsUtil.js +5 -20
  22. package/commands/tests/tests_cmds/list.js +5 -2
  23. package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +2 -2
  24. package/commands/workspaces/workspace_cmds/list.js +5 -2
  25. package/execution/index.js +1 -1
  26. package/execution/index.js.LICENSE.txt +0 -6
  27. package/mablApi/index.js +1 -1
  28. package/mablscript/MablStep.js +3 -0
  29. package/mablscript/steps/AccessibilityCheck.js +14 -2
  30. package/mablscriptFind/index.js +1 -1
  31. package/package.json +4 -4
  32. package/resources/mablFind.js +1 -1
  33. package/util/resourceUtil.js +18 -7
  34. package/api/entities/JourneyRunScheduledMessage.js +0 -2
@@ -31,11 +31,12 @@ const async_retry_1 = __importDefault(require("async-retry"));
31
31
  const logUtils_1 = require("../util/logUtils");
32
32
  const asyncUtil_1 = require("../util/asyncUtil");
33
33
  const MABL_ENTITY_VERSION_HEADER = 'x-mabl-entity-version';
34
- const DEFAULT_REQUEST_TIMEOUT_MILLISECONDS = 60000;
35
- const DEFAULT_RETRIES = 5;
36
- const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS = DEFAULT_REQUEST_TIMEOUT_MILLISECONDS * DEFAULT_RETRIES;
37
- const DEFAULT_MIN_RETRY_TIMEOUT_MILLISECONDS = 100;
38
- const DEFAULT_MAX_RETRY_TIMEOUT_MILLISECONDS = 1000;
34
+ const DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = 60000;
35
+ const DEFAULT_RETRIES = 10;
36
+ const DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS = DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS * DEFAULT_RETRIES;
37
+ const DEFAULT_NONRETRYABLE_REQUEST_TIMEOUT_MILLISECONDS = DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS;
38
+ const DEFAULT_MIN_RETRY_INTERVAL_MILLISECONDS = 1000;
39
+ const DEFAULT_MAX_RETRY_INTERVAL_MILLISECONDS = 10000;
39
40
  var AuthType;
40
41
  (function (AuthType) {
41
42
  AuthType[AuthType["Bearer"] = 0] = "Bearer";
@@ -48,7 +49,7 @@ class BasicApiClient {
48
49
  sslVerify: options.sslVerify,
49
50
  proxyHost: options.proxyUrl,
50
51
  });
51
- config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : DEFAULT_REQUEST_TIMEOUT_MILLISECONDS;
52
+ config.timeout = (_a = options.requestTimeoutMillis) !== null && _a !== void 0 ? _a : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
52
53
  switch (options.authType) {
53
54
  case AuthType.ApiKey:
54
55
  config.auth = {
@@ -73,10 +74,19 @@ class BasicApiClient {
73
74
  if (options.userAgentOverride) {
74
75
  config.headers[httpUtil_1.USER_AGENT_HEADER] = options.userAgentOverride;
75
76
  }
77
+ this.httpRequestConfig = config;
76
78
  this.httpClient = axios_1.default.create(config);
77
79
  this.retryConfig = options.retryConfig;
78
80
  this.debugLogger = (_b = options.debugLogger) !== null && _b !== void 0 ? _b : logUtils_1.logInternal;
79
81
  }
82
+ getNonRetryableRequestConfig(override) {
83
+ const overrideWithTimeout = { ...(override !== null && override !== void 0 ? override : {}) };
84
+ if (!overrideWithTimeout.timeout) {
85
+ overrideWithTimeout.timeout =
86
+ DEFAULT_NONRETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
87
+ }
88
+ return { ...this.httpRequestConfig, ...overrideWithTimeout };
89
+ }
80
90
  makeGetRequest(path) {
81
91
  return this.retryWrappedRequest(`makeGetRequest('${path}')`, () => this.getRequest(path));
82
92
  }
@@ -101,12 +111,12 @@ class BasicApiClient {
101
111
  return { ...result, entity_version: versionHeader };
102
112
  }
103
113
  async makePostRequest(path, requestBody, requestConfig) {
104
- const response = await this.debugRequest('POST', path, () => this.httpClient.post(path, requestBody, requestConfig));
114
+ const response = await this.debugRequest('POST', path, () => this.httpClient.post(path, requestBody, this.getNonRetryableRequestConfig(requestConfig)));
105
115
  BasicApiClient.checkResponseStatusCode(response);
106
116
  return response.data;
107
117
  }
108
118
  async makePutRequest(path, requestBody) {
109
- const response = await this.debugRequest('PUT', path, () => this.httpClient.put(path, requestBody));
119
+ const response = await this.debugRequest('PUT', path, () => this.httpClient.put(path, requestBody, this.getNonRetryableRequestConfig()));
110
120
  BasicApiClient.checkResponseStatusCode(response);
111
121
  return response.data;
112
122
  }
@@ -152,8 +162,8 @@ class BasicApiClient {
152
162
  var _a, _b, _c, _d, _e, _f, _g, _h;
153
163
  const retryOptions = {
154
164
  retries: (_b = (_a = this.retryConfig) === null || _a === void 0 ? void 0 : _a.retryCount) !== null && _b !== void 0 ? _b : DEFAULT_RETRIES,
155
- minTimeout: (_d = (_c = this.retryConfig) === null || _c === void 0 ? void 0 : _c.minTimeoutMillis) !== null && _d !== void 0 ? _d : DEFAULT_MIN_RETRY_TIMEOUT_MILLISECONDS,
156
- maxTimeout: (_f = (_e = this.retryConfig) === null || _e === void 0 ? void 0 : _e.maxTimeoutMillis) !== null && _f !== void 0 ? _f : DEFAULT_MAX_RETRY_TIMEOUT_MILLISECONDS,
165
+ minTimeout: (_d = (_c = this.retryConfig) === null || _c === void 0 ? void 0 : _c.minRetryIntervalMillis) !== null && _d !== void 0 ? _d : DEFAULT_MIN_RETRY_INTERVAL_MILLISECONDS,
166
+ maxTimeout: (_f = (_e = this.retryConfig) === null || _e === void 0 ? void 0 : _e.maxRetryIntervalMillis) !== null && _f !== void 0 ? _f : DEFAULT_MAX_RETRY_INTERVAL_MILLISECONDS,
157
167
  maxRetryTime: (_h = (_g = this.retryConfig) === null || _g === void 0 ? void 0 : _g.maxRetryTimeMillis) !== null && _h !== void 0 ? _h : DEFAULT_MAX_TOTAL_RETRY_TIME_MILLISECONDS,
158
168
  onRetry: (error) => {
159
169
  this.debugLogger(`Retrying failed API request "${description}"`, error);
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FeatureSet = exports.FindImplementationVersion = void 0;
4
+ const runnerType_1 = require("../browserLauncher/runnerType");
5
+ const PLAYWRIGHT_FEATURE_FLAG = 'nodejs_execution_engine_playwright';
6
+ const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
7
+ var FindImplementationVersion;
8
+ (function (FindImplementationVersion) {
9
+ FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
10
+ FindImplementationVersion[FindImplementationVersion["SmartFind"] = 1] = "SmartFind";
11
+ })(FindImplementationVersion = exports.FindImplementationVersion || (exports.FindImplementationVersion = {}));
12
+ class FeatureSet {
13
+ constructor(featureFlags) {
14
+ this.featureFlags = featureFlags;
15
+ }
16
+ getRunnerType() {
17
+ return this.featureFlags.has(PLAYWRIGHT_FEATURE_FLAG)
18
+ ? runnerType_1.RunnerType.Playwright
19
+ : runnerType_1.RunnerType.Puppeteer;
20
+ }
21
+ getFindImplementationVersion() {
22
+ return this.featureFlags.has(SMARTER_WAIT_FEATURE_FLAG)
23
+ ? FindImplementationVersion.SmartFind
24
+ : FindImplementationVersion.V1;
25
+ }
26
+ }
27
+ exports.FeatureSet = FeatureSet;
@@ -26,9 +26,7 @@ const mablApi_1 = require("../mablApi");
26
26
  const cliConfigProvider_1 = require("../providers/cliConfigProvider");
27
27
  const basicApiClient_1 = require("./basicApiClient");
28
28
  const queryString = __importStar(require("query-string"));
29
- const logUtils_1 = require("../util/logUtils");
30
- const runnerType_1 = require("../browserLauncher/runnerType");
31
- const PLAYWRIGHT_FEATURE_FLAG = 'nodejs_execution_engine_playwright';
29
+ const featureSet_1 = require("./featureSet");
32
30
  class MablApiClient extends basicApiClient_1.BasicApiClient {
33
31
  constructor(options) {
34
32
  super(options);
@@ -127,7 +125,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
127
125
  }
128
126
  async createDeployment(deployment) {
129
127
  try {
130
- return await this.makePostRequest(`${env_1.BASE_API_URL}/deployments`, deployment);
128
+ return await this.makePostRequest(`${env_1.BASE_API_URL}/deployments`, deployment, { timeout: 0 });
131
129
  }
132
130
  catch (error) {
133
131
  throw toApiError(`Failed to create deployment`, error);
@@ -237,12 +235,20 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
237
235
  }
238
236
  async getTestFindSummaries(testId, environmentId) {
239
237
  try {
240
- return await this.makeGetRequest(`${env_1.BASE_API_URL}/findSummary?journey_id=${testId}&environment_id=${environmentId}`);
238
+ return await this.makeGetRequest(`${env_1.BASE_API_URL}/findSummary?journey_id=${testId}&environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findsummaries) !== null && _a !== void 0 ? _a : []; });
241
239
  }
242
240
  catch (error) {
243
241
  throw toApiError(`Failed to get test find summaries results`, error);
244
242
  }
245
243
  }
244
+ async getTestFindModels(testId, environmentId) {
245
+ try {
246
+ return await this.makeGetRequest(`${env_1.BASE_API_URL}/findModel/test/${testId}?environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findModels) !== null && _a !== void 0 ? _a : []; });
247
+ }
248
+ catch (error) {
249
+ throw toApiError(`Failed to get test find model results`, error);
250
+ }
251
+ }
246
252
  async getTestOverrides(testId, environmentId, selectorOverrideLimit = 10) {
247
253
  try {
248
254
  return await this.makeGetRequest(`${env_1.BASE_API_URL}/tests/testScripts/${testId}/overrides?environment_id=${environmentId}&selector_override_limit=${selectorOverrideLimit}`).then((result) => { var _a; return (_a = result.overrides) !== null && _a !== void 0 ? _a : []; });
@@ -687,23 +693,18 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
687
693
  timeout: 3600000,
688
694
  });
689
695
  }
690
- async getRunnerTypeFromFeatureFlag(organizationId) {
691
- var _a, _b;
692
- if (organizationId === undefined) {
693
- organizationId = (_a = (await this.getSelf()).preferences) === null || _a === void 0 ? void 0 : _a.default_workspace_id;
694
- }
695
- if (organizationId !== undefined) {
696
- try {
697
- const workspace = await this.getWorkspace(organizationId);
698
- const account = await this.getAccount(workspace.account_id);
699
- return ((_b = account.effective_features) === null || _b === void 0 ? void 0 : _b.includes(PLAYWRIGHT_FEATURE_FLAG)) ? runnerType_1.RunnerType.Playwright
700
- : runnerType_1.RunnerType.Puppeteer;
701
- }
702
- catch (ex) {
703
- logUtils_1.logInternal(`Unable to get the playwright feature flag (${ex})`);
704
- }
696
+ async getEffectiveFeaturesByWorkspaceId(workspaceId) {
697
+ try {
698
+ const workspace = await this.getWorkspace(workspaceId);
699
+ const account = await this.getAccount(workspace.account_id);
700
+ const features = account.effective_features
701
+ ? new Set(account.effective_features)
702
+ : new Set();
703
+ return new featureSet_1.FeatureSet(features);
704
+ }
705
+ catch (error) {
706
+ throw toApiError(`Failed to get feature flags for workspace ${workspaceId}`, error);
705
707
  }
706
- return runnerType_1.RunnerType.Puppeteer;
707
708
  }
708
709
  }
709
710
  exports.MablApiClient = MablApiClient;
@@ -9,11 +9,6 @@ const authenticationProvider_1 = require("../providers/authenticationProvider");
9
9
  const cliConfigProvider_1 = require("../providers/cliConfigProvider");
10
10
  const basicApiClient_1 = require("./basicApiClient");
11
11
  const chalk_1 = __importDefault(require("chalk"));
12
- const RETRY_CONFIG = {
13
- retryCount: 3,
14
- minTimeoutMillis: 1000,
15
- maxTimeoutMillis: 2000,
16
- };
17
12
  class MablApiClientFactory {
18
13
  static createApiClientFromOptionalApiKey(apiKey) {
19
14
  if (apiKey) {
@@ -44,7 +39,6 @@ class MablApiClientFactory {
44
39
  token: opts.authToken,
45
40
  proxyUrl: httpConfig.proxyHost,
46
41
  sslVerify: httpConfig.sslVerify,
47
- retryConfig: RETRY_CONFIG,
48
42
  userAgentOverride: opts.userAgentOverride,
49
43
  });
50
44
  }
@@ -56,7 +50,6 @@ class MablApiClientFactory {
56
50
  token: authConfig.accessToken,
57
51
  proxyUrl: httpConfig.proxyHost,
58
52
  sslVerify: httpConfig.sslVerify,
59
- retryConfig: RETRY_CONFIG,
60
53
  });
61
54
  }
62
55
  throw new Error('Please supply an API key or authenticate the mabl CLI tool');
@@ -74,7 +67,6 @@ class MablApiClientFactory {
74
67
  token: accessToken,
75
68
  proxyUrl: httpConfig.proxyHost,
76
69
  sslVerify: httpConfig.sslVerify,
77
- retryConfig: RETRY_CONFIG,
78
70
  });
79
71
  }
80
72
  static throwUserAuthTypeError() {
@@ -62,6 +62,9 @@ class PlaywrightBrowser extends events_1.default {
62
62
  disconnect() {
63
63
  return this.close();
64
64
  }
65
+ reconnect() {
66
+ return Promise.resolve(this);
67
+ }
65
68
  async newPage() {
66
69
  return this.getOrCreatePage(await this.defaultContext.newPage());
67
70
  }
@@ -7,6 +7,7 @@ exports.PlaywrightBrowserLauncher = void 0;
7
7
  const test_1 = require("@playwright/test");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const playwrightBrowser_1 = require("./playwrightBrowser");
10
+ const BROWSER_LAUNCH_TIMEOUT_MS = 60000;
10
11
  class PlaywrightBrowserLauncher {
11
12
  async connect(options, currentDownloadPath) {
12
13
  const browser = await test_1.chromium.connect(options.browserWSEndpoint);
@@ -35,6 +36,7 @@ class PlaywrightBrowserLauncher {
35
36
  isMobile: (_a = options.defaultDeviceDescriptor) === null || _a === void 0 ? void 0 : _a.isMobile,
36
37
  deviceScaleFactor: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.deviceScaleFactor,
37
38
  hasTouch: (_c = options.defaultDeviceDescriptor) === null || _c === void 0 ? void 0 : _c.hasTouch,
39
+ timeout: BROWSER_LAUNCH_TIMEOUT_MS,
38
40
  });
39
41
  return new playwrightBrowser_1.PlaywrightBrowser(defaultContext, path_1.default.join(options.downloadPath, 'final'), '');
40
42
  }
@@ -26,6 +26,7 @@ const utils_1 = require("../utils");
26
26
  const logUtils_1 = require("../../util/logUtils");
27
27
  const elementHandle_1 = require("../elementHandle");
28
28
  const testsUtil_1 = require("../../commands/tests/testsUtil");
29
+ const pureUtil_1 = require("../../util/pureUtil");
29
30
  exports.NAVIGATION_ERROR_MESSAGE = 'waiting for scheduled navigations to finish';
30
31
  class PlaywrightJsHandle {
31
32
  constructor(handle, page) {
@@ -267,5 +268,16 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
267
268
  var _a;
268
269
  return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a : this.page.getCdpSession()).send(method, paramArgs);
269
270
  }
271
+ getTagName() {
272
+ return this.element.evaluate((el) => el.tagName.toLowerCase());
273
+ }
274
+ async getAttribute(attributeName) {
275
+ const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
276
+ return pureUtil_1.isNullish(result) ? undefined : result;
277
+ }
278
+ async getInnerText() {
279
+ const result = await this.element.evaluate((el) => el.innerText);
280
+ return pureUtil_1.isNullish(result) ? undefined : result;
281
+ }
270
282
  }
271
283
  exports.PlaywrightElementHandle = PlaywrightElementHandle;
@@ -53,6 +53,16 @@ class PuppeteerBrowser extends events_1.default {
53
53
  this.browser.disconnect();
54
54
  return Promise.resolve();
55
55
  }
56
+ reconnect() {
57
+ const webSocketEndpoint = this.wsEndpoint();
58
+ if (!webSocketEndpoint) {
59
+ throw new Error(`No browser websocket endpoint configured or supplied for connection`);
60
+ }
61
+ return browserLauncher_1.BrowserLauncherFactory.createRunner(this.getRunnerType()).connect({
62
+ defaultDeviceDescriptor: undefined,
63
+ browserWSEndpoint: webSocketEndpoint,
64
+ }, this.getDownloadDirectory());
65
+ }
56
66
  async newPage() {
57
67
  return this.getOrCreatePage(await this.browser.newPage());
58
68
  }
@@ -5,6 +5,7 @@ const puppeteerJsHandle_1 = require("./puppeteerJsHandle");
5
5
  const utils_1 = require("../utils");
6
6
  const testsUtil_1 = require("../../commands/tests/testsUtil");
7
7
  const elementHandle_1 = require("../elementHandle");
8
+ const pureUtil_1 = require("../../util/pureUtil");
8
9
  const msBetweenClicks = 100;
9
10
  class PuppeteerElementHandle extends puppeteerJsHandle_1.PuppeteerJsHandle {
10
11
  constructor(element, parentPage) {
@@ -123,5 +124,16 @@ class PuppeteerElementHandle extends puppeteerJsHandle_1.PuppeteerJsHandle {
123
124
  getValue() {
124
125
  return this.element.evaluate((el) => el.value);
125
126
  }
127
+ async getInnerText() {
128
+ const result = await this.element.evaluate((el) => el.innerText);
129
+ return pureUtil_1.isNullish(result) ? undefined : result;
130
+ }
131
+ getTagName() {
132
+ return this.element.evaluate((el) => el.tagName.toLowerCase());
133
+ }
134
+ async getAttribute(attributeName) {
135
+ const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
136
+ return pureUtil_1.isNullish(result) ? undefined : result;
137
+ }
126
138
  }
127
139
  exports.PuppeteerElementHandle = PuppeteerElementHandle;
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const js_yaml_1 = require("js-yaml");
4
7
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
5
8
  const util_1 = require("../../commandUtil/util");
6
- const Table = require("cli-table3");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
7
10
  const moment = require("moment");
8
11
  const list_1 = require("../../commandUtil/list");
9
12
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
@@ -30,7 +33,7 @@ function printApplications(applications, output) {
30
33
  loggingProvider_1.logger.info(js_yaml_1.dump(applications));
31
34
  break;
32
35
  default:
33
- const table = new Table({
36
+ const table = new cli_table3_1.default({
34
37
  head: ['ID', 'Name', 'Created time'],
35
38
  wordWrap: true,
36
39
  });
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const js_yaml_1 = require("js-yaml");
4
- const Table = require("cli-table3");
7
+ const cli_table3_1 = __importDefault(require("cli-table3"));
5
8
  const moment = require("moment");
6
9
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
7
10
  const util_1 = require("../../commandUtil/util");
@@ -55,7 +58,7 @@ function printBranches(branches, output) {
55
58
  loggingProvider_1.logger.info(js_yaml_1.dump(branches));
56
59
  break;
57
60
  default:
58
- const table = new Table({
61
+ const table = new cli_table3_1.default({
59
62
  head: ['ID', 'Name', 'Status', 'Created'],
60
63
  });
61
64
  branches.forEach((branch) => {
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
4
7
  const set_1 = require("./set");
5
- const Table = require("cli-table3");
8
+ const cli_table3_1 = __importDefault(require("cli-table3"));
6
9
  const list_1 = require("./list");
7
10
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
8
11
  exports.command = `get <${set_1.configKeyCommandArg}>`;
@@ -16,7 +19,7 @@ exports.builder = (yargs) => {
16
19
  exports.handler = getConfig;
17
20
  function getConfig(parsed) {
18
21
  const key = parsed['config-key'];
19
- const table = new Table({
22
+ const table = new cli_table3_1.default({
20
23
  head: ['Config', 'Value', 'Details'],
21
24
  });
22
25
  let value;
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.listConfig = exports.defaultTupleValue = void 0;
4
7
  const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
5
- const Table = require("cli-table3");
8
+ const cli_table3_1 = __importDefault(require("cli-table3"));
6
9
  const set_1 = require("./set");
7
10
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
8
11
  exports.command = `list`;
@@ -10,7 +13,7 @@ exports.describe = 'List all user config values';
10
13
  exports.handler = listConfig;
11
14
  exports.defaultTupleValue = '---';
12
15
  function listConfig() {
13
- const table = new Table({
16
+ const table = new cli_table3_1.default({
14
17
  head: ['Config', 'Value', 'Details'],
15
18
  colWidths: [null, 60],
16
19
  });
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const js_yaml_1 = require("js-yaml");
4
7
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
5
8
  const util_1 = require("../../commandUtil/util");
6
- const Table = require("cli-table3");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
7
10
  const moment = require("moment");
8
11
  const list_1 = require("../../commandUtil/list");
9
12
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
@@ -30,7 +33,7 @@ function printCredentials(credentials, output) {
30
33
  loggingProvider_1.logger.info(js_yaml_1.dump(credentials));
31
34
  break;
32
35
  default:
33
- const table = new Table({
36
+ const table = new cli_table3_1.default({
34
37
  head: ['ID', 'Name', 'Description', 'Created time'],
35
38
  wordWrap: true,
36
39
  });
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ExecutionResultPresenter = void 0;
4
7
  const change_case_1 = require("change-case");
5
8
  const mablApi_1 = require("../../../mablApi");
6
9
  const moment = require("moment");
7
- const Table = require("cli-table3");
10
+ const cli_table3_1 = __importDefault(require("cli-table3"));
8
11
  const chalk = require('chalk');
9
12
  const momentDurationFormatSetup = require('moment-duration-format');
10
13
  momentDurationFormatSetup(moment);
@@ -25,7 +28,7 @@ class ExecutionResultPresenter {
25
28
  if (columnWidth) {
26
29
  tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
27
30
  }
28
- const table = new Table(tableConfig);
31
+ const table = new cli_table3_1.default(tableConfig);
29
32
  const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
30
33
  finalExecutions.forEach((summary) => {
31
34
  var _a, _b, _c, _d, _e;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const js_yaml_1 = require("js-yaml");
4
- const Table = require("cli-table3");
7
+ const cli_table3_1 = __importDefault(require("cli-table3"));
5
8
  const moment = require("moment");
6
9
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
7
10
  const util_1 = require("../../commandUtil/util");
@@ -30,7 +33,7 @@ function printDeployments(deployments, output) {
30
33
  loggingProvider_1.logger.info(js_yaml_1.dump(deployments));
31
34
  break;
32
35
  default:
33
- const table = new Table({
36
+ const table = new cli_table3_1.default({
34
37
  head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
35
38
  });
36
39
  deployments.forEach((deployment) => {
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const js_yaml_1 = require("js-yaml");
4
7
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
5
8
  const util_1 = require("../../commandUtil/util");
6
- const Table = require("cli-table3");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
7
10
  const moment = require("moment");
8
11
  const list_1 = require("../../commandUtil/list");
9
12
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
@@ -30,7 +33,7 @@ function printEnvironments(environments, output) {
30
33
  loggingProvider_1.logger.info(js_yaml_1.dump(environments));
31
34
  break;
32
35
  default:
33
- const table = new Table({
36
+ const table = new cli_table3_1.default({
34
37
  head: ['ID', 'Name', 'Created time'],
35
38
  wordWrap: true,
36
39
  });
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Table = require("cli-table3");
6
+ const cli_table3_1 = __importDefault(require("cli-table3"));
4
7
  const moment = require("moment");
5
8
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
6
9
  const util_1 = require("../../commandUtil/util");
@@ -42,7 +45,7 @@ async function listFlows(parsed) {
42
45
  return flows.length;
43
46
  }
44
47
  function printFlows(flows) {
45
- const table = new Table({
48
+ const table = new cli_table3_1.default({
46
49
  head: ['ID', 'Description', 'Created time'],
47
50
  wordWrap: true,
48
51
  });
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const constants_1 = require("../../constants");
4
7
  const util_1 = require("../../commandUtil/util");
5
8
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
6
- const Table = require("cli-table3");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
7
10
  const moment = require("moment");
8
11
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
9
12
  exports.command = 'list';
@@ -41,7 +44,7 @@ async function listPlans(parsed) {
41
44
  return plans.length;
42
45
  }
43
46
  function printPlans(plans) {
44
- const table = new Table({
47
+ const table = new cli_table3_1.default({
45
48
  head: ['ID', 'Name', 'Created time'],
46
49
  wordWrap: true,
47
50
  });
@@ -15,7 +15,12 @@ async function runTheTestInNewWindow(test, flows, branchName, url, credentialsId
15
15
  const authConfig = await new authenticationProvider_1.AuthenticationProvider().getAuthConfigWithAutoRenew();
16
16
  const browserPreferences = testsUtil_1.generateChromiumPreferencesFile();
17
17
  const browserPreferencesDirectory = await testsUtil_1.prepareChromePreferencesDirectory(browserPreferences);
18
- const runnerType = await (await mablApiClientFactory_1.MablApiClientFactory.createApiClient()).getRunnerTypeFromFeatureFlag(test.organization_id);
18
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
19
+ if (!test.organization_id) {
20
+ throw new Error('The test workspace ID is required, but it is not set.');
21
+ }
22
+ const featureFlags = await apiClient.getEffectiveFeaturesByWorkspaceId(test.organization_id);
23
+ const runnerType = featureFlags.getRunnerType();
19
24
  const trainingBrowser = await testsUtil_1.createBrowserWithAuthedExtension(authConfig.accessToken, width || exports.DEFAULT_BROWSER_WIDTH, height || exports.DEFAULT_BROWSER_HEIGHT, browserPreferencesDirectory, {
20
25
  runnerType,
21
26
  });
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.downloadUploadFile = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.setUpAuthTokenForExtension = exports.connectToExistingBrowserWebsocket = exports.connectToExistingBrowser = exports.createBrowserForExecutionEngine = exports.addExecutionEngineLaunchArgs = exports.createBrowser = exports.prepareChromePreferencesDirectory = exports.createBrowserWithAuthedExtension = exports.findChrome = exports.searchForChrome = exports.getFinalUrl = exports.getTempChromePrefDirectory = void 0;
25
+ exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.downloadUploadFile = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.setUpAuthTokenForExtension = exports.createBrowserForExecutionEngine = exports.addExecutionEngineLaunchArgs = exports.createBrowser = exports.prepareChromePreferencesDirectory = exports.createBrowserWithAuthedExtension = exports.findChrome = exports.searchForChrome = exports.getFinalUrl = exports.getTempChromePrefDirectory = void 0;
26
26
  const os = __importStar(require("os"));
27
27
  const trainerUtil_1 = require("./tests_cmds/trainer_cmds/trainerUtil");
28
28
  const fs = __importStar(require("fs-extra"));
@@ -37,7 +37,7 @@ const env_1 = require("../../env/env");
37
37
  const axios_1 = __importDefault(require("axios"));
38
38
  const httpUtil_1 = require("../../util/httpUtil");
39
39
  const loggingProvider_1 = require("../../providers/logging/loggingProvider");
40
- const Table = require("cli-table3");
40
+ const cli_table3_1 = __importDefault(require("cli-table3"));
41
41
  const logLineMessaging_1 = require("../../core/messaging/logLineMessaging");
42
42
  const resourceUtil_1 = require("../../util/resourceUtil");
43
43
  const mobileEmulationUtil_1 = require("./mobileEmulationUtil");
@@ -158,6 +158,8 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
158
158
  messaging_1.mablEventEmitter.log(error.message);
159
159
  });
160
160
  }
161
+ messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
162
+ messaging_1.mablEventEmitter.log(error.message);
161
163
  }
162
164
  return browser;
163
165
  }
@@ -282,23 +284,6 @@ async function createBrowserForExecutionEngine(browserWidth, browserHeight, head
282
284
  return maybeBrowser;
283
285
  }
284
286
  exports.createBrowserForExecutionEngine = createBrowserForExecutionEngine;
285
- async function connectToExistingBrowser(port, browserHeight, browserWidth, currentDownloadPath, runnerType) {
286
- const defaultDeviceDescriptor = {
287
- width: browserWidth,
288
- height: browserHeight,
289
- };
290
- const response = await axios_1.default.get(`http://localhost:${port}/json/version`);
291
- const url = response.data.webSocketDebuggerUrl;
292
- return connectToExistingBrowserWebsocket(url, currentDownloadPath, defaultDeviceDescriptor, runnerType);
293
- }
294
- exports.connectToExistingBrowser = connectToExistingBrowser;
295
- function connectToExistingBrowserWebsocket(websocketEndpoint, currentDownloadPath, defaultDeviceDescriptor, runnerType) {
296
- return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType).connect({
297
- defaultDeviceDescriptor,
298
- browserWSEndpoint: websocketEndpoint,
299
- }, currentDownloadPath);
300
- }
301
- exports.connectToExistingBrowserWebsocket = connectToExistingBrowserWebsocket;
302
287
  async function setUpAuthTokenForExtension(browser, accessToken) {
303
288
  const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
304
289
  await backgroundPage.evaluate((token) => {
@@ -472,7 +457,7 @@ function handleExtensionMessage(message, trainingBrowser) {
472
457
  break;
473
458
  }
474
459
  trainingSessionActions_1.TrainingEventEmitter.sessionSaved(trainedTestInfoMessage.test.id, trainedTestInfoMessage.test.invariant_id, trainedTestInfoMessage.branch, trainedTestInfoMessage.planId);
475
- const table = new Table({
460
+ const table = new cli_table3_1.default({
476
461
  head: [chalk.yellow('Saved Test Info')],
477
462
  wordWrap: true,
478
463
  });
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Table = require("cli-table3");
6
+ const cli_table3_1 = __importDefault(require("cli-table3"));
4
7
  const moment = require("moment");
5
8
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
6
9
  const util_1 = require("../../commandUtil/util");
@@ -72,7 +75,7 @@ async function listTests(parsed) {
72
75
  return journeys.length;
73
76
  }
74
77
  function printTestsAsTable(tests) {
75
- const table = new Table({
78
+ const table = new cli_table3_1.default({
76
79
  head: ['ID', 'Name', 'Created time'],
77
80
  wordWrap: true,
78
81
  });