@mablhq/mabl-cli 2.12.10 → 2.12.16

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.
@@ -658,6 +658,18 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
658
658
  if (options.deploymentIds) {
659
659
  planOverrides.deployment_ids = options.deploymentIds;
660
660
  }
661
+ if (options.androidMobileAppFileId) {
662
+ planOverrides.mobile_app_file_ids = {
663
+ ...planOverrides.mobile_app_file_ids,
664
+ [mablApi_1.MobilePlatformEnum.Android]: options.androidMobileAppFileId,
665
+ };
666
+ }
667
+ if (options.iOSMobileAppFileId) {
668
+ planOverrides.mobile_app_file_ids = {
669
+ ...planOverrides.mobile_app_file_ids,
670
+ [mablApi_1.MobilePlatformEnum.Ios]: options.iOSMobileAppFileId,
671
+ };
672
+ }
661
673
  if ((_h = options.httpHeaders) === null || _h === void 0 ? void 0 : _h.length) {
662
674
  planOverrides.http_headers = options.httpHeaders.map((header) => {
663
675
  const parts = header.split(':', 2);
@@ -818,8 +830,8 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
818
830
  throw toApiError(`Failed to terminate journey run ${journeyRunId}`, error);
819
831
  }
820
832
  }
821
- async copyWorkspace(sourceWorkspaceId, destinationWorkspaceId) {
822
- return this.makePostRequest(`${this.baseApiUrl}/copy/organizations?source_workspace_id=${sourceWorkspaceId}&destination_workspace_id=${destinationWorkspaceId}`, {}, {
833
+ async copyWorkspace(sourceWorkspaceId, destinationWorkspaceId, includeDefaults, includedTests, excludedTests) {
834
+ return this.makePostRequest(`${this.baseApiUrl}/copy/organizations?source_workspace_id=${sourceWorkspaceId}&destination_workspace_id=${destinationWorkspaceId}&include_defaults=${includeDefaults}&included_tests=${includedTests.join(',')}&excluded_tests=${excludedTests.join(',')}`, {}, {
823
835
  timeout: 3600000,
824
836
  });
825
837
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMobileDeviceName = exports.CommandArgMobilePlatform = exports.CommandArgMobileAppFileId = exports.CommandArgMobileAppFile = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgKeepBrowserOpen = exports.CommandArgInput = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgHeadless = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFindPath = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgExistingReport = exports.CommandArgEnvironmentId = exports.CommandArgDetailLevel = exports.CommandArgDestination = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgDataTableId = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgBranch = exports.CommandArgApplicationId = exports.CommandArgApiKey = exports.CommandArgABConfigFile = void 0;
4
- exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgTimezoneID = exports.CommandArgLocale = exports.CommandArgUseTestExecutionProxy = exports.CommandArgScenarioId = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = void 0;
3
+ exports.CommandArgMobileAppFileId = exports.CommandArgMobileAppFile = exports.CommandArgiOSdMobileAppFileId = exports.CommandArgAndroidMobileAppFileId = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgKeepBrowserOpen = exports.CommandArgInput = exports.CommandArgIncludedTests = exports.CommandArgIncludeDefaults = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgHeadless = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFindPath = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgExistingReport = exports.CommandArgExcludedTests = exports.CommandArgEnvironmentId = exports.CommandArgDetailLevel = exports.CommandArgDestination = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgDataTableId = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgBranch = exports.CommandArgApplicationId = exports.CommandArgApiKey = exports.CommandArgABConfigFile = void 0;
4
+ exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgTimezoneID = exports.CommandArgLocale = exports.CommandArgUseTestExecutionProxy = exports.CommandArgScenarioId = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMobileDeviceName = exports.CommandArgMobilePlatform = void 0;
5
5
  const browserTypes_1 = require("./browserTypes");
6
6
  exports.CommandArgABConfigFile = 'ab-config-file';
7
7
  exports.CommandArgApiKey = 'api-key';
@@ -19,6 +19,7 @@ exports.CommandArgDescription = 'description';
19
19
  exports.CommandArgDestination = 'destination';
20
20
  exports.CommandArgDetailLevel = 'detail-level';
21
21
  exports.CommandArgEnvironmentId = 'environment-id';
22
+ exports.CommandArgExcludedTests = 'excluded-tests';
22
23
  exports.CommandArgExistingReport = 'existing-report';
23
24
  exports.CommandArgOverrideEnvironmentId = 'override-environment-id';
24
25
  exports.CommandArgFastFailure = 'fast-failure';
@@ -31,6 +32,8 @@ exports.CommandArgHelp = 'help';
31
32
  exports.CommandArgHttpHeaders = 'http-headers';
32
33
  exports.CommandArgUserAgent = 'user-agent';
33
34
  exports.CommandArgId = 'id';
35
+ exports.CommandArgIncludeDefaults = 'include-defaults';
36
+ exports.CommandArgIncludedTests = 'included-tests';
34
37
  exports.CommandArgInput = 'input';
35
38
  exports.CommandArgKeepBrowserOpen = 'keep-browser-open';
36
39
  exports.CommandArgTestFile = 'test-file';
@@ -46,6 +49,8 @@ exports.CommandArgMablAutoBranch = 'auto-branch';
46
49
  exports.CommandArgMablAutoLogin = 'auto-login';
47
50
  exports.CommandArgMablBranch = 'mabl-branch';
48
51
  exports.CommandArgMablBranchChangesOnly = 'branch-changes-only';
52
+ exports.CommandArgAndroidMobileAppFileId = 'android-app-file-id';
53
+ exports.CommandArgiOSdMobileAppFileId = 'ios-app-file-id';
49
54
  exports.CommandArgMobileAppFile = 'app-file';
50
55
  exports.CommandArgMobileAppFileId = 'app-file-id';
51
56
  exports.CommandArgMobilePlatform = 'platform';
@@ -100,6 +100,16 @@ exports.builder = (yargs) => {
100
100
  describe: 'API URL to to use for deployment',
101
101
  nargs: 1,
102
102
  type: 'string',
103
+ })
104
+ .option(constants_1.CommandArgAndroidMobileAppFileId, {
105
+ describe: 'Android mobile app file to use for deployment',
106
+ nargs: 1,
107
+ type: 'string',
108
+ })
109
+ .option(constants_1.CommandArgiOSdMobileAppFileId, {
110
+ describe: 'iOS mobile app file to use for deployment',
111
+ nargs: 1,
112
+ type: 'string',
103
113
  })
104
114
  .option(constants_1.CommandArgApiKey, {
105
115
  alias: constants_1.CommandArgAliases.ApiKey,
@@ -210,6 +220,14 @@ async function createDeployment(parsed) {
210
220
  process.exit(1);
211
221
  }
212
222
  }
223
+ const androidMobileAppFileId = parsed[constants_1.CommandArgAndroidMobileAppFileId];
224
+ if (!!androidMobileAppFileId) {
225
+ await apiClient.getMobileAppFile(androidMobileAppFileId);
226
+ }
227
+ const iOSMobileAppFileId = parsed[constants_1.CommandArgiOSdMobileAppFileId];
228
+ if (!!iOSMobileAppFileId) {
229
+ await apiClient.getMobileAppFile(iOSMobileAppFileId);
230
+ }
213
231
  const mablBranch = parsed['mabl-branch'];
214
232
  await (0, branches_1.checkBranchNameAndAutoBranchMaybe)(workspaceId, apiClient, mablBranch, parsed['auto-branch']);
215
233
  const snapshotFromBranch = parsed['snapshot-from'];
@@ -226,6 +244,8 @@ async function createDeployment(parsed) {
226
244
  uri: parsed.url,
227
245
  apiUrl: parsed.apiUrl,
228
246
  appUrl: parsed.appUrl,
247
+ androidMobileAppFileId,
248
+ iOSMobileAppFileId,
229
249
  mablBranch,
230
250
  runnerType,
231
251
  snapshotFromBranch,
@@ -25,6 +25,21 @@ exports.builder = (yargs) => {
25
25
  describe: 'The workspace the data will be copied into',
26
26
  required: true,
27
27
  nargs: 1,
28
+ })
29
+ .option(constants_1.CommandArgIncludeDefaults, {
30
+ describe: 'Include default tests and plans when copying',
31
+ default: false,
32
+ type: 'boolean',
33
+ })
34
+ .option(constants_1.CommandArgIncludedTests, {
35
+ describe: 'List of test ids to include with the copy. If empty, all tests will be copied.',
36
+ default: [],
37
+ type: 'array',
38
+ })
39
+ .option(constants_1.CommandArgExcludedTests, {
40
+ describe: 'List of test ids to exclude from the copy. If a test is in both the include and exclude list, it will be excluded.',
41
+ default: [],
42
+ type: 'array',
28
43
  });
29
44
  };
30
45
  exports.handler = (0, util_1.failWrapper)(copyWorkspace);
@@ -47,6 +62,9 @@ async function copyWorkspace(parsed) {
47
62
  try {
48
63
  const sourceWorkspaceId = parsed.from;
49
64
  const destinationWorkspaceId = parsed.to;
65
+ const includeDefaults = parsed.includeDefaults;
66
+ const includedTests = parsed.includedTests;
67
+ const excludedTests = parsed.excludedTests;
50
68
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
51
69
  const [sourceWorkspace, destinationWorkspace] = await Promise.all([
52
70
  apiClient.getWorkspace(sourceWorkspaceId),
@@ -59,11 +77,14 @@ async function copyWorkspace(parsed) {
59
77
  }
60
78
  loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] In case of failure, please DO NOT re-run this command, as it would create duplicate items in the destination. The operation may take several minutes, or longer for especially large workspaces. Please contact mabl support if you encounter any issues.`));
61
79
  loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] Note: currently the copy includes tests, flows, datatables, file uploads, javascript snippets. Unsupported items include: plans, applications, environments, coverage, and run history.`));
80
+ const excludedTestsConfirmationDetail = !includeDefaults || (excludedTests === null || excludedTests === void 0 ? void 0 : excludedTests.length)
81
+ ? ' excluding default tests and all tests specified with --exclude-tests '
82
+ : '';
62
83
  const response = await inquirer_1.default.prompt([
63
84
  {
64
85
  type: 'confirm',
65
86
  name: 'do_continue',
66
- message: `Are you sure you want to copy ALL tests from Workspace [${sourceWorkspaceId}](${sourceWorkspace.name}) to Workspace [${destinationWorkspaceId}](${destinationWorkspace.name})? Once the copy begins, it cannot be cancelled.`,
87
+ message: `Are you sure you want to copy ALL tests${excludedTestsConfirmationDetail} from Workspace [${sourceWorkspaceId}](${sourceWorkspace.name}) to Workspace [${destinationWorkspaceId}](${destinationWorkspace.name})? Once the copy begins, it cannot be cancelled.`,
67
88
  default: false,
68
89
  },
69
90
  ]);
@@ -72,7 +93,7 @@ async function copyWorkspace(parsed) {
72
93
  }
73
94
  loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] The copy process will complete even if this command is interrupted.`));
74
95
  spinner.start();
75
- await apiClient.copyWorkspace(sourceWorkspaceId, destinationWorkspaceId);
96
+ await apiClient.copyWorkspace(sourceWorkspaceId, destinationWorkspaceId, includeDefaults, includedTests, excludedTests);
76
97
  spinner.succeed('Done copying assets');
77
98
  loggingProvider_1.logger.info(chalk_1.default.green(`[${getTimestamp()}] Workspace copy successful`));
78
99
  return 'Success';