@mablhq/mabl-cli 2.4.0 → 2.5.2

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 (25) hide show
  1. package/README.md +4 -4
  2. package/browserLauncher/errors.js +10 -1
  3. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumBrowserDelegate.js +1 -1
  4. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +1 -1
  5. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +1 -1
  6. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +2 -2
  7. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +1 -1
  8. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +1 -1
  9. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
  10. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +4 -4
  11. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +1 -1
  12. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +28 -12
  13. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +1 -1
  14. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +1 -1
  15. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitBrowserDelegate.js +1 -1
  16. package/commands/commandUtil/util.js +4 -4
  17. package/commands/environments/environments_cmds/create.js +15 -1
  18. package/core/entityValidation/environmentsValidation.js +7 -0
  19. package/domUtil/index.js +1 -1
  20. package/execution/index.js +3 -3
  21. package/mablscriptFind/index.js +1 -1
  22. package/package.json +4 -5
  23. package/resources/mablFind.js +1 -1
  24. package/util/logUtils.js +20 -1
  25. package/core/execution/LocalizationOptionsLists.js +0 -1253
package/README.md CHANGED
@@ -35,7 +35,7 @@ Complete help documentation available at
35
35
 
36
36
  ## Installation
37
37
 
38
- Note: **Node 16+ is required** to run the mabl CLI
38
+ Note: **Node 18+ is required** to run the mabl CLI
39
39
 
40
40
  Stable version:
41
41
 
@@ -350,10 +350,10 @@ mabl config delete http.sslVerify
350
350
 
351
351
  ## Installation Troubleshooting
352
352
 
353
- If you receive the following error message, you need to ensure you have Node 16+
353
+ If you receive the following error message, you need to ensure you have Node 18+
354
354
  installed.
355
355
 
356
356
  ```bash
357
- npm WARN notsup Unsupported engine for @mablhq/mabl-cli@1.54.0: wanted: {"node":">= 16.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
358
- npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@1.54.0
357
+ npm WARN notsup Unsupported engine for @mablhq/mabl-cli@1.54.0: wanted: {"node":">= 18.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
358
+ npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@2.5.0
359
359
  ```
@@ -1,17 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RUNNER_ERRORS = exports.TimeoutError = exports.RunnerError = void 0;
3
+ exports.RUNNER_ERRORS = exports.NavigationInterruptedError = exports.TimeoutError = exports.RunnerError = void 0;
4
4
  class RunnerError extends Error {
5
5
  constructor(message) {
6
6
  super(message);
7
7
  this.name = this.constructor.name;
8
8
  Error.captureStackTrace(this, this.constructor);
9
9
  }
10
+ static isPlaywrightNavigationInterruptedError(error) {
11
+ const errorString = error.message.toLowerCase();
12
+ return (errorString.includes('interrupted by another navigation') &&
13
+ errorString.includes('frame.goto'));
14
+ }
10
15
  }
11
16
  exports.RunnerError = RunnerError;
12
17
  class TimeoutError extends RunnerError {
13
18
  }
14
19
  exports.TimeoutError = TimeoutError;
20
+ class NavigationInterruptedError extends RunnerError {
21
+ }
22
+ exports.NavigationInterruptedError = NavigationInterruptedError;
15
23
  exports.RUNNER_ERRORS = {
16
24
  TimeoutError,
25
+ NavigationInterruptedError,
17
26
  };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ChromiumBrowserDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const chromiumPageDelegate_1 = require("./chromiumPageDelegate");
