@mablhq/mabl-cli 1.58.20 → 1.58.25

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 (108) hide show
  1. package/api/basicApiClient.js +21 -15
  2. package/api/mablApiClient.js +40 -48
  3. package/api/mablApiClientFactory.js +1 -1
  4. package/auth/OktaClient.js +1 -2
  5. package/browserEngines/chromiumBrowserEngine.js +1 -2
  6. package/browserEngines/firefoxBrowserEngine.js +2 -2
  7. package/browserEngines/webkitBrowerEngine.js +2 -2
  8. package/browserLauncher/browserLauncherFactory.js +2 -3
  9. package/browserLauncher/elementHandle.js +1 -2
  10. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +12 -20
  11. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
  12. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +7 -10
  13. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +3 -4
  14. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +4 -5
  15. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +4 -7
  16. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
  17. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -5
  18. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +31 -37
  19. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +8 -9
  20. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +4 -8
  21. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +4 -6
  22. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +1 -2
  23. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
  24. package/browserTestMonitoring/metricsRecorder.js +6 -6
  25. package/commands/commandUtil/branches.js +2 -3
  26. package/commands/commandUtil/codeInsights.js +13 -16
  27. package/commands/commandUtil/fileUtil.js +1 -1
  28. package/commands/commandUtil/util.js +3 -4
  29. package/commands/commandUtil/versionUtil.js +4 -5
  30. package/commands/config/config_cmds/list.js +2 -2
  31. package/commands/constants.js +3 -1
  32. package/commands/datatables/datatables_cmds/create.js +2 -3
  33. package/commands/datatables/datatables_cmds/export.js +3 -5
  34. package/commands/datatables/datatables_cmds/list.js +1 -2
  35. package/commands/datatables/datatables_cmds/scenarios.js +1 -2
  36. package/commands/datatables/datatables_cmds/update.js +11 -11
  37. package/commands/datatables/utils.js +9 -9
  38. package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +6 -8
  39. package/commands/deploy/deploy_cmds/create.js +11 -13
  40. package/commands/deploy/deploy_cmds/executionResultPresenter.js +8 -11
  41. package/commands/deploy/deploy_cmds/list.js +3 -4
  42. package/commands/deploy/deploy_cmds/watch.js +1 -2
  43. package/commands/environments/environments_cmds/create.js +1 -2
  44. package/commands/environments/environments_cmds/delete.js +1 -2
  45. package/commands/environments/environments_cmds/update.js +1 -2
  46. package/commands/environments/environments_cmds/urls_cmds/list.js +1 -2
  47. package/commands/flows/flows_cmds/export.js +1 -2
  48. package/commands/plans/plans_cmds/describe.js +1 -2
  49. package/commands/tests/mobileEmulationUtil.js +5 -7
  50. package/commands/tests/testsUtil.js +40 -42
  51. package/commands/tests/tests_cmds/export.js +1 -2
  52. package/commands/tests/tests_cmds/import.js +4 -5
  53. package/commands/tests/tests_cmds/run-cloud.js +12 -13
  54. package/commands/tests/tests_cmds/run.js +30 -11
  55. package/commands/users/users_cmds/list.js +2 -2
  56. package/commands/workspaces/workspace_cmds/copy.js +1 -2
  57. package/core/execution/ApiTestUtils.js +82 -94
  58. package/core/execution/LocalizationOptionsLists.js +1253 -0
  59. package/core/messaging/logLineMessaging.js +2 -3
  60. package/core/messaging/messaging.js +6 -7
  61. package/core/trainer/trainingSessions.js +15 -15
  62. package/coreWebVitals/index.js +14 -18
  63. package/domUtil/index.js +1 -1
  64. package/execution/index.js +1 -1
  65. package/functions/apiTest/utils.js +4 -5
  66. package/http/MablHttpAgent.js +4 -6
  67. package/http/RequestSecurityError.js +1 -1
  68. package/http/axiosProxyConfig.js +3 -5
  69. package/http/httpUtil.js +2 -3
  70. package/http/requestInterceptor.js +11 -15
  71. package/mablApi/index.js +1 -1
  72. package/mablscript/MablAction.js +2 -3
  73. package/mablscript/MablStep.js +2 -4
  74. package/mablscript/MablSymbol.js +1 -1
  75. package/mablscript/actions/ConditionAction.js +2 -4
  76. package/mablscript/actions/FindAction.js +2 -4
  77. package/mablscript/diffing/diffingUtil.js +8 -7
  78. package/mablscript/importer.js +1 -2
  79. package/mablscript/steps/AccessibilityCheck.js +7 -9
  80. package/mablscript/steps/AssertStep.js +11 -16
  81. package/mablscript/steps/ClickAndHoldStep.js +1 -2
  82. package/mablscript/steps/CookieUtils.js +40 -7
  83. package/mablscript/steps/CreateVariableStep.js +1 -2
  84. package/mablscript/steps/DownloadStep.js +1 -2
  85. package/mablscript/steps/EnterTextStep.js +1 -2
  86. package/mablscript/steps/EvaluateFlowStep.js +1 -1
  87. package/mablscript/steps/IfConditionStep.js +4 -6
  88. package/mablscript/steps/ReleaseStep.js +1 -2
  89. package/mablscript/steps/SendHttpRequestStep.js +2 -4
  90. package/mablscript/steps/SendKeyStep.js +1 -1
  91. package/mablscript/steps/SetCookieStep.js +35 -20
  92. package/mablscript/steps/SetViewportStep.js +1 -1
  93. package/mablscript/steps/SwitchContextStep.js +3 -6
  94. package/mablscript/steps/SyntheticStep.js +1 -2
  95. package/mablscriptFind/index.js +1 -1
  96. package/middleware.js +1 -2
  97. package/package.json +2 -2
  98. package/popupDismissal/index.js +4 -5
  99. package/providers/authenticationProvider.js +5 -6
  100. package/providers/cliConfigProvider.js +10 -12
  101. package/providers/exportRequestProvider.js +3 -5
  102. package/providers/logging/loggingProvider.js +1 -1
  103. package/reporters/mochAwesome/mochAwesomeReporter.js +12 -14
  104. package/resources/mablFind.js +1 -1
  105. package/util/actionabilityUtil.js +1 -1
  106. package/util/analytics.js +6 -9
  107. package/util/browserTestUtils.js +1 -2
  108. package/util/markdownUtil.js +9 -11
