@mablhq/mabl-cli 1.23.5 → 1.25.15

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.
package/README.md CHANGED
@@ -345,10 +345,10 @@ mabl config delete http.sslVerify
345
345
 
346
346
  ## Installation Troubleshooting
347
347
 
348
- If you receive the following error message, you need to ensure you have Node 12+
348
+ If you receive the following error message, you need to ensure you have Node 14+
349
349
  installed.
350
350
 
351
351
  ```bash
352
- npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">= 12.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
352
+ npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">= 14.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
353
353
  npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@0.1.13
354
354
  ```
@@ -59,6 +59,9 @@ class BasicApiClient {
59
59
  sslVerify: (_a = options.sslVerify) !== null && _a !== void 0 ? _a : DEFAULT_SSL_VERIFY,
60
60
  proxyHost: options.proxyUrl,
61
61
  });
62
+ if (!config.headers) {
63
+ config.headers = {};
64
+ }
62
65
  config.timeout =
63
66
  (_d = (_b = options.requestTimeoutMillis) !== null && _b !== void 0 ? _b : (_c = options.retryConfig) === null || _c === void 0 ? void 0 : _c.requestTimeoutMillis) !== null && _d !== void 0 ? _d : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
64
67
  switch (options.authType) {
@@ -87,6 +90,7 @@ class BasicApiClient {
87
90
  }
88
91
  this.httpRequestConfig = config;
89
92
  this.httpClient = axios_1.default.create(config);
93
+ this.httpClient.defaults.headers.common = { ...config.headers };
90
94
  this.retryConfig = options.retryConfig;
91
95
  this.debugLogger = (_e = options.debugLogger) !== null && _e !== void 0 ? _e : logUtils_1.logInternal;
92
96
  }
package/api/featureSet.js CHANGED
@@ -2,6 +2,7 @@
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 ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
5
6
  const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
6
7
  var FindImplementationVersion;
