@mablhq/mabl-cli 1.25.1 → 1.25.19

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/Globals.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Globals = void 0;
4
+ class Globals {
5
+ static getFindOverallTimeoutMs() {
6
+ return Globals.findOverallTimeoutMs;
7
+ }
8
+ static setFindOverallTimeoutMs(timeout) {
9
+ Globals.findOverallTimeoutMs = timeout;
10
+ }
11
+ static getPlaywrightInteractionWarningMs() {
12
+ return Globals.playwrightInteractionWarningMs;
13
+ }
14
+ static setPlaywrightInteractionWarningMs(timeout) {
15
+ Globals.playwrightInteractionWarningMs = timeout;
16
+ }
17
+ }
18
+ exports.Globals = Globals;
19
+ Globals.findOverallTimeoutMs = 18.5 * 60 * 1000;
20
+ Globals.playwrightInteractionWarningMs = 30 * 1000;
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;
@@ -329,6 +329,14 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
329
329
  throw toApiError(`Failed to get account`, error);
330
330
  }
331
331
  }
332
+ async getAccountByWorkspaceId(workspaceId) {
333
+ try {
334
+ return await this.makeGetRequest(`${this.baseApiUrl}/organizations/${workspaceId}/account`);
335
+ }
336
+ catch (error) {
337
+ throw toApiError(`Failed to get account from workspace id`, error);
338
+ }
339
+ }
332
340
  async getApiKeyDetails() {
333
341
  try {
334
342
  return await this.makeGetRequest(`${this.baseApiUrl}/apiKeys/self`);
@@ -698,6 +706,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
698
706
  async failJourneyRun(journeyRunId, cause) {
699
707
  try {
700
708
  const response = await this.makePatchRequest(`${this.baseApiUrl}/journeyRuns/${journeyRunId}`, {
709
+ functionally_completed: false,
701
710
  status: mablApi_1.JourneyRun.StatusEnum.Failed,
702
711
  status_cause: cause,
703
712
  });
@@ -726,8 +735,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
726
735
  }
727
736
  async getEffectiveFeaturesByWorkspaceId(workspaceId) {
728
737
  try {
729
- const workspace = await this.getWorkspace(workspaceId);
730
- const account = await this.getAccount(workspace.account_id);
738
+ const account = await this.getAccountByWorkspaceId(workspaceId);
731
739
  const features = account.effective_features
732
740
  ? new Set(account.effective_features)
733
741
  : new Set();
@@ -304,8 +304,26 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
304
304
  const result = await this.element.evaluate((el, attributeName) => el.getAttribute(attributeName), attributeName);
305
305
  return (0, pureUtil_1.isNullish)(result) ? undefined : result;
306
306
  }
307
+ async getElementText() {
308
+ const result = await this.element.evaluate((el) => {
309
+ var _a;
310
+ function extractFromSlot(element) {
311
+ const slots = element.querySelectorAll('slot');
312
+ if (slots.length !== 1) {
313
+ return '';
314
+ }
315
+ const textNode = slots
316
+ .item(0)
317
+ .assignedNodes()
318
+ .find((node) => node.nodeType === Node.TEXT_NODE);
319
+ return textNode ? textNode.data : '';
320
+ }
321
+ return (_a = (el.innerText || extractFromSlot(el))) !== null && _a !== void 0 ? _a : '';
322
+ });
323
+ return (0, pureUtil_1.isNullish)(result) ? undefined : result;
324
+ }
307
325
  async getInnerText() {
308
- const result = await this.element.evaluate((el) => el.innerText);
326
+ const result = await this.element.innerText();
309
327
  return (0, pureUtil_1.isNullish)(result) ? undefined : result;
310
328
  }
311
329
  getActionTimeout(options) {
@@ -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) => {
@@ -61,6 +61,7 @@ const baseExecutionEngineLaunchArgs = [
61
61
  '--v=0',
62
62
  '--enable-features=NetworkService,NetworkServiceInProcess',
63
63
  '--disable-features=site-per-process',
64
+ '--disable-component-update',
64
65
  ];
65
66
  const ExecutionEngineFakeAudioFilePath = '/opt/media/mabl_test_audio.wav';
66
67
  const ExecutionEngineFakeVideoFilePath = '/opt/media/mabl_test_pattern.y4m';
@@ -593,7 +594,7 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
593
594
  }
594
595
  exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
595
596
  async function pullDownTestRunConfig(testRunId, apiClient) {
596
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
597
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
597
598
  const journeyRun = await apiClient.getTestRun(testRunId);
598
599
  const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
599
600
  return {
@@ -601,21 +602,23 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
601
602
  ? (_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.http_auth_credentials_id
602
603
  : undefined,
603
604
  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,
605
+ credentialsId: ((_d = planRun.run_policy) === null || _d === void 0 ? void 0 : _d.credentials_required)
606
+ ? (_e = planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_id
607
+ : undefined,
608
+ dataTableVariables: (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.user_variables,
609
+ deviceEmulation: (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
610
+ environmentId: (_j = (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
608
611
  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,
612
+ journeyUserDefinedVariables: (_l = (_k = journeyRun.journey) === null || _k === void 0 ? void 0 : _k.variables) === null || _l === void 0 ? void 0 : _l.inputs,
613
+ importedVariables: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.imported_variables,
614
+ pageLoadWait: (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.page_load_wait,
615
+ testId: (_p = journeyRun.journey) === null || _p === void 0 ? void 0 : _p.invariant_id,
616
+ url: (_r = (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.deployment) === null || _r === void 0 ? void 0 : _r.uri,
614
617
  };
615
618
  }
616
619
  exports.pullDownTestRunConfig = pullDownTestRunConfig;
617
620
  async function extractTestRunConfig(executionMessage, apiClient) {
618
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
621
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
619
622
  const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
620
623
  const planRun = executionMessage.plan_run;
621
624
  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 +627,19 @@ async function extractTestRunConfig(executionMessage, apiClient) {
624
627
  : undefined;
625
628
  return {
626
629
  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,
630
+ credentialsId: ((_e = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_required)
631
+ ? (_f = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _f === void 0 ? void 0 : _f.credentials_id
632
+ : undefined,
633
+ dataTableVariables: (_g = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.user_variables,
634
+ deviceEmulation: (_h = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.device_emulation,
635
+ 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
636
  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,
637
+ importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
638
+ journeyUserDefinedVariables: (_o = (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.inputs,
639
+ pageLoadWait: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.page_load_wait,
635
640
  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,
641
+ testId: (_q = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _q === void 0 ? void 0 : _q.invariant_id,
642
+ 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
643
  };
639
644
  }
640
645
  exports.extractTestRunConfig = extractTestRunConfig;