@mablhq/mabl-cli 2.12.13 → 2.12.22
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/api/mablApiClient.js +2 -2
- package/commands/constants.js +5 -2
- package/commands/workspaces/workspace_cmds/copy.js +23 -2
- package/execution/index.js +2 -2
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +2 -0
- package/mablscript/mobile/steps/OpenLinkStep.js +19 -0
- package/mablscript/mobile/tests/steps/OpenLinkStep.mobiletest.js +20 -0
- package/mablscript/types/mobile/OpenLinkStepDescriptor.js +2 -0
- package/package.json +1 -1
- package/upload/index.js +1 -1
- package/util/downloadUtil.js +3 -2
package/api/mablApiClient.js
CHANGED
|
@@ -830,8 +830,8 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
830
830
|
throw toApiError(`Failed to terminate journey run ${journeyRunId}`, error);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
async copyWorkspace(sourceWorkspaceId, destinationWorkspaceId) {
|
|
834
|
-
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(',')}`, {}, {
|
|
835
835
|
timeout: 3600000,
|
|
836
836
|
});
|
|
837
837
|
}
|
package/commands/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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 = 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';
|
|
@@ -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 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';
|