@mablhq/mabl-cli 1.16.32 → 1.17.0

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 (124) hide show
  1. package/api/basicApiClient.js +9 -4
  2. package/api/mablApiClient.js +14 -7
  3. package/browserLauncher/browserLauncherFactory.js +2 -1
  4. package/browserLauncher/elementHandle.js +2 -1
  5. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +5 -1
  6. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +22 -18
  7. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +10 -6
  8. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +5 -1
  9. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +13 -9
  10. package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +1 -1
  11. package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +10 -10
  12. package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +6 -6
  13. package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
  14. package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +1 -1
  15. package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
  16. package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +12 -11
  17. package/cli.js +12 -8
  18. package/commands/applications/applications_cmds/describe.js +4 -4
  19. package/commands/applications/applications_cmds/list.js +4 -4
  20. package/commands/auth/auth_cmds/activate-key.js +1 -1
  21. package/commands/branches/branches_cmds/create.js +4 -4
  22. package/commands/branches/branches_cmds/describe.js +3 -3
  23. package/commands/branches/branches_cmds/list.js +3 -3
  24. package/commands/branches/branches_cmds/merge.js +4 -4
  25. package/commands/commandUtil/codeInsights.js +4 -2
  26. package/commands/commandUtil/describe.js +1 -1
  27. package/commands/commandUtil/fileUtil.js +5 -1
  28. package/commands/commandUtil/util.js +2 -2
  29. package/commands/config/config_cmds/delete.js +1 -1
  30. package/commands/config/config_cmds/set.js +1 -1
  31. package/commands/constants.js +2 -1
  32. package/commands/credentials/credentials_cmds/list.js +4 -4
  33. package/commands/deploy/deploy_cmds/create.js +18 -13
  34. package/commands/deploy/deploy_cmds/describe.js +5 -5
  35. package/commands/deploy/deploy_cmds/executionResultPresenter.js +1 -1
  36. package/commands/deploy/deploy_cmds/list.js +4 -4
  37. package/commands/deploy/deploy_cmds/watch.js +2 -2
  38. package/commands/environments/environments_cmds/create.js +7 -7
  39. package/commands/environments/environments_cmds/delete.js +1 -1
  40. package/commands/environments/environments_cmds/describe.js +4 -4
  41. package/commands/environments/environments_cmds/list.js +4 -4
  42. package/commands/environments/environments_cmds/update.js +2 -2
  43. package/commands/environments/environments_cmds/urls_cmds/add.js +3 -3
  44. package/commands/environments/environments_cmds/urls_cmds/list.js +2 -2
  45. package/commands/flows/flows_cmds/export.js +5 -5
  46. package/commands/flows/flows_cmds/list.js +2 -2
  47. package/commands/link-agents/link-agents_cmds/delete.js +1 -1
  48. package/commands/plans/plans_cmds/describe.js +4 -4
  49. package/commands/plans/plans_cmds/list.js +2 -2
  50. package/commands/test-runs/test-runs_cmds/export.js +2 -2
  51. package/commands/tests/executionUtil.js +5 -5
  52. package/commands/tests/testsUtil.js +19 -12
  53. package/commands/tests/tests_cmds/create.js +3 -3
  54. package/commands/tests/tests_cmds/edit.js +3 -3
  55. package/commands/tests/tests_cmds/export.js +7 -7
  56. package/commands/tests/tests_cmds/import.js +35 -14
  57. package/commands/tests/tests_cmds/list.js +3 -3
  58. package/commands/tests/tests_cmds/run-alpha.js +3 -3
  59. package/commands/tests/tests_cmds/run-cloud.js +4 -4
  60. package/commands/tests/tests_cmds/run-legacy.js +8 -8
  61. package/commands/tests/tests_cmds/run.js +8 -8
  62. package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +2 -2
  63. package/commands/tests/tests_cmds/trainer_cmds/update.js +1 -1
  64. package/commands/tests/tests_cmds/trainer_cmds/version.js +2 -2
  65. package/commands/workspaces/workspace_cmds/copy.js +2 -2
  66. package/commands/workspaces/workspace_cmds/describe.js +4 -4
  67. package/commands/workspaces/workspace_cmds/list.js +2 -2
  68. package/configGenerators/flowConfigGenerator.js +1 -1
  69. package/configGenerators/selIdeGenerator.js +6 -6
  70. package/core/messaging/actions/runnerActions.js +2 -2
  71. package/core/trainer/openUtils.js +2 -2
  72. package/core/trainer/trainingSessions.js +26 -26
  73. package/domUtil/index.js +1 -1
  74. package/env/env.js +5 -1
  75. package/execution/index.js +1 -1
  76. package/mablApi/index.js +1 -1
  77. package/mablscript/AttributesConstants.js +2 -1
  78. package/mablscript/MablStep.js +6 -12
  79. package/mablscript/actions/ConditionAction.js +1 -1
  80. package/mablscript/actions/FindAction.js +25 -32
  81. package/mablscript/actions/GetUrlAction.js +1 -1
  82. package/mablscript/actions/GetVariableValue.js +1 -1
  83. package/mablscript/actions/JavaScriptAction.js +16 -16
  84. package/mablscript/importer.js +7 -7
  85. package/mablscript/steps/AccessibilityCheck.js +4 -2
  86. package/mablscript/steps/AssertStep.js +16 -16
  87. package/mablscript/steps/AssertStepOld.js +2 -2
  88. package/mablscript/steps/ClickStep.js +1 -1
  89. package/mablscript/steps/CreateVariableStep.js +6 -6
  90. package/mablscript/steps/DoubleClickStep.js +1 -1
  91. package/mablscript/steps/EchoStep.js +2 -2
  92. package/mablscript/steps/EnterTextStep.js +3 -3
  93. package/mablscript/steps/HoverStep.js +1 -1
  94. package/mablscript/steps/IfConditionStep.js +2 -1
  95. package/mablscript/steps/NavigateStep.js +1 -1
  96. package/mablscript/steps/SendHttpRequestStep.js +1 -1
  97. package/mablscript/steps/SendKeyStep.js +2 -2
  98. package/mablscript/steps/SetViewportStep.js +1 -1
  99. package/mablscript/steps/SwitchContextStep.js +9 -9
  100. package/mablscript/steps/VisitUrlStep.js +1 -1
  101. package/mablscript/steps/WaitStep.js +1 -1
  102. package/mablscript/steps/WaitUntilStep.js +1 -1
  103. package/mablscript/types/OperatingSystemDescriptor.js +5 -1
  104. package/mablscript/types/VariableNamespace.js +1 -1
  105. package/mablscriptFind/index.js +1 -1
  106. package/observers/mockObserver.js +4 -2
  107. package/package.json +55 -56
  108. package/popupDismissal/index.js +3 -3
  109. package/providers/authenticationProvider.js +3 -3
  110. package/providers/logging/loggingProvider.js +5 -1
  111. package/proxy/index.js +2 -1
  112. package/proxy/index.js.LICENSE.txt +5 -0
  113. package/reporters/mochAwesome/mochAwesomeReporter.js +11 -7
  114. package/reporters/reporter.js +1 -1
  115. package/resources/mablFind.js +1 -1
  116. package/resources/popupDismissal.js +1 -1
  117. package/util/RichPromise.js +1 -0
  118. package/util/actionabilityUtil.js +18 -14
  119. package/util/analytics.js +7 -3
  120. package/util/downloadUtil.js +6 -2
  121. package/util/httpUtil.js +6 -2
  122. package/util/markdownUtil.js +1 -1
  123. package/util/pureUtil.js +5 -1
  124. package/util/resourceUtil.js +5 -1