7
8
  (function (FindImplementationVersion) {
@@ -20,5 +21,8 @@ class FeatureSet {
20
21
  ? FindImplementationVersion.SmartFind
21
22
  : FindImplementationVersion.V1;
22
23
  }
24
+ hasAccessibilityChecksEnabled() {
25
+ return this.featureFlags.has(ACCESSIBILITY_CHECK_FEATURE_FLAG);
26
+ }
23
27
  }
24
28
  exports.FeatureSet = FeatureSet;
@@ -698,6 +698,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
698
698
  async failJourneyRun(journeyRunId, cause) {
699
699
  try {
700
700
  const response = await this.makePatchRequest(`${this.baseApiUrl}/journeyRuns/${journeyRunId}`, {
701
+ functionally_completed: false,
701
702
  status: mablApi_1.JourneyRun.StatusEnum.Failed,
702
703
  status_cause: cause,
703
704
  });
@@ -200,5 +200,8 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
200
200
  const context = await this.getFrameImpl()._utilityContext();
201
201
  return new playwrightDom_1.PlaywrightJsHandle(await context.injectedScript(), this.page());
202
202
  }
203
+ isDetached() {
204
+ return this.frame.isDetached();
205
+ }
203
206
  }
204
207
  exports.PlaywrightFrame = PlaywrightFrame;
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AwaitDeploymentCompletion = void 0;
4
4
  const awaitCompletion_1 = require("../../commandUtil/awaitCompletion");
5
5
  const executionResultPresenter_1 = require("./executionResultPresenter");
6
- const moment = require("moment");
7
6
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
7
+ const timeUtil_1 = require("../../../util/timeUtil");
8
8
  const chalk = require('chalk');
9
- const momentDurationFormatSetup = require('moment-duration-format');
10
- momentDurationFormatSetup(moment);
11
9
  class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
12
10
  constructor(apiClient, exitOnFirstFailure, isSilent) {
13
11
  super(apiClient, AwaitDeploymentCompletion.pollingTimeoutMilliseconds, AwaitDeploymentCompletion.pollingIntervalMilliseconds);
@@ -46,9 +44,7 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
46
44
  if (this.isSilent) {
47
45
  return;
48
46
  }
49
- const elapsedTimeString = moment
50
- .duration(this.getElapsedMilliseconds(), 'ms')
51
- .format('hh:mm:ss', { trim: false });
47
+ const elapsedTimeString = (0, timeUtil_1.elapsedTimeDurationToString)(this.getElapsedMilliseconds());
52
48
  const passed = (_b = (_a = lastEntity.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : 0;
53
49
  const failed = (_d = (_c = lastEntity.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed) !== null && _d !== void 0 ? _d : 0;
54
50
  const total = (_f = (_e = lastEntity.plan_execution_metrics) === null || _e === void 0 ? void 0 : _e.total) !== null && _f !== void 0 ? _f : 0;
@@ -7,7 +7,6 @@ const mablApi_1 = require("../../../mablApi");
7
7
  const util_1 = require("../../commandUtil/util");
8
8
  const branches_1 = require("../../commandUtil/branches");
9
9
  const awaitDeploymentCompletion_1 = require("./awaitDeploymentCompletion");
10
- const moment = require("moment");
11
10
  const scmContextProvider_1 = require("../../../providers/scmContextProvider");
12
11
  const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
13
12
  const configKeys_1 = require("../../config/config_cmds/configKeys");
@@ -16,8 +15,6 @@ const constants_1 = require("../../constants");
16
15
  const describe_1 = require("../../commandUtil/describe");
17
16
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
18
17
  const chalk = require('chalk');
19
- const momentDurationFormatSetup = require('moment-duration-format');
20
- momentDurationFormatSetup(moment);
21
18
  const CommandArgAwaitCompletion = 'await-completion';
22
19
  const CommandArgRebaselineImages = 'rebaseline-images';
23
20
  const CommandArgRepositoryUrl = 'repository-url';
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ExecutionResultPresenter = void 0;
7
7
  const change_case_1 = require("change-case");
8
8
  const mablApi_1 = require("../../../mablApi");
9
- const moment = require("moment");
10
9
  const cli_table3_1 = __importDefault(require("cli-table3"));
10
+ const timeUtil_1 = require("../../../util/timeUtil");
11
11
  const chalk = require('chalk');
12
- const momentDurationFormatSetup = require('moment-duration-format');
13
- momentDurationFormatSetup(moment);
14
12
  class ExecutionResultPresenter {
15
13
  entityToString(results, columnWidth) {
16
14
  var _a;
@@ -45,7 +43,7 @@ class ExecutionResultPresenter {
45
43
  planId,
46
44
  '---',
47
45
  statusChalk(this.maybeCapitalize(planRunStatus.toString())),
48
- this.summaryToElapsedTime(summary),
46
+ summaryToElapsedTime(summary),
49
47
  ]);
50
48
  (_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
51
49
  var _a, _b, _c, _d;
@@ -61,7 +59,7 @@ class ExecutionResultPresenter {
61
59
  journeyId,
62
60
  journeyBrowser,
63
61
  statusChalk(journeyStatus),
64
- this.journeyRunToElapsedTime(journeyRun),
62
+ journeyRunToElapsedTime(journeyRun),
65
63
  ]);
66
64
  });
67
65
  });
@@ -73,28 +71,6 @@ class ExecutionResultPresenter {
73
71
  }
74
72
  return;
75
73
  }
76
- journeyRunToElapsedTime(journeyRun) {
77
- let elapsedTimeString = '--:--:--';
78
- const startTime = journeyRun.start_time;
79
- const stopTime = journeyRun.stop_time;
80
- if (startTime && stopTime) {
81
- elapsedTimeString = moment
82
- .duration(stopTime - startTime, 'ms')
83
- .format('hh:mm:ss', { trim: false });
84
- }
85
- return elapsedTimeString;
86
- }
87
- summaryToElapsedTime(summary) {
88
- let elapsedTimeString = '--:--:--';
89
- const startTime = summary.start_time;
90
- const stopTime = summary.stop_time;
91
- if (startTime && stopTime) {
92
- elapsedTimeString = moment
93
- .duration(stopTime - startTime, 'ms')
94
- .format('hh:mm:ss', { trim: false });
95
- }
96
- return elapsedTimeString;
97
- }
98
74
  mapPlanRunStatusToColor(status) {
99
75
  switch (status) {
100
76
  case mablApi_1.PlanExecutionResult.StatusEnum.Queued:
@@ -132,3 +108,9 @@ class ExecutionResultPresenter {
132
108
  }
133
109
  }
134
110
  exports.ExecutionResultPresenter = ExecutionResultPresenter;
111
+ function journeyRunToElapsedTime(journeyRun) {
112
+ return (0, timeUtil_1.elapsedTimeToString)(journeyRun.start_time, journeyRun.stop_time);
113
+ }
114
+ function summaryToElapsedTime(summary) {
115
+ return (0, timeUtil_1.elapsedTimeToString)(summary.start_time, summary.stop_time);
116
+ }
@@ -84,6 +84,9 @@ function addUpdateEnvCommands(argv) {
84
84
  return true;
85
85
  })
86
86
  .coerce('variables', (variables) => {
87
+ if (variables.length === 0) {
88
+ return undefined;
89
+ }
87
90
  (0, util_1.validateArrayInputs)(variables, 'Variables must be SPACE delimited, e.g. --variables foo:bar baz:qux');
88
91
  variables = (0, util_1.validateValuePairInputs)('Variable', variables);
89
92
  return variables.reduce((variablesObject, item) => {
@@ -593,7 +593,7 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
593
593
  }
594
594
  exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
595
595
  async function pullDownTestRunConfig(testRunId, apiClient) {
596
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
596
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
597
597
  const journeyRun = await apiClient.getTestRun(testRunId);
598
598
  const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
599
599
  return {
@@ -601,21 +601,23 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
601
601
  ? (_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.http_auth_credentials_id
602
602
  : undefined,
603
603
  branchName: (_c = journeyRun.journey_parameters) === null || _c === void 0 ? void 0 : _c.source_control_tag,
604
- credentialsId: (_d = planRun.run_policy) === null || _d === void 0 ? void 0 : _d.credentials_id,
605
- dataTableVariables: (_e = journeyRun.journey_parameters) === null || _e === void 0 ? void 0 : _e.user_variables,
606
- deviceEmulation: (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.device_emulation,
607
- environmentId: (_h = (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.deployment) === null || _h === void 0 ? void 0 : _h.environment_id,
604
+ credentialsId: ((_d = planRun.run_policy) === null || _d === void 0 ? void 0 : _d.credentials_required)
605
+ ? (_e = planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_id
606
+ : undefined,
607
+ dataTableVariables: (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.user_variables,
608
+ deviceEmulation: (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
609
+ environmentId: (_j = (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
608
610
  filterHttpRequests: false,
609
- journeyUserDefinedVariables: (_k = (_j = journeyRun.journey) === null || _j === void 0 ? void 0 : _j.variables) === null || _k === void 0 ? void 0 : _k.inputs,
610
- importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
611
- pageLoadWait: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.page_load_wait,
612
- testId: (_o = journeyRun.journey) === null || _o === void 0 ? void 0 : _o.invariant_id,
613
- url: (_q = (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.deployment) === null || _q === void 0 ? void 0 : _q.uri,
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,
614
616
  };
615
617
  }
616
618
  exports.pullDownTestRunConfig = pullDownTestRunConfig;
617
619
  async function extractTestRunConfig(executionMessage, apiClient) {
618
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
620
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
619
621
  const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
620
622
  const planRun = executionMessage.plan_run;
621
623
  const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
@@ -624,17 +626,19 @@ async function extractTestRunConfig(executionMessage, apiClient) {
624
626
  : undefined;
625
627
  return {
626
628
  branchName: (_d = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _d === void 0 ? void 0 : _d.source_control_tag,
627
- credentialsId: (_e = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_id,
628
- dataTableVariables: (_f = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.user_variables,
629
- deviceEmulation: (_g = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
630
- environmentId: (_j = (_h = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
629
+ credentialsId: ((_e = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_required)
630
+ ? (_f = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _f === void 0 ? void 0 : _f.credentials_id
631
+ : undefined,
632
+ dataTableVariables: (_g = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.user_variables,
633
+ deviceEmulation: (_h = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.device_emulation,
634
+ 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,
631
635
  filterHttpRequests: true,
632
- importedVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.imported_variables,
633
- journeyUserDefinedVariables: (_m = (_l = journeyRun.journey) === null || _l === void 0 ? void 0 : _l.variables) === null || _m === void 0 ? void 0 : _m.inputs,
634
- pageLoadWait: (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.page_load_wait,
636
+ 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,
635
639
  runnerType: maybeRunnerType,
636
- testId: (_p = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _p === void 0 ? void 0 : _p.invariant_id,
637
- url: (_r = (_q = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.deployment) === null || _r === void 0 ? void 0 : _r.uri,
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,
638
642
  };
639
643
  }
640
644
  exports.extractTestRunConfig = extractTestRunConfig;