@@ -67,7 +67,7 @@ async function checkActionabilityAt(elementHandle, executionContext, recheckOnFa
67
67
  throw new Error(NO_CLICKABLE_POINT_ERROR);
68
68
  }
69
69
  const frame = await elementHandle.frame();
70
- if (frame === null || frame === void 0 ? void 0 : frame.parentFrame()) {
70
+ if (frame?.parentFrame()) {
71
71
  const element = await frame.getFrameOwnerElement();
72
72
  if (element !== undefined) {
73
73
  const box = await element.boundingBox();
package/util/analytics.js CHANGED
@@ -36,21 +36,20 @@ const analytics = new Analytics('ghbAXZbk8fqWROgMscPdkQMoqEjwsKRa', {
36
36
  flushInterval: 1,
37
37
  });
38
38
  async function getTrackingInfo() {
39
- var _a, _b, _c;
40
39
  const config = await cliConfigProvider_1.CliConfigProvider.getCliConfig();
41
40
  if (config.authentication.authType === undefined) {
42
41
  return {};
43
42
  }
44
43
  let userId;
45
44
  if (config.authentication.authType === types_1.AuthType.ApiKey) {
46
- userId = `cliKey-${(_b = (_a = config.workspace) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 'unknown'}`;
45
+ userId = `cliKey-${config.workspace?.id ?? 'unknown'}`;
47
46
  }
48
47
  else {
49
48
  userId = config.userId;
50
49
  }
51
50
  return {
52
51
  userId,
53
- workspaceId: (_c = config.workspace) === null || _c === void 0 ? void 0 : _c.id,
52
+ workspaceId: config.workspace?.id,
54
53
  };
55
54
  }
56
55
  async function trackCliEvent(commands, argumentCountMap) {
@@ -95,8 +94,7 @@ async function trackMablTestsRunnerEvent(eventName, resultsMap) {
95
94
  }
96
95
  exports.trackMablTestsRunnerEvent = trackMablTestsRunnerEvent;
97
96
  function trackEvent(event, userId, properties) {
98
- var _a, _b, _c;
99
- const cpuInfo = (_a = os.cpus()) !== null && _a !== void 0 ? _a : [];
97
+ const cpuInfo = os.cpus() ?? [];
100
98
  analytics.track({
101
99
  userId,
102
100
  event,
@@ -114,8 +112,8 @@ function trackEvent(event, userId, properties) {
114
112
  userAgent: getUserAgent(),
115
113
  userAgentData: {
116
114
  cpuCount: cpuInfo.length,
117
- cpuType: (_b = cpuInfo === null || cpuInfo === void 0 ? void 0 : cpuInfo[0]) === null || _b === void 0 ? void 0 : _b.model,
118
- cpuSpeed: (_c = cpuInfo === null || cpuInfo === void 0 ? void 0 : cpuInfo[0]) === null || _c === void 0 ? void 0 : _c.speed,
115
+ cpuType: cpuInfo?.[0]?.model,
116
+ cpuSpeed: cpuInfo?.[0]?.speed,
119
117
  osArch: os.arch(),
120
118
  memFree: os.freemem(),
121
119
  memTotal: os.totalmem(),
@@ -125,7 +123,6 @@ function trackEvent(event, userId, properties) {
125
123
  });
126
124
  }
127
125
  function getUserAgent() {
128
- var _a, _b;
129
- const nodeName = (_b = (_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'node';
126
+ const nodeName = process?.release?.name ?? 'node';
130
127
  return `${nodeName}_${process.arch}@${process.version}`;
131
128
  }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
- var _a, _b;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.IS_TEST_BROWSER_WEBKIT = exports.IS_TEST_BROWSER_FIREFOX = exports.IS_TEST_BROWSER_CHROMIUM = exports.TEST_BROWSER_ENGINE = exports.TEST_BROWSER_TYPE = void 0;
5
4
  const browserEngines_1 = require("../browserEngines/browserEngines");
6
5
  const browserTypes_1 = require("../commands/browserTypes");
7
6
  const VALID_TEST_BROWSER_TYPES = ['chrome', 'firefox', 'webkit'];
8
- const browserTypeEnvironmentVariable = (_b = (_a = process.env.TEST_BROWSER_TYPE) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : 'chrome';
7
+ const browserTypeEnvironmentVariable = process.env.TEST_BROWSER_TYPE?.toLowerCase() ?? 'chrome';
9
8
  if (browserTypeEnvironmentVariable &&
10
9
  !VALID_TEST_BROWSER_TYPES.includes(browserTypeEnvironmentVariable)) {
11
10
  throw Error(`Test browser type cannot be ${browserTypeEnvironmentVariable}, it must be one of ${VALID_TEST_BROWSER_TYPES}`);
@@ -14,21 +14,19 @@ var HumanizedMablStatuses;
14
14
  HumanizedMablStatuses["Stopped"] = "Stopped";
15
15
  })(HumanizedMablStatuses || (HumanizedMablStatuses = {}));
16
16
  function formatResultsAsGithubMarkdown(results) {
17
- var _a;
18
17
  const tableRows = [];
19
18
  tableRows.push(['Plan', 'Test', 'Browser', 'Status', 'Run Time']);
20
- const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
19
+ const finalExecutions = results?.executions ?? [];
21
20
  finalExecutions.forEach((summary) => {
22
- var _a, _b, _c, _d, _e, _f, _g;
23
- const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
24
- const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
25
- const humanizedPlanRunStatus = humanizeMablStatus((_d = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _d === void 0 ? void 0 : _d.status);
21
+ const retryPrefix = summary?.plan_execution?.is_retry ? '[Retry] ' : '';
22
+ const planName = retryPrefix + (summary.plan?.name ?? '<plan name unavailable>');
23
+ const humanizedPlanRunStatus = humanizeMablStatus(summary?.plan_execution?.status);
26
24
  const planRunStatus = humanizedMablStatusToGithubIcon(humanizedPlanRunStatus) +
27
25
  ' ' +
28
- maybeCapitalize(humanizedPlanRunStatus === null || humanizedPlanRunStatus === void 0 ? void 0 : humanizedPlanRunStatus.toString());
29
- const planHref = (_e = summary.plan) === null || _e === void 0 ? void 0 : _e.app_href;
26
+ maybeCapitalize(humanizedPlanRunStatus?.toString());
27
+ const planHref = summary.plan?.app_href;
30
28
  const journeyMap = new Map();
31
- (_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
29
+ summary.journeys?.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
32
30
  tableRows.push([
33
31
  `[${planName}](${planHref})`,
34
32
  '---',
@@ -36,11 +34,11 @@ function formatResultsAsGithubMarkdown(results) {
36
34
  planRunStatus,
37
35
  summaryToElapsedTime(summary),
38
36
  ]);
39
- (_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach((journeyRun) => {
37
+ summary.journey_executions?.forEach((journeyRun) => {
40
38
  const humanizedJourneyRunStatus = humanizeMablStatus(journeyRun.status);
41
39
  const journeyStatus = humanizedMablStatusToGithubIcon(humanizedJourneyRunStatus) +
42
40
  ' ' +
43
- maybeCapitalize(humanizedJourneyRunStatus === null || humanizedJourneyRunStatus === void 0 ? void 0 : humanizedJourneyRunStatus.toString());
41
+ maybeCapitalize(humanizedJourneyRunStatus?.toString());
44
42
  const journeyBrowser = maybeCapitalize(journeyRun.browser_type);
45
43
  const journeySummary = journeyMap.get(journeyRun.journey_id);
46
44
  let journeyLabel = '<test name unavailable>';