@mablhq/mabl-cli 1.17.6 → 1.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/api/featureSet.js +1 -4
  2. package/api/mablApiClient.js +2 -2
  3. package/browserLauncher/browserLauncherFactory.js +2 -3
  4. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +3 -0
  5. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +1 -11
  6. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +18 -0
  7. package/browserLauncher/runnerType.js +0 -1
  8. package/execution/index.js +1 -1
  9. package/execution/index.js.LICENSE.txt +2 -0
  10. package/index.d.ts +0 -1
  11. package/mablscript/MablAction.js +1 -1
  12. package/mablscript/MablStep.js +21 -3
  13. package/mablscript/actions/AwaitPDFDownloadAction.js +2 -1
  14. package/mablscript/actions/ConditionAction.js +11 -3
  15. package/mablscript/actions/ExtractAction.js +16 -7
  16. package/mablscript/actions/FindAction.js +71 -40
  17. package/mablscript/actions/GenerateRandomStringAction.js +2 -1
  18. package/mablscript/actions/GetUrlAction.js +1 -1
  19. package/mablscript/actions/GetVariableValue.js +2 -2
  20. package/mablscript/diffing/diffingUtil.js +146 -0
  21. package/mablscript/importer.js +20 -2
  22. package/mablscript/steps/AssertStep.js +33 -19
  23. package/mablscript/steps/AssertStepOld.js +38 -20
  24. package/mablscript/steps/AwaitTabStep.js +7 -6
  25. package/mablscript/steps/ClickAndHoldStep.js +1 -1
  26. package/mablscript/steps/DownloadStep.js +3 -2
  27. package/mablscript/steps/EchoStep.js +3 -1
  28. package/mablscript/steps/ElseIfConditionStep.js +5 -2
  29. package/mablscript/steps/EnterTextStep.js +4 -1
  30. package/mablscript/steps/EvaluateFlowStep.js +40 -0
  31. package/mablscript/steps/ReleaseStep.js +2 -1
  32. package/mablscript/steps/RemoveCookieStep.js +2 -3
  33. package/mablscript/steps/SendHttpRequestStep.js +3 -3
  34. package/mablscript/steps/SendKeyStep.js +2 -2
  35. package/mablscript/steps/SetCookieStep.js +2 -4
  36. package/mablscript/steps/SetViewportStep.js +1 -1
  37. package/mablscript/steps/VisitUrlStep.js +2 -1
  38. package/mablscript/steps/WaitStep.js +1 -4
  39. package/{browserLauncher/puppeteerBrowserLauncher/internals.js → mablscript/types/EvaluateFlowStepDescriptor.js} +0 -0
  40. package/mablscript/types/GetCurrentLocationDescriptor.js +4 -3
  41. package/mablscriptFind/index.js +1 -1
  42. package/package.json +3 -3
  43. package/resources/mablFind.js +1 -1
  44. package/resources/pdf-viewer/index.js +1 -1
  45. package/resources/pdf-viewer/libEmbeddedPdfHandler.js +11 -2
  46. package/util/actionabilityUtil.js +1 -24
  47. package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +0 -135
  48. package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowserLauncher.js +0 -45
  49. package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +0 -139
  50. package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +0 -115
  51. package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +0 -38
  52. package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +0 -27
  53. package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +0 -36
  54. package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +0 -335
  55. package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +0 -25
package/api/featureSet.js CHANGED
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureSet = exports.FindImplementationVersion = void 0;
4
4
  const runnerType_1 = require("../browserLauncher/runnerType");
5
- const PLAYWRIGHT_FEATURE_FLAG = 'nodejs_execution_engine_playwright';
6
5
  const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
7
6
  var FindImplementationVersion;
8
7
  (function (FindImplementationVersion) {
@@ -14,9 +13,7 @@ class FeatureSet {
14
13
  this.featureFlags = featureFlags;
15
14
  }
16
15
  getRunnerType() {
17
- return this.featureFlags.has(PLAYWRIGHT_FEATURE_FLAG)
18
- ? runnerType_1.RunnerType.Playwright
19
- : runnerType_1.RunnerType.Puppeteer;
16
+ return runnerType_1.RunnerType.Playwright;
20
17
  }
21
18
  getFindImplementationVersion() {
22
19
  return this.featureFlags.has(SMARTER_WAIT_FEATURE_FLAG)
@@ -303,7 +303,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
303
303
  return await this.makeGetRequest(`${env_1.BASE_API_URL}/accounts/${accountId}`);
304
304
  }
305
305
  catch (error) {
306
- throw new ApiError_1.ApiError(`Failed to get account`, error, error.status);
306
+ throw toApiError(`Failed to get account`, error);
307
307
  }
308
308
  }
309
309
  async getApiKeyDetails() {
@@ -457,7 +457,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
457
457
  return await this.makePostRequest(`${env_1.BASE_API_URL}/mailbox/address`, body);
458
458
  }
459
459
  catch (error) {
460
- throw new ApiError_1.ApiError('Failed to create mailbox email address', error);
460
+ throw toApiError('Failed to create mailbox email address', error);
461
461
  }
462
462
  }