29
29
  class ChromiumBrowserDelegate {
30
30
  constructor(context) {
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ChromiumElementHandleDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const testsUtil_1 = require("../../../commands/tests/testsUtil");
29
29
  const logUtils_1 = require("../../../util/logUtils");
30
30
  const elementHandle_1 = require("../../elementHandle");
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ChromiumPageDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const chromiumElementHandleDelegate_1 = require("./chromiumElementHandleDelegate");
29
29
  const logUtils_1 = require("../../../util/logUtils");
30
30
  const chromiumFrameDelegate_1 = require("./chromiumFrameDelegate");
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.FirefoxBrowserDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const firefoxPageDelegate_1 = require("./firefoxPageDelegate");
29
29
  const nonChromiumAbstractBrowserDelegate_1 = require("../nonChromium/nonChromiumAbstractBrowserDelegate");
30
30
  class FirefoxBrowserDelegate extends nonChromiumAbstractBrowserDelegate_1.NonChromiumAbstractBrowserDelegate {
@@ -41,7 +41,7 @@ class FirefoxBrowserDelegate extends nonChromiumAbstractBrowserDelegate_1.NonChr
41
41
  return new firefoxPageDelegate_1.FirefoxPageDelegate(page);
42
42
  }
43
43
  getCDPSession() {
44
- return this._browser._connection;
44
+ return this._browser._connection.rootSession;
45
45
  }
46
46
  supportsExposeFunction() {
47
47
  return true;
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.NonChromiumAbstractElementHandleDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const logUtils_1 = require("../../../util/logUtils");
29
29
  class NonChromiumAbstractElementHandleDelegate {
30
30
  constructor(elementHandle) {
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.NonChromiumAbstractPageDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const logUtils_1 = require("../../../util/logUtils");
29
29
  class NonChromiumAbstractPageDelegate {
30
30
  constructor(page) {
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.PlaywrightBrowser = void 0;
30
30
  const events_1 = __importDefault(require("events"));
31
- const playwright = __importStar(require("@playwright/test"));
31
+ const playwright = __importStar(require("playwright"));
32
32
  const browserLauncher_1 = require("../browserLauncher");
33
33
  const playwrightPage_1 = require("./playwrightPage");
34
34
  const types_1 = require("../types");
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PlaywrightBrowserLauncher = void 0;
7
- const test_1 = require("@playwright/test");
7
+ const playwright_1 = require("playwright");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const browserTypes_1 = require("../../commands/browserTypes");
10
10
  const loggingProvider_1 = require("../../providers/logging/loggingProvider");
@@ -71,11 +71,11 @@ function getPlaywrightBrowserType(browserType) {
71
71
  switch (browserType) {
72
72
  case browserTypes_1.BrowserType.Chrome:
73
73
  case browserTypes_1.BrowserType.Edge:
74
- return test_1.chromium;
74
+ return playwright_1.chromium;
75
75
  case browserTypes_1.BrowserType.Firefox:
76
- return test_1.firefox;
76
+ return playwright_1.firefox;
77
77
  case browserTypes_1.BrowserType.Webkit:
78
- return test_1.webkit;
78
+ return playwright_1.webkit;
79
79
  default:
80
80
  throw new Error(`Unsupported browser type: ${browserType}`);
81
81
  }
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.PlaywrightElementHandle = exports.PlaywrightJsHandle = exports.NAVIGATION_ERROR_MESSAGE = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const types_1 = require("../types");
29
29
  const utils_1 = require("../utils");
30
30
  const logUtils_1 = require("../../util/logUtils");
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.PlaywrightFrame = exports.UTILITY_CONTEXT_NAME = void 0;
27
27
  const browserLauncher_1 = require("../browserLauncher");
28
- const playwright = __importStar(require("@playwright/test"));
28
+ const playwright = __importStar(require("playwright"));
29
29
  const types_1 = require("../types");
30
30
  const utils_1 = require("../utils");
31
31
  const playwrightHttpResponse_1 = require("./playwrightHttpResponse");
@@ -142,19 +142,9 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
142
142
  return new playwrightDom_1.PlaywrightElementHandle(frameElement, this.parentPage, this.parentPage.delegate.createElementHandleDelegate(frameElement));
143
143
  }
144
144
  async goto(url, options) {
145
- var _a;
146
145
  const lifecycleEvent = this.delegate.getLifecycleEventStrategy(options === null || options === void 0 ? void 0 : options.waitUntil);
147
146
  try {
148
- const response = await this.frame.goto(url, {
149
- waitUntil: lifecycleEvent.waitUntil,
150
- timeout: options === null || options === void 0 ? void 0 : options.timeout,
151
- });
152
- if (lifecycleEvent.waitForNetworkIdle) {
153
- await this.frame.waitForLoadState(types_1.LifecycleEvent.NetworkIdle, {
154
- timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs,
155
- });
156
- }
157
- return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
147
+ return await this.tryGoto(url, lifecycleEvent, options);
158
148
  }
159
149
  catch (e) {
160
150
  if (e instanceof playwright.errors.TimeoutError) {
@@ -163,6 +153,32 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
163
153
  throw new browserLauncher_1.RunnerError(e.message);
164
154
  }
165
155
  }
156
+ async tryGoto(url, lifecycleEvent, options) {
157
+ var _a;
158
+ const timeout = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs;
159
+ let response;
160
+ let responseHasNavigationError = false;
161
+ try {
162
+ response = await this.frame.goto(url, {
163
+ waitUntil: lifecycleEvent.waitUntil,
164
+ timeout: options === null || options === void 0 ? void 0 : options.timeout,
165
+ });
166
+ }
167
+ catch (e) {
168
+ if (browserLauncher_1.RunnerError.isPlaywrightNavigationInterruptedError(e)) {
169
+ responseHasNavigationError = true;
170
+ }
171
+ else {
172
+ throw e;
173
+ }
174
+ }
175
+ if (lifecycleEvent.waitForNetworkIdle || responseHasNavigationError) {
176
+ await this.frame.waitForLoadState(types_1.LifecycleEvent.NetworkIdle, {
177
+ timeout,
178
+ });
179
+ }
180
+ return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
181
+ }
166
182
  id() {
167
183
  return this.frame._guid;
168
184
  }
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.PlaywrightHttpRequest = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const logUtils_1 = require("../../util/logUtils");
29
29
  class PlaywrightHttpRequest {
30
30
  constructor(page, request, route) {
@@ -30,7 +30,7 @@ exports.PlaywrightPage = void 0;
30
30
  const events_1 = __importDefault(require("events"));
31
31
  const promises_1 = require("fs/promises");
32
32
  const browserLauncher_1 = require("../browserLauncher");
33
- const playwright = __importStar(require("@playwright/test"));
33
+ const playwright = __importStar(require("playwright"));
34
34
  const playwrightHttpResponse_1 = require("./playwrightHttpResponse");
35
35
  const playwrightHttpRequest_1 = require("./playwrightHttpRequest");
36
36
  const playwrightFrame_1 = require("./playwrightFrame");
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.WebkitBrowserDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
27
+ const playwright = __importStar(require("playwright"));
28
28
  const webkitPageDelegate_1 = require("./webkitPageDelegate");
29
29
  const nonChromiumAbstractBrowserDelegate_1 = require("../nonChromium/nonChromiumAbstractBrowserDelegate");
30
30
  class WebkitBrowserDelegate extends nonChromiumAbstractBrowserDelegate_1.NonChromiumAbstractBrowserDelegate {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCredentialType = exports.parseColinJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
6
+ exports.getCredentialType = exports.parseColonJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
7
7
  const mablApi_1 = require("../../mablApi");
8
8
  const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
9
9
  const constants_1 = require("../constants");
@@ -94,7 +94,7 @@ function validateValuePairInputs(inputName, inputs) {
94
94
  const wrappingWhitespace = inputs.filter((header) => !/^([^\s:]{1,2}|[^\s:][^:]+[^\s:]):([^\s:]{1,2}|[^\s:][^:]+[^\s:])?$/m.test(header));
95
95
  if (wrappingWhitespace.length > 0) {
96
96
  const cleanFunction = (header) => {
97
- const { name, value } = parseColinJoinedVariablePair(header);
97
+ const { name, value } = parseColonJoinedVariablePair(header);
98
98
  return [name, value].map((part) => part.trim()).join(':');
99
99
  };
100
100
  const cleaned = inputs.map(cleanFunction);
@@ -108,12 +108,12 @@ function validateValuePairInputs(inputName, inputs) {
108
108
  return inputs;
109
109
  }
110
110
  exports.validateValuePairInputs = validateValuePairInputs;
111
- function parseColinJoinedVariablePair(input) {
111
+ function parseColonJoinedVariablePair(input) {
112
112
  const name = input.substring(0, input.indexOf(':'));
113
113
  const value = input.substring(input.indexOf(':') + 1);
114
114
  return { name, value };
115
115
  }
116
- exports.parseColinJoinedVariablePair = parseColinJoinedVariablePair;
116
+ exports.parseColonJoinedVariablePair = parseColonJoinedVariablePair;
117
117
  function getCredentialType(credential) {
118
118
  if (credential.cloud_only) {
119
119
  return credential.type === mablApi_1.Credentials.TypeEnum.Basic
@@ -12,6 +12,7 @@ const branches_1 = require("../../commandUtil/branches");
12
12
  const chalk_1 = __importDefault(require("chalk"));
13
13
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
14
14
  const add_1 = require("./urls_cmds/add");
15
+ const environmentsValidation_1 = require("../../../core/entityValidation/environmentsValidation");
15
16
  exports.command = 'create';
16
17
  exports.describe = 'Create a new mabl environment';
17
18
  exports.builder = (yargs) => {
@@ -90,10 +91,23 @@ function addUpdateEnvCommands(argv) {
90
91
  (0, util_1.validateArrayInputs)(variables, 'Variables must be SPACE delimited, e.g. --variables foo:bar baz:qux');
91
92
  const validVariables = (0, util_1.validateValuePairInputs)('Variable', variables);
92
93
  return validVariables.reduce((variablesObject, item) => {
93
- const { name, value } = (0, util_1.parseColinJoinedVariablePair)(item);
94
+ const { name, value } = (0, util_1.parseColonJoinedVariablePair)(item);
94
95
  variablesObject[name] = value;
95
96
  return variablesObject;
96
97
  }, {});
98
+ })
99
+ .check((argv) => {
100
+ const variables = argv[constants_1.CommandArgVariables];
101
+ if (!variables) {
102
+ return true;
103
+ }
104
+ const variableNames = Object.keys(variables);
105
+ const invalidVariableNames = variableNames.filter((name) => !(0, environmentsValidation_1.isValidEnvironmentVariableName)(name));
106
+ if (invalidVariableNames.length === 0) {
107
+ return true;
108
+ }
109
+ const maybePlural = invalidVariableNames.length > 1 ? 's' : '';
110
+ throw new Error(`Invalid environment variable name${maybePlural}: ${invalidVariableNames.join(', ')}. Environment variable names must start with a letter or underscore and contain only letters, numbers, and underscores.`);
97
111
  });
98
112
  }
99
113
  exports.addUpdateEnvCommands = addUpdateEnvCommands;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidEnvironmentVariableName = void 0;
4
+ function isValidEnvironmentVariableName(name) {
5
+ return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name);
6
+ }
7
+ exports.isValidEnvironmentVariableName = isValidEnvironmentVariableName;