@mablhq/mabl-cli 2.37.7 → 2.41.1

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.
@@ -118,6 +118,14 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
118
118
  throw toApiError(`Failed to create deployment`, error);
119
119
  }
120
120
  }
121
+ async updateDeployment(id, deployment) {
122
+ try {
123
+ return await this.makePatchRequest(`${this.baseApiUrl}/deployments/${id}`, deployment);
124
+ }
125
+ catch (error) {
126
+ throw toApiError(`Failed to update environment`, error);
127
+ }
128
+ }
121
129
  async selectLinkServer(workspaceId, label) {
122
130
  try {
123
131
  const queryParams = query_string_1.default.stringify({
@@ -139,6 +139,10 @@ class ChromiumBrowserEngine {
139
139
  plugins: {
140
140
  always_open_pdf_externally: true,
141
141
  },
142
+ safebrowsing: {
143
+ enabled: false,
144
+ enhanced: false,
145
+ },
142
146
  };
143
147
  if (windowPlacement) {
144
148
  preferences.browser = {
package/cli.js CHANGED
@@ -39,7 +39,6 @@ const hasInternalDirectory = fs_1.default.existsSync(path_1.default.resolve(__di
39
39
  const excludeInternal = !hasInternalDirectory ? { exclude: /.*/gm } : undefined;
40
40
  yargs
41
41
  .scriptName(env_1.SCRIPT_NAME)
42
- .commandDir('./commands/app-files')
43
42
  .commandDir('./commands/applications')
44
43
  .commandDir('./commands/auth')
45
44
  .commandDir('./commands/branches')
@@ -51,6 +50,7 @@ yargs
51
50
  .commandDir('./commands/flows')
52
51
  .commandDir('./commands/internal', excludeInternal)
53
52
  .commandDir('./commands/link-agents')
53
+ .commandDir('./commands/mobile-build-files')
54
54
  .commandDir('./commands/plans')
55
55
  .commandDir('./commands/tests')
56
56
  .commandDir('./commands/test-runs')
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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.CommandArgGrep = exports.CommandArgExtraArguments = exports.CommandArgExistingReport = exports.CommandArgExcludedTests = exports.CommandArgEnvironmentId = exports.CommandArgDetailLevel = exports.CommandArgDestination = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDebug = exports.CommandArgDataTables = exports.CommandArgDataTableId = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgBranch = exports.CommandArgAuto = exports.CommandArgApplicationId = exports.CommandArgApiKey = exports.CommandArgABConfigFile = void 0;
4
- 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.CommandArgTo = exports.CommandArgTrainerVersion = exports.CommandArgTraceFile = exports.CommandArgTracesPath = exports.CommandArgTestPath = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgRecordVideoPath = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgPath = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgProject = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMobileDeviceName = exports.CommandArgMobilePlatform = exports.CommandArgMobileAppFileId = exports.CommandArgMobileAppFile = exports.CommandArgiOSdMobileAppFileId = exports.CommandArgAndroidMobileAppFileId = exports.CommandArgMulti = void 0;
4
+ 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.CommandArgTo = exports.CommandArgTrainerVersion = exports.CommandArgTraceFile = exports.CommandArgTracesPath = exports.CommandArgTestPath = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgRecordVideoPath = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgPath = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgProject = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMobileDeviceName = exports.CommandArgMobilePlatform = exports.CommandArgMobileBuildFileId = exports.CommandArgMobileBuildFilePath = exports.CommandArgiOSdMobileAppFileId = exports.CommandArgAndroidMobileAppFileId = exports.CommandArgMulti = void 0;
5
5
  exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = void 0;
6
6
  const browserTypes_1 = require("./browserTypes");
7
7
  exports.CommandArgABConfigFile = 'ab-config-file';
@@ -57,8 +57,8 @@ exports.CommandArgMablBranchChangesOnly = 'branch-changes-only';
57
57
  exports.CommandArgMulti = 'multi';
58
58
  exports.CommandArgAndroidMobileAppFileId = 'android-app-file-id';
59
59
  exports.CommandArgiOSdMobileAppFileId = 'ios-app-file-id';
60
- exports.CommandArgMobileAppFile = 'app-file';
61
- exports.CommandArgMobileAppFileId = 'app-file-id';
60
+ exports.CommandArgMobileBuildFilePath = 'build-file-path';
61
+ exports.CommandArgMobileBuildFileId = 'build-file-id';
62
62
  exports.CommandArgMobilePlatform = 'platform';
63
63
  exports.CommandArgMobileDeviceName = 'device';
64
64
  exports.CommandArgName = 'name';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'build-files <command>';
4
+ exports.describe = 'Manage your environment build files';
5
+ exports.builder = (yargs) => yargs.commandDir('build-files_cmds').demandCommand();
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createDeploymentForBuildFile = exports.addEnvironmentBuildFilesOptions = void 0;
7
+ const constants_1 = require("../../../constants");
8
+ const util_1 = require("../../../commandUtil/util");
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const loggingProvider_1 = require("../../../../providers/logging/loggingProvider");
11
+ const mablApi_1 = require("../../../../mablApi");
12
+ const mablApiClientFactory_1 = require("../../../../api/mablApiClientFactory");
13
+ exports.command = `add <${constants_1.CommandArgId}>`;
14
+ exports.describe = 'Associate mobile build file with an environment';
15
+ exports.builder = (yargs) => {
16
+ addEnvironmentBuildFilesOptions(yargs)
17
+ .positional(constants_1.CommandArgId, {
18
+ describe: 'ID of environment to add mobile build file associations to',
19
+ type: 'string',
20
+ })
21
+ .demandOption(constants_1.CommandArgApplicationId)
22
+ .demandOption(constants_1.CommandArgMobileBuildFileId);
23
+ };
24
+ exports.handler = (0, util_1.failWrapper)(createDeployment);
25
+ function addEnvironmentBuildFilesOptions(yargs) {
26
+ return yargs
27
+ .option(constants_1.CommandArgApplicationId, {
28
+ describe: 'ID of application to associate with this environment',
29
+ nargs: 1,
30
+ type: 'string',
31
+ })
32
+ .option(constants_1.CommandArgMobileBuildFileId, {
33
+ describe: 'mobile build file ID to associate with the application-environment pair',
34
+ nargs: 1,
35
+ type: 'string',
36
+ });
37
+ }
38
+ exports.addEnvironmentBuildFilesOptions = addEnvironmentBuildFilesOptions;
39
+ async function createDeployment(parsed) {
40
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
41
+ const applicationId = parsed[constants_1.CommandArgApplicationId];
42
+ const environmentId = parsed[constants_1.CommandArgId];
43
+ const buildFileId = parsed[constants_1.CommandArgMobileBuildFileId];
44
+ try {
45
+ await apiClient.getApplication(applicationId);
46
+ await apiClient.getMobileAppFile(buildFileId);
47
+ const environment = await apiClient.getEnvironment(environmentId);
48
+ await createDeploymentForBuildFile(apiClient, environment, applicationId, buildFileId);
49
+ return 'done';
50
+ }
51
+ catch (error) {
52
+ throw new Error(`Error adding build file for environment ${parsed.id}: ${error}`);
53
+ }
54
+ }
55
+ async function createDeploymentForBuildFile(apiClient, environment, applicationId, buildFileId) {
56
+ try {
57
+ const deployment = {
58
+ organization_id: environment.organization_id,
59
+ environment_id: environment.id,
60
+ application_id: applicationId,
61
+ mobile_app_file_id: buildFileId,
62
+ deployment_type: mablApi_1.Deployment.DeploymentTypeEnum.MobileApplication,
63
+ };
64
+ await apiClient.createDeployment(deployment);
65
+ loggingProvider_1.logger.info(chalk_1.default.white(`Associated ${buildFileId} with environment ${environment.id} and application ${applicationId}`));
66
+ }
67
+ catch (error) {
68
+ loggingProvider_1.logger.error(error);
69
+ const reRunCommandString = `mabl environments build-files add ${environment.id} --applicationId ${applicationId} --build-file-id ${buildFileId}`;
70
+ loggingProvider_1.logger.info(chalk_1.default.white(`Associating build file with environment failed. You can reattempt this association by running ${chalk_1.default.bold(reRunCommandString)}`));
71
+ }
72
+ }
73
+ exports.createDeploymentForBuildFile = createDeploymentForBuildFile;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const interfaces_1 = require("../../../commandUtil/interfaces");
4
+ const constants_1 = require("../../../constants");
5
+ const util_1 = require("../../../commandUtil/util");
6
+ const mablApiClientFactory_1 = require("../../../../api/mablApiClientFactory");
7
+ const describe_1 = require("../../../commandUtil/describe");
8
+ exports.command = `list <${constants_1.CommandArgId}>`;
9
+ exports.describe = 'Show build files associated with an environment';
10
+ exports.builder = (yargs) => {
11
+ yargs
12
+ .positional(constants_1.CommandArgId, {
13
+ describe: 'Environment ID to list build file associations for',
14
+ type: 'string',
15
+ })
16
+ .option(constants_1.CommandArgApplicationId, {
17
+ describe: 'Application ID to filter build files by',
18
+ alias: constants_1.CommandArgAliases.ApplicationId,
19
+ nargs: 1,
20
+ type: 'string',
21
+ })
22
+ .option(constants_1.CommandArgLimitOutput, {
23
+ alias: constants_1.CommandArgAliases.LimitOutput,
24
+ describe: `The number of build files to return'`,
25
+ default: interfaces_1.DEFAULT_LISTING_RESULT_LIMIT,
26
+ nargs: 1,
27
+ type: 'string',
28
+ })
29
+ .option(constants_1.CommandArgOutput, {
30
+ alias: constants_1.CommandArgAliases.OutputType,
31
+ choices: constants_1.DefaultOutputFormatChoices,
32
+ describe: 'Specify result output format',
33
+ nargs: 1,
34
+ });
35
+ };
36
+ exports.handler = (0, util_1.failWrapper)(queryDeployments);
37
+ async function queryDeployments(parsed) {
38
+ var _a, _b, _c;
39
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
40
+ try {
41
+ const environment = await apiClient.getEnvironment(parsed.id);
42
+ const deploymentEntities = await apiClient.queryDeploymentEntities((_a = environment.organization_id) !== null && _a !== void 0 ? _a : '', environment.id, parsed[constants_1.CommandArgApplicationId], parsed.limit);
43
+ const mobileDeployments = (_c = (_b = deploymentEntities.deployments) === null || _b === void 0 ? void 0 : _b.filter((deployment) => !!deployment.mobile_app_file_id)) !== null && _c !== void 0 ? _c : [];
44
+ const mobileBuildFiles = await Promise.all(mobileDeployments.map((deployment) => apiClient.getMobileAppFile(deployment.mobile_app_file_id)));
45
+ (0, describe_1.outputEntity)(mobileDeployments.map((deployment, index) => ({
46
+ ...deployment,
47
+ mobile_app_file: mobileBuildFiles[index],
48
+ })), parsed.output);
49
+ }
50
+ catch (error) {
51
+ throw new Error(`Error listing build files for environment ${parsed.id}: ${error}`);
52
+ }
53
+ return 'done';
54
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateDeploymentForBuildFile = void 0;
7
+ const constants_1 = require("../../../constants");
8
+ const util_1 = require("../../../commandUtil/util");
9
+ const add_1 = require("./add");
10
+ const mablApiClientFactory_1 = require("../../../../api/mablApiClientFactory");
11
+ const mablApi_1 = require("../../../../mablApi");
12
+ const loggingProvider_1 = require("../../../../providers/logging/loggingProvider");
13
+ const chalk_1 = __importDefault(require("chalk"));
14
+ exports.command = `update <${constants_1.CommandArgId}>`;
15
+ exports.describe =
16
+ 'Update mobile build file associated with an environment or add new association';
17
+ exports.builder = (yargs) => {
18
+ (0, add_1.addEnvironmentBuildFilesOptions)(yargs)
19
+ .positional(constants_1.CommandArgId, {
20
+ describe: 'ID of environment to update mobile build file association',
21
+ type: 'string',
22
+ })
23
+ .demandOption(constants_1.CommandArgApplicationId)
24
+ .demandOption(constants_1.CommandArgMobileBuildFileId);
25
+ };
26
+ exports.handler = (0, util_1.failWrapper)(updateOrCreateDeployment);
27
+ async function updateOrCreateDeployment(parsed) {
28
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
29
+ const applicationId = parsed[constants_1.CommandArgApplicationId];
30
+ const environmentId = parsed[constants_1.CommandArgId];
31
+ const buildFileId = parsed[constants_1.CommandArgMobileBuildFileId];
32
+ try {
33
+ await apiClient.getApplication(applicationId);
34
+ const buildFile = await apiClient.getMobileAppFile(buildFileId);
35
+ const environment = await apiClient.getEnvironment(environmentId);
36
+ await updateDeploymentForBuildFile(apiClient, environment, applicationId, buildFile);
37
+ return 'done';
38
+ }
39
+ catch (error) {
40
+ throw new Error(`Error updating build file for environment ${parsed.id}: ${error}`);
41
+ }
42
+ }
43
+ async function updateDeploymentForBuildFile(apiClient, environment, applicationId, newBuildFile) {
44
+ var _a, _b, _c, _d;
45
+ const deploymentEntities = await apiClient.queryDeploymentEntities((_a = environment.organization_id) !== null && _a !== void 0 ? _a : '', environment.id, applicationId, 1000);
46
+ const candidatesForUpdate = (_d = (_c = (_b = deploymentEntities === null || deploymentEntities === void 0 ? void 0 : deploymentEntities.deployments) === null || _b === void 0 ? void 0 : _b.filter((deployment) => !!deployment.mobile_app_file_id)) === null || _c === void 0 ? void 0 : _c.filter(async (deployment) => {
47
+ const buildFile = await apiClient.getMobileAppFile(deployment.mobile_app_file_id);
48
+ return (deployment.deployment_type ===
49
+ mablApi_1.Deployment.DeploymentTypeEnum.MobileApplication &&
50
+ buildFile.platform === newBuildFile.platform);
51
+ })) !== null && _d !== void 0 ? _d : [];
52
+ if ((candidatesForUpdate === null || candidatesForUpdate === void 0 ? void 0 : candidatesForUpdate.length) === 0) {
53
+ await (0, add_1.createDeploymentForBuildFile)(apiClient, environment, applicationId, newBuildFile.id);
54
+ return;
55
+ }
56
+ else if ((candidatesForUpdate === null || candidatesForUpdate === void 0 ? void 0 : candidatesForUpdate.length) > 1) {
57
+ throw new Error('Multiple deployments with the same mobile platform found. Please remove duplicates or use mabl UI to change the build file association.');
58
+ }
59
+ try {
60
+ const existingDeployment = candidatesForUpdate[0];
61
+ existingDeployment.mobile_app_file_id = newBuildFile.id;
62
+ await apiClient.updateDeployment(existingDeployment.id, existingDeployment);
63
+ loggingProvider_1.logger.info(chalk_1.default.white(`Updated ${newBuildFile.platform} build file associated with environment ${environment.id} and application ${applicationId} to ${newBuildFile.id} `));
64
+ }
65
+ catch (error) {
66
+ loggingProvider_1.logger.error(error);
67
+ const reRunCommandString = `mabl environments build-files update ${environment.id} --applicationId ${applicationId} --build-file-id ${newBuildFile.id}`;
68
+ loggingProvider_1.logger.info(chalk_1.default.white(`Associating build file with environment failed. You can reattempt this association by running ${chalk_1.default.bold(reRunCommandString)}`));
69
+ }
70
+ }
71
+ exports.updateDeploymentForBuildFile = updateDeploymentForBuildFile;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = ['mobile-build-files <command>', 'app-files <command>'];
4
+ exports.describe = 'Manage your mobile build files';
5
+ exports.builder = (yargs) => yargs.commandDir('mobile-build-files_cmds').demandCommand();
@@ -9,10 +9,10 @@ const util_1 = require("../../commandUtil/util");
9
9
  const chalk_1 = __importDefault(require("chalk"));
10
10
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
11
11
  exports.command = `delete <${constants_1.CommandArgId}>`;
12
- exports.describe = 'Delete a mobile app file.';
12
+ exports.describe = 'Delete a mobile build file.';
13
13
  exports.builder = (yargs) => {
14
14
  yargs.positional(constants_1.CommandArgId, {
15
- describe: 'id of the mobile app file',
15
+ describe: 'ID of the mobile build file',
16
16
  type: 'string',
17
17
  });
18
18
  };
@@ -22,10 +22,10 @@ async function deleteMobileAppFile(parsed) {
22
22
  const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
23
23
  const id = parsed[constants_1.CommandArgId];
24
24
  await apiClient.deleteMobileAppFile(id);
25
- loggingProvider_1.logger.info(chalk_1.default.green(`Mobile app file ${chalk_1.default.bold(id)} DELETED`));
25
+ loggingProvider_1.logger.info(chalk_1.default.green(`Mobile build file ${chalk_1.default.bold(id)} DELETED`));
26
26
  return id;
27
27
  }
28
28
  catch (error) {
29
- throw new Error(`Error deleting mobile app file: ${error}`);
29
+ throw new Error(`Error deleting mobile build file: ${error}`);
30
30
  }
31
31
  }
@@ -11,15 +11,15 @@ const util_1 = require("../../commandUtil/util");
11
11
  const MobileAppFileCache_1 = require("../../../util/MobileAppFileCache");
12
12
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
13
13
  exports.command = `download <${constants_1.CommandArgId}> <${constants_1.CommandArgDestination}>`;
14
- exports.describe = 'Download a mobile app file.';
14
+ exports.describe = 'Download a mobile build file.';
15
15
  exports.builder = (yargs) => {
16
16
  yargs
17
17
  .positional(constants_1.CommandArgId, {
18
- describe: 'id of the mobile app file',
18
+ describe: 'ID of the mobile build file',
19
19
  type: 'string',
20
20
  })
21
21
  .positional(constants_1.CommandArgDestination, {
22
- describe: 'Relative path to destionation directory or file',
22
+ describe: 'Relative path to destination directory or file',
23
23
  type: 'string',
24
24
  });
25
25
  };
@@ -31,10 +31,10 @@ async function downloadMobileAppFile(parsed) {
31
31
  const mobileAppFile = await new MobileAppFileCache_1.MobileAppFileCache().getMobileAppFile(id);
32
32
  const downloadPath = await resolveDestination(destination, mobileAppFile);
33
33
  await (0, promises_1.copyFile)(mobileAppFile.path, downloadPath);
34
- loggingProvider_1.logger.info(chalk_1.default.green(`Mobile app file downloaded to ${downloadPath}`));
34
+ loggingProvider_1.logger.info(chalk_1.default.green(`Mobile build file downloaded to ${downloadPath}`));
35
35
  }
36
36
  catch (error) {
37
- throw new Error(`Error downloading mobile app file: ${error}`);
37
+ throw new Error(`Error downloading mobile build file: ${error}`);
38
38
  }
39
39
  }
40
40
  async function resolveDestination(destination, mobileAppFile) {
@@ -12,8 +12,8 @@ const list_1 = require("../../commandUtil/list");
12
12
  const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
13
13
  const constants_1 = require("../../constants");
14
14
  exports.command = 'list';
15
- exports.describe = 'List your mobile app files';
16
- exports.builder = (0, list_1.getListBuilderOptions)('mobile app files');
15
+ exports.describe = 'List your mobile build files';
16
+ exports.builder = (0, list_1.getListBuilderOptions)('mobile build files');
17
17
  exports.handler = (0, util_1.failWrapper)(listMobileAppFiles);
18
18
  async function listMobileAppFiles(parsed) {
19
19
  const output = parsed.output;
@@ -15,20 +15,22 @@ const upload_1 = require("../../../upload");
15
15
  const env_1 = require("../../../env/env");
16
16
  const authenticationProvider_1 = require("../../../providers/authenticationProvider");
17
17
  const types_1 = require("../../../api/types");
18
- exports.command = `create <${constants_1.CommandArgMobileAppFile}>`;
19
- exports.describe = 'Upload and create a new mobile app file';
18
+ exports.command = [
19
+ `upload <${constants_1.CommandArgMobileBuildFilePath}>`,
20
+ `create <${constants_1.CommandArgMobileBuildFilePath}>`,
21
+ ];
22
+ exports.describe = 'Upload a new mobile build file';
20
23
  exports.builder = (yargs) => {
21
24
  yargs
22
- .positional(constants_1.CommandArgMobileAppFile, {
23
- alias: constants_1.CommandArgAliases.File,
24
- describe: 'Relative path to mobile app file',
25
+ .positional(constants_1.CommandArgMobileBuildFilePath, {
26
+ describe: 'Relative path to mobile build file file',
25
27
  })
26
28
  .option(constants_1.CommandArgBranch, {
27
- describe: 'Branch from which this mobile app file was built',
29
+ describe: 'Branch from which this mobile build file was built',
28
30
  type: 'string',
29
31
  })
30
32
  .option(constants_1.CommandArgLabels, {
31
- describe: 'Space delimited labels to save test with',
33
+ describe: 'Space delimited labels to save the file with',
32
34
  type: 'array',
33
35
  })
34
36
  .option(constants_1.CommandArgMobilePlatform, {
@@ -42,19 +44,19 @@ exports.builder = (yargs) => {
42
44
  })
43
45
  .version(false)
44
46
  .option(constants_1.CommandArgVersion, {
45
- describe: 'Version of this mobile app file',
47
+ describe: 'Version of this mobile build file',
46
48
  type: 'string',
47
49
  })
48
50
  .option(constants_1.CommandArgWorkspaceId, {
49
51
  alias: constants_1.CommandArgAliases.WorkspaceId,
50
- describe: `Workspace to create mobile app file in`,
52
+ describe: `Workspace to create mobile build file in`,
51
53
  type: 'string',
52
54
  });
53
55
  };
54
56
  exports.handler = (0, util_1.failWrapper)(createMobileAppFile);
55
57
  async function createMobileAppFile(parsed) {
56
58
  const { branch, labels, platform, version } = parsed;
57
- const file = parsed[constants_1.CommandArgMobileAppFile];
59
+ const file = parsed[constants_1.CommandArgMobileBuildFilePath];
58
60
  const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
59
61
  const mobileAppFilePrototype = {
60
62
  branch,
@@ -47,11 +47,12 @@ exports.builder = (yargs) => {
47
47
  describe: 'The id of the test to run',
48
48
  type: 'string',
49
49
  })
50
- .option(constants_1.CommandArgMobileAppFile, {
50
+ .option(constants_1.CommandArgMobileBuildFilePath, {
51
+ alias: 'app-file',
51
52
  describe: 'The path to the mobile application binary',
52
53
  type: 'string',
53
54
  })
54
- .option(constants_1.CommandArgMobileAppFileId, {
55
+ .option(constants_1.CommandArgMobileBuildFileId, {
55
56
  describe: 'The ID of a previously uploaded mobile app file',
56
57
  type: 'string',
57
58
  })
@@ -117,7 +118,7 @@ exports.builder = (yargs) => {
117
118
  .middleware(inferMobilePlatform)
118
119
  .check((argv) => {
119
120
  (0, testsUtil_1.validateRunCommandWithLabels)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, undefined);
120
- validateMobileCommand(argv[constants_1.CommandArgMobileAppFile], argv[constants_1.CommandArgMobileAppFileId]);
121
+ validateMobileCommand(argv[constants_1.CommandArgMobileBuildFilePath], argv[constants_1.CommandArgMobileBuildFileId]);
121
122
  return true;
122
123
  });
123
124
  };
@@ -125,7 +126,7 @@ const exitCodeOnError = 1;
125
126
  exports.handler = (0, util_1.failWrapper)(run, exitCodeOnError);
126
127
  function validateMobileCommand(appFile, appFileId) {
127
128
  if (appFile && appFileId) {
128
- throw new Error(`Only one of { --${constants_1.CommandArgMobileAppFile}, --${constants_1.CommandArgMobileAppFileId} } may be specified`);
129
+ throw new Error(`Only one of { --${constants_1.CommandArgMobileBuildFilePath}, --${constants_1.CommandArgMobileBuildFileId} } may be specified`);
129
130
  }
130
131
  }
131
132
  async function run(parsed) {
@@ -163,8 +164,8 @@ async function run(parsed) {
163
164
  testId: parsed.id,
164
165
  workspaceId,
165
166
  mobileConfig: {
166
- mobileAppFileId: parsed[constants_1.CommandArgMobileAppFileId],
167
- path: parsed[constants_1.CommandArgMobileAppFile],
167
+ mobileAppFileId: parsed[constants_1.CommandArgMobileBuildFileId],
168
+ path: parsed[constants_1.CommandArgMobileBuildFilePath],
168
169
  platformName,
169
170
  avdName: parsed[constants_1.CommandArgMobileDeviceName],
170
171
  recordVideoPath: parsed[constants_1.CommandArgRecordVideoPath],
@@ -230,20 +231,20 @@ async function validateSystemRequirements(platform, deviceName) {
230
231
  }
231
232
  }
232
233
  async function inferMobilePlatform(argv) {
233
- if (!argv[constants_1.CommandArgMobilePlatform] && argv[constants_1.CommandArgMobileAppFileId]) {
234
- if (argv[constants_1.CommandArgMobileAppFileId]) {
234
+ if (!argv[constants_1.CommandArgMobilePlatform] && argv[constants_1.CommandArgMobileBuildFileId]) {
235
+ if (argv[constants_1.CommandArgMobileBuildFileId]) {
235
236
  try {
236
- const { platform } = await new MobileAppFileCache_1.MobileAppFileCache().getMobileAppFileImmutableFields(argv[constants_1.CommandArgMobileAppFileId]);
237
+ const { platform } = await new MobileAppFileCache_1.MobileAppFileCache().getMobileAppFileImmutableFields(argv[constants_1.CommandArgMobileBuildFileId]);
237
238
  if (platform) {
238
239
  argv[constants_1.CommandArgMobilePlatform] = platform.toString().toLowerCase();
239
240
  return;
240
241
  }
241
242
  }
242
243
  catch (error) {
243
- loggingProvider_1.logger.warn(chalk.yellow(`Warning: Unable to fetch mobile app file ${argv[constants_1.CommandArgMobileAppFile]}: ${error}`));
244
+ loggingProvider_1.logger.warn(chalk.yellow(`Warning: Unable to fetch mobile app file ${argv[constants_1.CommandArgMobileBuildFilePath]}: ${error}`));
244
245
  }
245
246
  }
246
- const extension = (0, path_1.extname)(argv[constants_1.CommandArgMobileAppFile]).toLowerCase();
247
+ const extension = (0, path_1.extname)(argv[constants_1.CommandArgMobileBuildFilePath]).toLowerCase();
247
248
  switch (extension) {
248
249
  case '.apk':
249
250
  argv[constants_1.CommandArgMobilePlatform] = mablApi_1.MobilePlatformEnum.Android;
@@ -884,7 +884,10 @@ function convertMablSnippetsToExecArray(event, getSnippetFromInvariantId) {
884
884
  ? getSnippetFromInvariantId(apiTestSnippet.invariantId)
885
885
  : apiTestSnippet;
886
886
  if (!(snippet === null || snippet === void 0 ? void 0 : snippet.body)) {
887
- console.warn(`Unable to find reusable snippet with invariant ID ${apiTestSnippet.invariantId}`);
887
+ if (apiTestSnippet.reusable) {
888
+ console.warn(`Unable to find reusable snippet with invariant ID ${apiTestSnippet.invariantId}`);
889
+ return `// Missing snippet ${apiTestSnippet.invariantId}`;
890
+ }
888
891
  return '';
889
892
  }
890
893
  const body = (0, encodingUtil_1.b64DecodeUnicodeNodeOrBrowser)(snippet.body);
@@ -892,16 +895,18 @@ function convertMablSnippetsToExecArray(event, getSnippetFromInvariantId) {
892
895
  createCommentForApiTestSnippet(snippet, 'start'),
893
896
  body,
894
897
  createCommentForApiTestSnippet(snippet, 'end'),
898
+ '',
895
899
  ].join('\n');
896
900
  });
897
901
  return snippetBodies.flatMap((body) => body.split('\n'));
898
902
  }
899
903
  exports.convertMablSnippetsToExecArray = convertMablSnippetsToExecArray;
900
904
  function createCommentForApiTestSnippet(snippet, position) {
905
+ var _a, _b;
901
906
  if (snippet.reusable) {
902
- return `// ${position} of reusable snippet "${snippet.name}"`;
907
+ return `// ${position} of reusable snippet "${(_a = snippet.name) !== null && _a !== void 0 ? _a : snippet.id}"`;
903
908
  }
904
- return `// ${position} of one-time sinppet "${snippet.name}"`;
909
+ return `// ${position} of one-time snippet "${(_b = snippet.name) !== null && _b !== void 0 ? _b : snippet.id}"`;
905
910
  }
906
911
  exports.createCommentForApiTestSnippet = createCommentForApiTestSnippet;
907
912
  const uuid = () => (0, uuid_1.v4)();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.createAssertFailureMessage = exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ObservationErrorSeverity = exports.ObservationErrorCode = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
4
+ exports.createAssertResultMessage = exports.createAssertFailureMessage = exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ObservationErrorSeverity = exports.ObservationErrorCode = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
5
5
  const events_1 = require("events");
6
6
  const loggingProvider_1 = require("../../providers/logging/loggingProvider");
7
7
  const pureUtil_1 = require("../../util/pureUtil");
@@ -104,9 +104,10 @@ function getDefaultLogMetadataForInfo(testId, testInvariantId) {
104
104
  exports.getDefaultLogMetadataForInfo = getDefaultLogMetadataForInfo;
105
105
  function createAssertFailureMessage(assertFailure) {
106
106
  if (assertFailure) {
107
- const { reason, expected, found, onFailure } = assertFailure;
107
+ const { reason, expected, found, onFailure, shortReason } = assertFailure;
108
108
  return {
109
109
  reason,
110
+ shortReason,
110
111
  expected: (0, pureUtil_1.stringifyIfPresent)(expected),
111
112
  found: (0, pureUtil_1.stringifyIfPresent)(found),
112
113
  onFailure,
@@ -115,3 +116,14 @@ function createAssertFailureMessage(assertFailure) {
115
116
  return;
116
117
  }
117
118
  exports.createAssertFailureMessage = createAssertFailureMessage;
119
+ function createAssertResultMessage(assertResult) {
120
+ if (assertResult) {
121
+ const { success } = assertResult;
122
+ return {
123
+ success,
124
+ ...createAssertFailureMessage(assertResult),
125
+ };
126
+ }
127
+ return;
128
+ }
129
+ exports.createAssertResultMessage = createAssertResultMessage;