463
463
  async createBranch(workspaceId, branchName) {
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BrowserLauncherFactory = void 0;
7
- const puppeteerBrowserLauncher_1 = require("./puppeteerBrowserLauncher/puppeteerBrowserLauncher");
8
7
  const playwrightBrowserLauncher_1 = require("./playwrightBrowserLauncher/playwrightBrowserLauncher");
9
8
  const runnerType_1 = require("./runnerType");
10
9
  const logUtils_1 = require("../util/logUtils");
@@ -24,8 +23,8 @@ class BrowserLauncherFactory {
24
23
  loggerFunc(chalk_1.default.cyan(`Browser launcher:`, chalk_1.default.magenta('Playwright')));
25
24
  return new playwrightBrowserLauncher_1.PlaywrightBrowserLauncher();
26
25
  }
27
- loggerFunc(chalk_1.default.cyan(`Browser launcher:`, chalk_1.default.magenta('Puppeteer')));
28
- return new puppeteerBrowserLauncher_1.PuppeteerBrowserLauncher();
26
+ loggerFunc(chalk_1.default.red.bold(`Unsupported runner type:`, runner));
27
+ throw new Error(`Unsupported runner type:[${runner}]`);
29
28
  }
30
29
  }
31
30
  exports.BrowserLauncherFactory = BrowserLauncherFactory;
@@ -128,5 +128,8 @@ class PlaywrightBrowser extends events_1.default {
128
128
  await playwrightPage.waitForInitialization();
129
129
  return playwrightPage;
130
130
  }
131
+ exposeFunction(name, callback) {
132
+ return this.defaultContext.exposeFunction(name, callback);
133
+ }
131
134
  }
132
135
  exports.PlaywrightBrowser = PlaywrightBrowser;
@@ -194,23 +194,13 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
194
194
  return this.element.selectOption(value);
195
195
  }
196
196
  async type(text, options) {
197
- const timeout = PlaywrightElementHandle.getTypeTimeout(text, options);
198
197
  await this.element.focus();
199
198
  await this.element.selectText({ force: true });
200
199
  return this.element.type(text, {
201
200
  delay: options === null || options === void 0 ? void 0 : options.delay,
202
- timeout,
201
+ timeout: 0,
203
202
  });
204
203
  }
205
- static getTypeTimeout(text, options) {
206
- var _a;
207
- let timeout;
208
- const newTimeout = text.length * ((_a = options === null || options === void 0 ? void 0 : options.delay) !== null && _a !== void 0 ? _a : 1) * 2;
209
- if (newTimeout > types_1.DefaultTimeouts.defaultTextInputTimeoutMs) {
210
- timeout = newTimeout;
211
- }
212
- return timeout;
213
- }
214
204
  press(key) {
215
205
  return this.element.press(key);
216
206
  }
@@ -178,5 +178,23 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
178
178
  }
179
179
  return this.frameImpl;
180
180
  }
181
+ async initializeExposedFunctionInSecondaryWorld(functionName) {
182
+ var _a;
183
+ try {
184
+ const pageImpl = this.parentPage.getPageImpl();
185
+ if (!pageImpl) {
186
+ return false;
187
+ }
188
+ const binding = (_a = pageImpl._pageBindings.get(functionName)) !== null && _a !== void 0 ? _a : pageImpl._browserContext._pageBindings.get(functionName);
189
+ if (!binding) {
190
+ return false;
191
+ }
192
+ await this.evaluateCodeInSecondaryWorld(binding.source, {});
193
+ }
194
+ catch (e) {
195
+ return false;
196
+ }
197
+ return true;
198
+ }
181
199
  }
182
200
  exports.PlaywrightFrame = PlaywrightFrame;
@@ -4,5 +4,4 @@ exports.RunnerType = void 0;
4
4
  var RunnerType;
5
5
  (function (RunnerType) {
6
6
  RunnerType["Playwright"] = "playwright";
7
- RunnerType["Puppeteer"] = "puppeteer";
8
7
  })(RunnerType = exports.RunnerType || (exports.RunnerType = {}));