@@ -16,7 +16,7 @@ const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
16
16
  exports.command = 'create';
17
17
  exports.describe = 'Create a new mabl environment';
18
18
  exports.builder = (yargs) => {
19
- addUpdateEnvCommands(add_1.addEnvironmentUrlOptions(yargs))
19
+ addUpdateEnvCommands((0, add_1.addEnvironmentUrlOptions)(yargs))
20
20
  .option(constants_1.CommandArgWorkspaceId, {
21
21
  alias: constants_1.CommandArgAliases.WorkspaceId,
22
22
  describe: 'Workspace containing to create environment in',
@@ -37,7 +37,7 @@ exports.builder = (yargs) => {
37
37
  type: 'array',
38
38
  });
39
39
  };
40
- exports.handler = util_1.failWrapper(createEnvironment);
40
+ exports.handler = (0, util_1.failWrapper)(createEnvironment);
41
41
  function addUpdateEnvCommands(argv) {
42
42
  return argv
43
43
  .option(constants_1.CommandArgName, {
@@ -79,14 +79,14 @@ function addUpdateEnvCommands(argv) {
79
79
  })
80
80
  .check((argv) => {
81
81
  const branchName = argv[constants_1.CommandArgMablBranch];
82
- if (branchName !== undefined && !branches_1.isValidMablBranchName(branchName)) {
82
+ if (branchName !== undefined && !(0, branches_1.isValidMablBranchName)(branchName)) {
83
83
  throw new Error(`[${branchName}] is not a valid mabl branch name. Please specify a valid name`);
84
84
  }
85
85
  return true;
86
86
  })
87
87
  .coerce('variables', (variables) => {
88
- util_1.validateArrayInputs(variables, 'Variables must be SPACE delimited, e.g. --variables foo:bar baz:qux');
89
- variables = util_1.validateValuePairInputs('Variable', variables);
88
+ (0, util_1.validateArrayInputs)(variables, 'Variables must be SPACE delimited, e.g. --variables foo:bar baz:qux');
89
+ variables = (0, util_1.validateValuePairInputs)('Variable', variables);
90
90
  return variables.reduce((variablesObject, item) => {
91
91
  const parts = item.split(':', 2);
92
92
  variablesObject[parts[0]] = parts[1];
@@ -119,8 +119,8 @@ async function createEnvironment(parsed) {
119
119
  if (applicationId) {
120
120
  loggingProvider_1.logger.info('Associating URLs with environment');
121
121
  const createDeploymentsPromises = (parsed[constants_1.CommandArgUrlApp] || [])
122
- .map((url) => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.WebApplication))
123
- .concat((parsed[constants_1.CommandArgUrlApi] || []).map((url) => add_1.createDeploymentForUrl(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.Api)));
122
+ .map((url) => (0, add_1.createDeploymentForUrl)(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.WebApplication))
123
+ .concat((parsed[constants_1.CommandArgUrlApi] || []).map((url) => (0, add_1.createDeploymentForUrl)(apiClient, environment, applicationId, url, mablApi_1.Deployment.DeploymentTypeEnum.Api)));
124
124
  await Promise.all(createDeploymentsPromises);
125
125
  }
126
126
  }
@@ -16,7 +16,7 @@ exports.builder = (yargs) => {
16
16
  type: 'string',
17
17
  });
18
18
  };
19
- exports.handler = util_1.failWrapper(deleteEnvironment);
19
+ exports.handler = (0, util_1.failWrapper)(deleteEnvironment);
20
20
  async function deleteEnvironment(parsed) {
21
21
  var _a;
22
22
  let environment;
@@ -5,21 +5,21 @@ const describe_1 = require("../../commandUtil/describe");
5
5
  const util_1 = require("../../commandUtil/util");
6
6
  const constants_1 = require("../../constants");
7
7
  exports.command = 'describe <id>';
8
- exports.describe = util_1.getDescribeDescriptions('environment');
8
+ exports.describe = (0, util_1.getDescribeDescriptions)('environment');
9
9
  exports.builder = {
10
10
  [constants_1.CommandArgDecrypt]: {
11
11
  describe: `Set to decrypt and return environment variables as part of the payload`,
12
12
  boolean: true,
13
13
  },
14
- ...describe_1.getDescribeBuilderOptions(),
14
+ ...(0, describe_1.getDescribeBuilderOptions)(),
15
15
  };
16
- exports.handler = util_1.failWrapper(getEnvironment);
16
+ exports.handler = (0, util_1.failWrapper)(getEnvironment);
17
17
  async function getEnvironment(parsed) {
18
18
  try {
19
19
  const environmentId = parsed.id;
20
20
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
21
21
  const environment = await apiClient.getEnvironment(environmentId, parsed.decrypt);
22
- describe_1.outputEntity(environment, parsed.output);
22
+ (0, describe_1.outputEntity)(environment, parsed.output);
23
23
  return environment.id;
24
24
  }
25
25
  catch (error) {
@@ -13,11 +13,11 @@ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
13
13
  const constants_1 = require("../../constants");
14
14
  exports.command = 'list';
15
15
  exports.describe = 'List your environments';
16
- exports.builder = list_1.getListBuilderOptions('environments');
17
- exports.handler = util_1.failWrapper(listEnvironments);
16
+ exports.builder = (0, list_1.getListBuilderOptions)('environments');
17
+ exports.handler = (0, util_1.failWrapper)(listEnvironments);
18
18
  async function listEnvironments(parsed) {
19
19
  const output = parsed.output;
20
- const workspaceId = util_1.getWorkspaceId(parsed);
20
+ const workspaceId = (0, util_1.getWorkspaceId)(parsed);
21
21
  const limit = parsed.limit;
22
22
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
23
23
  const environments = await apiClient.getEnvironments(workspaceId, limit);
@@ -30,7 +30,7 @@ function printEnvironments(environments, output) {
30
30
  loggingProvider_1.logger.info(JSON.stringify(environments, null, 2));
31
31
  break;
32
32
  case 'yaml':
33
- loggingProvider_1.logger.info(js_yaml_1.dump(environments));
33
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(environments));
34
34
  break;
35
35
  default:
36
36
  const table = new cli_table3_1.default({
@@ -13,14 +13,14 @@ const create_1 = require("./create");
13
13
  exports.command = 'update <id>';
14
14
  exports.describe = 'Update a mabl environment';
15
15
  exports.builder = (yargs) => {
16
- create_1.addUpdateEnvCommands(add_1.addEnvironmentUrlOptions(yargs)).positional(constants_1.CommandArgId, {
16
+ (0, create_1.addUpdateEnvCommands)((0, add_1.addEnvironmentUrlOptions)(yargs)).positional(constants_1.CommandArgId, {
17
17
  describe: 'Id of environment to update',
18
18
  type: 'string',
19
19
  nargs: 1,
20
20
  demand: 'id argument required',
21
21
  });
22
22
  };
23
- exports.handler = util_1.failWrapper(updateEnvironment);
23
+ exports.handler = (0, util_1.failWrapper)(updateEnvironment);
24
24
  async function updateEnvironment(parsed) {
25
25
  var _a;
26
26
  let environment;
@@ -20,7 +20,7 @@ exports.builder = (yargs) => {
20
20
  })
21
21
  .demandOption(constants_1.CommandArgApplicationId);
22
22
  };
23
- exports.handler = util_1.failWrapper(createDeployments);
23
+ exports.handler = (0, util_1.failWrapper)(createDeployments);
24
24
  function addEnvironmentUrlOptions(yargs) {
25
25
  return yargs
26
26
  .option(constants_1.CommandArgApplicationId, {
@@ -46,10 +46,10 @@ function addEnvironmentUrlOptions(yargs) {
46
46
  throw new Error(`Must specify at least one url if adding an application association to the environment`);
47
47
  }
48
48
  if (appUrls) {
49
- util_1.validateArrayInputs(appUrls, 'Urls must be SPACE delimited, e.g. "--api-urls=http://mabl.com http://api.mabl.com');
49
+ (0, util_1.validateArrayInputs)(appUrls, 'Urls must be SPACE delimited, e.g. "--api-urls=http://mabl.com http://api.mabl.com');
50
50
  }
51
51
  if (apiUrls) {
52
- util_1.validateArrayInputs(apiUrls, 'Urls must be SPACE delimited, e.g. "--api-urls=http://mabl.com http://api.mabl.com');
52
+ (0, util_1.validateArrayInputs)(apiUrls, 'Urls must be SPACE delimited, e.g. "--api-urls=http://mabl.com http://api.mabl.com');
53
53
  }
54
54
  return true;
55
55
  });
@@ -33,14 +33,14 @@ exports.builder = (yargs) => {
33
33
  nargs: 1,
34
34
  });
35
35
  };
36
- exports.handler = util_1.failWrapper(queryDeployments);
36
+ exports.handler = (0, util_1.failWrapper)(queryDeployments);
37
37
  async function queryDeployments(parsed) {
38
38
  var _a;
39
39
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
40
40
  try {
41
41
  const environment = await apiClient.getEnvironment(parsed.id);
42
42
  const deploymentEntities = await apiClient.queryDeploymentEntities((_a = environment.organization_id) !== null && _a !== void 0 ? _a : '', environment.id, parsed[constants_1.CommandArgApplicationId], parsed.limit);
43
- describe_1.outputEntity(deploymentEntities.deployments, parsed.output);
43
+ (0, describe_1.outputEntity)(deploymentEntities.deployments, parsed.output);
44
44
  }
45
45
  catch (error) {
46
46
  throw new Error(`Error listing urls for environment ${parsed.id}: ${error}`);
@@ -34,7 +34,7 @@ exports.builder = (yargs) => {
34
34
  type: 'string',
35
35
  });
36
36
  };
37
- exports.handler = util_1.failWrapper(pullFlow);
37
+ exports.handler = (0, util_1.failWrapper)(pullFlow);
38
38
  async function pullFlow(parsed) {
39
39
  var _a;
40
40
  const flowId = parsed.id;
@@ -61,11 +61,11 @@ function dumpYamlOrJsonToFile(type, flow, detailLevel) {
61
61
  : flowConfig.generateSimpleFormat();
62
62
  switch (type) {
63
63
  case constants_1.OutputFormats.Yaml:
64
- const yaml = js_yaml_1.dump(configGenerated, { skipInvalid: false });
65
- fileUtil_1.writeExportedEntityToFile(yaml, 'yml', flow.id);
64
+ const yaml = (0, js_yaml_1.dump)(configGenerated, { skipInvalid: false });
65
+ (0, fileUtil_1.writeExportedEntityToFile)(yaml, 'yml', flow.id);
66
66
  break;
67
67
  case constants_1.OutputFormats.Json:
68
- fileUtil_1.writeExportedEntityToFile(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', flow.id);
68
+ (0, fileUtil_1.writeExportedEntityToFile)(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', flow.id);
69
69
  break;
70
70
  default:
71
71
  throw new Error(`Invalid Type supplied for exporting flow: ${type}`);
@@ -74,5 +74,5 @@ function dumpYamlOrJsonToFile(type, flow, detailLevel) {
74
74
  function dumpToCsv(flow) {
75
75
  const flowConfig = new flowConfigGenerator_1.FlowConfig(flow, false);
76
76
  const output = flowConfig.generateSimpleCsv();
77
- fileUtil_1.writeExportedEntityToFile(output.join(os.EOL), 'csv', flow.id);
77
+ (0, fileUtil_1.writeExportedEntityToFile)(output.join(os.EOL), 'csv', flow.id);
78
78
  }
@@ -27,10 +27,10 @@ exports.builder = (yargs) => {
27
27
  type: 'string',
28
28
  });
29
29
  };
30
- exports.handler = util_1.failWrapper(listFlows);
30
+ exports.handler = (0, util_1.failWrapper)(listFlows);
31
31
  async function listFlows(parsed) {
32
32
  const limit = parsed.limit;
33
- const workspaceId = util_1.getWorkspaceId(parsed);
33
+ const workspaceId = (0, util_1.getWorkspaceId)(parsed);
34
34
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
35
35
  const flows = await apiClient.getFlows({
36
36
  organization_id: workspaceId,
@@ -23,7 +23,7 @@ exports.builder = (yargs) => {
23
23
  type: 'string',
24
24
  });
25
25
  };
26
- exports.handler = util_1.failWrapper(deleteLinkAgent);
26
+ exports.handler = (0, util_1.failWrapper)(deleteLinkAgent);
27
27
  async function deleteLinkAgent(parsed) {
28
28
  var _a, _b;
29
29
  try {
@@ -4,9 +4,9 @@ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
4
4
  const describe_1 = require("../../commandUtil/describe");
5
5
  const util_1 = require("../../commandUtil/util");
6
6
  exports.command = 'describe <id>';
7
- exports.describe = util_1.getDescribeDescriptions('plan');
8
- exports.builder = describe_1.getDescribeBuilderOptions();
9
- exports.handler = util_1.failWrapper(getPlan);
7
+ exports.describe = (0, util_1.getDescribeDescriptions)('plan');
8
+ exports.builder = (0, describe_1.getDescribeBuilderOptions)();
9
+ exports.handler = (0, util_1.failWrapper)(getPlan);
10
10
  async function getPlan(parsed) {
11
11
  var _a;
12
12
  try {
@@ -15,7 +15,7 @@ async function getPlan(parsed) {
15
15
  const plan = await apiClient.getPlan(planId);
16
16
  delete plan.execution_graph;
17
17
  delete plan.journeys_ddt_migration_backup;
18
- describe_1.outputEntity(plan, parsed.output);
18
+ (0, describe_1.outputEntity)(plan, parsed.output);
19
19
  return (_a = plan.id) !== null && _a !== void 0 ? _a : '';
20
20
  }
21
21
  catch (error) {
@@ -27,10 +27,10 @@ exports.builder = (yargs) => {
27
27
  type: 'string',
28
28
  });
29
29
  };
30
- exports.handler = util_1.failWrapper(listPlans);
30
+ exports.handler = (0, util_1.failWrapper)(listPlans);
31
31
  async function listPlans(parsed) {
32
32
  const limit = parsed.limit;
33
- const workspaceId = util_1.getWorkspaceId(parsed);
33
+ const workspaceId = (0, util_1.getWorkspaceId)(parsed);
34
34
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
35
35
  const plans = await apiClient.getPlans({
36
36
  organization_id: workspaceId,
@@ -34,11 +34,11 @@ exports.builder = (yargs) => {
34
34
  .example('$0 test-runs export <id>', 'export test run screenshots to file')
35
35
  .example('$0 test-runs export <id> --type screenshots doms', 'export test run screenshots and doms to file')
36
36
  .check((argv) => {
37
- util_1.validateArrayInputs(argv[constants_1.CommandArgContentTypes], 'export types must be SPACE delimited, e.g. "--types=screenshots doms"');
37
+ (0, util_1.validateArrayInputs)(argv[constants_1.CommandArgContentTypes], 'export types must be SPACE delimited, e.g. "--types=screenshots doms"');
38
38
  return true;
39
39
  });
40
40
  };
41
- exports.handler = util_1.failWrapper(createExport);
41
+ exports.handler = (0, util_1.failWrapper)(createExport);
42
42
  async function createExport(parsed) {
43
43
  const targetEntityId = parsed.id;
44
44
  const targetEntityType = 'test run';
@@ -13,24 +13,24 @@ exports.DEFAULT_BROWSER_WIDTH = 1366;
13
13
  exports.DEFAULT_BROWSER_HEIGHT = 768;
14
14
  async function runTheTestInNewWindow(test, flows, branchName, url, credentialsId, environment, width, height) {
15
15
  const authConfig = await new authenticationProvider_1.AuthenticationProvider().getAuthConfigWithAutoRenew();
16
- const browserPreferences = testsUtil_1.generateChromiumPreferencesFile();
17
- const browserPreferencesDirectory = await testsUtil_1.prepareChromePreferencesDirectory(browserPreferences);
16
+ const browserPreferences = (0, testsUtil_1.generateChromiumPreferencesFile)();
17
+ const browserPreferencesDirectory = await (0, testsUtil_1.prepareChromePreferencesDirectory)(browserPreferences);
18
18
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
19
19
  if (!test.organization_id) {
20
20
  throw new Error('The test workspace ID is required, but it is not set.');
21
21
  }
22
22
  const featureFlags = await apiClient.getEffectiveFeaturesByWorkspaceId(test.organization_id);
23
23
  const runnerType = featureFlags.getRunnerType();
24
- const trainingBrowser = await testsUtil_1.createBrowserWithAuthedExtension(authConfig.accessToken, width || exports.DEFAULT_BROWSER_WIDTH, height || exports.DEFAULT_BROWSER_HEIGHT, browserPreferencesDirectory, {
24
+ const trainingBrowser = await (0, testsUtil_1.createBrowserWithAuthedExtension)(authConfig.accessToken, width || exports.DEFAULT_BROWSER_WIDTH, height || exports.DEFAULT_BROWSER_HEIGHT, browserPreferencesDirectory, {
25
25
  runnerType,
26
26
  });
27
- const backgroundPage = await testsUtil_1.getExtensionBackgroundPageWithCliTool(trainingBrowser);
27
+ const backgroundPage = await (0, testsUtil_1.getExtensionBackgroundPageWithCliTool)(trainingBrowser);
28
28
  process.once('SIGINT', function () {
29
29
  loggingProvider_1.logger.info(chalk_1.default.yellowBright('Closing local run of test'));
30
30
  trainingBrowser
31
31
  .close()
32
32
  .catch((error) => loggingProvider_1.logger.info('Error shutting down browser on CTRL + C: ' + error));
33
33
  });
34
- await testsUtil_1.runTheTest(trainingBrowser, backgroundPage, test, flows, branchName, url, credentialsId, environment);
34
+ await (0, testsUtil_1.runTheTest)(trainingBrowser, backgroundPage, test, flows, branchName, url, credentialsId, environment);
35
35
  }
36
36
  exports.runTheTestInNewWindow = runTheTestInNewWindow;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -103,7 +107,7 @@ function findChrome() {
103
107
  exports.findChrome = findChrome;
104
108
  async function createBrowserWithAuthedExtension(accessToken, browserWidth, browserHeight, tempBrowserPreferencesDirectory, options) {
105
109
  const { credentials, disableIsolation, ignoreCertificateErrors, runnerType, loggerFunc, } = options;
106
- const pathToExtension = await trainerUtil_1.getMablTrainerExtensionPath();
110
+ const pathToExtension = await (0, trainerUtil_1.getMablTrainerExtensionPath)();
107
111
  const chromePath = findChrome();
108
112
  if (!chromePath.length) {
109
113
  messaging_1.mablEventEmitter.log(chalk.yellow('Could not find a local install of Chrome to use, please ensure you have it installed and try again'));
@@ -178,7 +182,7 @@ function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, crede
178
182
  });
179
183
  }
180
184
  async function prepareChromePreferencesDirectory(browserPreferences) {
181
- return async_retry_1.default(() => {
185
+ return (0, async_retry_1.default)(() => {
182
186
  const tempBrowserPreferencesDirectory = getTempChromePrefDirectory();
183
187
  fs.ensureDirSync(path.normalize(`${tempBrowserPreferencesDirectory}/Default`));
184
188
  const prefFilePath = path.normalize(`${tempBrowserPreferencesDirectory}/Default/Preferences`);
@@ -215,8 +219,8 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
215
219
  }
216
220
  disableFeaturesFlags.push('site-per-process');
217
221
  launchArgs.push(`--disable-features=${disableFeaturesFlags.join(',')}`);
218
- const fakeMicrophoneMedia = resourceUtil_1.findResource('media/mabl_test_audio.wav', resourcesDirectoryOverride);
219
- const fakeWebcamMedia = resourceUtil_1.findResource('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
222
+ const fakeMicrophoneMedia = (0, resourceUtil_1.findResource)('media/mabl_test_audio.wav', resourcesDirectoryOverride);
223
+ const fakeWebcamMedia = (0, resourceUtil_1.findResource)('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
220
224
  const defaultDeviceDescriptor = addLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMedia, fakeWebcamMedia, ignoreCertificateErrors, emulationConfig);
221
225
  let ignoreDefaultArgs;
222
226
  if (enableExtensions) {
@@ -238,7 +242,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
238
242
  exports.createBrowser = createBrowser;
239
243
  function addLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMediaPath, fakeWebcamMediaPath, ignoreCertificateErrors, emulationConfig) {
240
244
  var _a, _b;
241
- const defaultDeviceDescriptor = mobileEmulationUtil_1.getDeviceDescriptorForEmulation(emulationConfig);
245
+ const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig);
242
246
  launchArgs.push(`--window-size=${(_a = defaultDeviceDescriptor === null || defaultDeviceDescriptor === void 0 ? void 0 : defaultDeviceDescriptor.width) !== null && _a !== void 0 ? _a : browserWidth},${(_b = defaultDeviceDescriptor === null || defaultDeviceDescriptor === void 0 ? void 0 : defaultDeviceDescriptor.height) !== null && _b !== void 0 ? _b : browserHeight}`);
243
247
  if (emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent) {
244
248
  launchArgs.push(`--user-agent=${emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent}`);
@@ -285,7 +289,7 @@ async function createBrowserForExecutionEngine(browserWidth, browserHeight, head
285
289
  }
286
290
  exports.createBrowserForExecutionEngine = createBrowserForExecutionEngine;
287
291
  async function setUpAuthTokenForExtension(browser, accessToken) {
288
- const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
292
+ const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
289
293
  await backgroundPage.evaluate((token) => {
290
294
  localStorage.setItem('authResult', JSON.stringify({ idToken: token }));
291
295
  localStorage.setItem('trainerWorld', 'mablCLI');
@@ -294,7 +298,7 @@ async function setUpAuthTokenForExtension(browser, accessToken) {
294
298
  }
295
299
  exports.setUpAuthTokenForExtension = setUpAuthTokenForExtension;
296
300
  async function getExtensionBackgroundPageWithCliTool(browser) {
297
- const backgroundPage = await browser.getExtensionBackgroundPage(trainerUtil_1.getTrainerId());
301
+ const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
298
302
  if (backgroundPage) {
299
303
  await checkForMablCliTool(backgroundPage);
300
304
  await exposeMessagingFunctionToTrainer(backgroundPage, browser);
@@ -526,7 +530,7 @@ async function downloadUploadFile(fileUploadUrl, fileUpload, downloadDirectory,
526
530
  client = mablApiClient.httpClient;
527
531
  }
528
532
  else {
529
- client = axios_1.default.create(httpUtil_1.currentProxyConfig());
533
+ client = axios_1.default.create((0, httpUtil_1.currentProxyConfig)());
530
534
  }
531
535
  try {
532
536
  const finalDirectory = path.normalize(`${downloadDirectory}/${fileUpload.id}`);
@@ -616,7 +620,9 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
616
620
  filterHttpRequests: false,
617
621
  testId: (_e = journeyRun.journey) === null || _e === void 0 ? void 0 : _e.invariant_id,
618
622
  url: (_g = (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.deployment) === null || _g === void 0 ? void 0 : _g.uri,
619
- basicAuthCredentialsId: ((_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.http_auth_credentials_required) ? (_j = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _j === void 0 ? void 0 : _j.http_auth_credentials_id : undefined,
623
+ basicAuthCredentialsId: ((_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.http_auth_credentials_required)
624
+ ? (_j = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _j === void 0 ? void 0 : _j.http_auth_credentials_id
625
+ : undefined,
620
626
  dataTableVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.user_variables,
621
627
  deviceEmulation: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.device_emulation,
622
628
  importedVariables: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.imported_variables,
@@ -628,8 +634,9 @@ async function extractTestRunConfig(executionMessage, apiClient) {
628
634
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
629
635
  const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
630
636
  const planRun = executionMessage.plan_run;
631
- const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant) ?
632
- (_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.nodejs_runtime_variant
637
+ const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
638
+ ?
639
+ (_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.nodejs_runtime_variant
633
640
  : undefined;
634
641
  return {
635
642
  environmentId: (_e = (_d = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _d === void 0 ? void 0 : _d.deployment) === null || _e === void 0 ? void 0 : _e.environment_id,
@@ -90,13 +90,13 @@ exports.builder = (yargs) => {
90
90
  type: 'string',
91
91
  });
92
92
  };
93
- exports.handler = util_1.failWrapper(launchTrainingSession);
93
+ exports.handler = (0, util_1.failWrapper)(launchTrainingSession);
94
94
  async function launchTrainingSession(parsed) {
95
95
  const url = parsed.url;
96
96
  const width = parsed.width;
97
97
  const height = parsed.height;
98
98
  const testName = parsed['test-name'];
99
- const workspaceId = util_1.getWorkspaceId(parsed);
99
+ const workspaceId = (0, util_1.getWorkspaceId)(parsed);
100
100
  const testDescription = parsed['test-description'];
101
101
  const branchName = parsed['mabl-branch'];
102
102
  const autoBranch = parsed['auto-branch'];
@@ -124,7 +124,7 @@ async function launchTrainingSession(parsed) {
124
124
  width,
125
125
  workspaceId,
126
126
  };
127
- await trainingSessions_1.trainNewTest(trainingSessionOptions);
127
+ await (0, trainingSessions_1.trainNewTest)(trainingSessionOptions);
128
128
  return 'done';
129
129
  }
130
130
  exports.launchTrainingSession = launchTrainingSession;
@@ -76,9 +76,9 @@ exports.builder = (yargs) => {
76
76
  default: false,
77
77
  type: 'boolean',
78
78
  })
79
- .check((argv) => testsUtil_1.validateRunEditCommand(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
79
+ .check((argv) => (0, testsUtil_1.validateRunEditCommand)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgTestRunId]));
80
80
  };
81
- exports.handler = util_1.failWrapper(launchEditTrainingSession);
81
+ exports.handler = (0, util_1.failWrapper)(launchEditTrainingSession);
82
82
  async function launchEditTrainingSession(parsed) {
83
83
  const testRunId = parsed['run-id'];
84
84
  const testId = parsed.id;
@@ -106,6 +106,6 @@ async function launchEditTrainingSession(parsed) {
106
106
  url,
107
107
  width,
108
108
  };
109
- await trainingSessions_1.editTest(editTrainingSessionOptions);
109
+ await (0, trainingSessions_1.editTest)(editTrainingSessionOptions);
110
110
  return 'done';
111
111
  }
@@ -43,7 +43,7 @@ exports.builder = (yargs) => {
43
43
  type: 'string',
44
44
  });
45
45
  };
46
- exports.handler = util_1.failWrapper(pullJourney);
46
+ exports.handler = (0, util_1.failWrapper)(pullJourney);
47
47
  async function pullJourney(parsed) {
48
48
  var _a;
49
49
  const testId = parsed.id;
@@ -52,7 +52,7 @@ async function pullJourney(parsed) {
52
52
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createUserApiClient();
53
53
  const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
54
54
  const journey = await apiClient.getJourney(testId, branchName, format);
55
- const flowArray = await util_1.getJourneyFlowArray(journey, apiClient, branchName);
55
+ const flowArray = await (0, util_1.getJourneyFlowArray)(journey, apiClient, branchName);
56
56
  if (flowArray
57
57
  .map((flow) => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript ||
58
58
  flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Api)
@@ -78,7 +78,7 @@ function dumpToSeleniumIde(journey, flows) {
78
78
  const selIdeConfig = new selIdeGenerator_1.SelIdeConfig(journey, flows);
79
79
  const configGenerated = selIdeConfig.generateConfigFile();
80
80
  const jsonified = JSON.stringify(configGenerated, JSON_REPLACER, 2);
81
- fileUtil_1.writeExportedEntityToFile(jsonified, 'side', journey.id);
81
+ (0, fileUtil_1.writeExportedEntityToFile)(jsonified, 'side', journey.id);
82
82
  }
83
83
  function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
84
84
  const journeyConfig = new testConfigGenerator_1.JourneyConfig(journey, flows, false);
@@ -87,11 +87,11 @@ function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
87
87
  : journeyConfig.generateSimpleFormat();
88
88
  switch (type) {
89
89
  case constants_1.OutputFormats.Yaml:
90
- const yaml = js_yaml_1.dump(configGenerated, { skipInvalid: false });
91
- fileUtil_1.writeExportedEntityToFile(yaml, 'yml', journey.id);
90
+ const yaml = (0, js_yaml_1.dump)(configGenerated, { skipInvalid: false });
91
+ (0, fileUtil_1.writeExportedEntityToFile)(yaml, 'yml', journey.id);
92
92
  break;
93
93
  case constants_1.OutputFormats.Json:
94
- fileUtil_1.writeExportedEntityToFile(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', journey.id);
94
+ (0, fileUtil_1.writeExportedEntityToFile)(JSON.stringify(configGenerated, JSON_REPLACER, 2), 'json', journey.id);
95
95
  break;
96
96
  default:
97
97
  throw new Error(`Invalid Type supplied for exporting: ${type}`);
@@ -100,5 +100,5 @@ function dumpYamlOrJsonToFile(type, journey, flows, detailLevel) {
100
100
  function dumpToCsv(journey, flows) {
101
101
  const journeyConfig = new testConfigGenerator_1.JourneyConfig(journey, flows, false);
102
102
  const output = journeyConfig.generateSimpleCsv();
103
- fileUtil_1.writeExportedEntityToFile(output.join(os.EOL), 'csv', journey.id);
103
+ (0, fileUtil_1.writeExportedEntityToFile)(output.join(os.EOL), 'csv', journey.id);
104
104
  }