@lambdatest/smartui-cli 4.0.13 → 4.0.14-rc.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 (2) hide show
  1. package/dist/index.cjs +40 -9
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -682,6 +682,17 @@ var SnapshotSchema = {
682
682
  }
683
683
  }
684
684
  },
685
+ ignoreType: {
686
+ type: "array",
687
+ items: {
688
+ type: "string",
689
+ minLength: 1,
690
+ enum: ["default", "layout", "images", "text", "colors", "dimensions", "position", "structure"],
691
+ errorMessage: "Invalid snapshot options;ignoreType cannot be empty"
692
+ },
693
+ uniqueItems: true,
694
+ errorMessage: "Invalid snapshot options; ignoreType must be an array of unique values from default, layout, images, text, colors, dimensions, position, structure"
695
+ },
685
696
  web: {
686
697
  type: "object",
687
698
  properties: {
@@ -967,7 +978,7 @@ var auth_default = (ctx) => {
967
978
  };
968
979
 
969
980
  // package.json
970
- var version = "4.0.13";
981
+ var version = "4.0.14-rc.0";
971
982
  var package_default = {
972
983
  name: "@lambdatest/smartui-cli",
973
984
  version,
@@ -1085,13 +1096,14 @@ var httpClient = class {
1085
1096
  }
1086
1097
  });
1087
1098
  }
1088
- createBuild(git, config, log2) {
1099
+ createBuild(git, config, log2, buildName) {
1089
1100
  return this.request({
1090
1101
  url: "/build",
1091
1102
  method: "POST",
1092
1103
  data: {
1093
1104
  git,
1094
- config
1105
+ config,
1106
+ buildName
1095
1107
  }
1096
1108
  }, log2);
1097
1109
  }
@@ -1227,6 +1239,7 @@ var ctx_default = (options) => {
1227
1239
  let parallelObj;
1228
1240
  let fetchResultObj;
1229
1241
  let fetchResultsFileObj;
1242
+ let buildNameObj;
1230
1243
  try {
1231
1244
  if (options.config) {
1232
1245
  config = JSON.parse(fs5__default.default.readFileSync(options.config, "utf-8"));
@@ -1258,6 +1271,7 @@ var ctx_default = (options) => {
1258
1271
  fetchResultObj = false;
1259
1272
  fetchResultsFileObj = "";
1260
1273
  }
1274
+ buildNameObj = options.buildName || "";
1261
1275
  } catch (error) {
1262
1276
  console.log(`[smartui] Error: ${error.message}`);
1263
1277
  process.exit();
@@ -1305,7 +1319,7 @@ var ctx_default = (options) => {
1305
1319
  },
1306
1320
  build: {
1307
1321
  id: "",
1308
- name: "",
1322
+ name: buildNameObj,
1309
1323
  baseline: false,
1310
1324
  url: ""
1311
1325
  },
@@ -1405,7 +1419,7 @@ var createBuild_default = (ctx) => {
1405
1419
  task: (ctx2, task) => __async(void 0, null, function* () {
1406
1420
  updateLogContext({ task: "createBuild" });
1407
1421
  try {
1408
- let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log);
1422
+ let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name);
1409
1423
  ctx2.build = {
1410
1424
  id: resp.data.buildId,
1411
1425
  name: resp.data.buildName,
@@ -1783,7 +1797,6 @@ var finalizeBuild_default = (ctx) => {
1783
1797
  ctx2.log.debug(`Closed server`);
1784
1798
  let resp = yield ctx2.client.getS3PreSignedURL(ctx2);
1785
1799
  yield ctx2.client.uploadLogs(ctx2, resp.data.url);
1786
- fs5.unlinkSync(constants_default.LOG_FILE_PATH);
1787
1800
  } catch (error) {
1788
1801
  ctx2.log.debug(error);
1789
1802
  }
@@ -2013,6 +2026,9 @@ function processSnapshot(snapshot, ctx) {
2013
2026
  }
2014
2027
  }
2015
2028
  }
2029
+ if (options.ignoreType) {
2030
+ processedOptions.ignoreType = options.ignoreType;
2031
+ }
2016
2032
  }
2017
2033
  let navigated = false;
2018
2034
  let previousDeviceType = null;
@@ -2404,8 +2420,13 @@ var Queue = class {
2404
2420
 
2405
2421
  // src/commander/exec.ts
2406
2422
  var command = new commander.Command();
2407
- command.name("exec").description("Run test commands around SmartUI").argument("<command...>", "Command supplied for running tests").option("-P, --port <number>", "Port number for the server").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").action(function(execCommand, _, command5) {
2423
+ command.name("exec").description("Run test commands around SmartUI").argument("<command...>", "Command supplied for running tests").option("-P, --port <number>", "Port number for the server").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").action(function(execCommand, _, command5) {
2408
2424
  return __async(this, null, function* () {
2425
+ const options = command5.optsWithGlobals();
2426
+ if (options.buildName === "") {
2427
+ console.log(`Error: The '--buildName' option cannot be an empty string.`);
2428
+ process.exit(1);
2429
+ }
2409
2430
  let ctx = ctx_default(command5.optsWithGlobals());
2410
2431
  if (!which__default.default.sync(execCommand[0], { nothrow: true })) {
2411
2432
  ctx.log.error(`Error: Command not found "${execCommand[0]}"`);
@@ -2843,8 +2864,13 @@ var captureScreenshots_default = (ctx) => {
2843
2864
 
2844
2865
  // src/commander/capture.ts
2845
2866
  var command2 = new commander.Command();
2846
- command2.name("capture").description("Capture screenshots of static sites").argument("<file>", "Web static config file").option("-C, --parallel [number]", "Specify the number of instances per browser", parseInt).option("-F, --force", "forcefully apply the specified parallel instances per browser").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").action(function(file, _, command5) {
2867
+ command2.name("capture").description("Capture screenshots of static sites").argument("<file>", "Web static config file").option("-C, --parallel [number]", "Specify the number of instances per browser", parseInt).option("-F, --force", "forcefully apply the specified parallel instances per browser").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").action(function(file, _, command5) {
2847
2868
  return __async(this, null, function* () {
2869
+ const options = command5.optsWithGlobals();
2870
+ if (options.buildName === "") {
2871
+ console.log(`Error: The '--buildName' option cannot be an empty string.`);
2872
+ process.exit(1);
2873
+ }
2848
2874
  let ctx = ctx_default(command5.optsWithGlobals());
2849
2875
  if (!fs5__default.default.existsSync(file)) {
2850
2876
  ctx.log.error(`Web Static Config file ${file} not found.`);
@@ -2919,8 +2945,13 @@ command3.name("upload").description("Upload screenshots from given directory").a
2919
2945
  return val.split(",").map((ext) => ext.trim().toLowerCase());
2920
2946
  }).option("-E, --removeExtensions", "Strips file extensions from snapshot names").option("-i, --ignoreDir <patterns>", "Comma-separated list of directories to ignore", (val) => {
2921
2947
  return val.split(",").map((pattern) => pattern.trim());
2922
- }).option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").action(function(directory, _, command5) {
2948
+ }).option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").action(function(directory, _, command5) {
2923
2949
  return __async(this, null, function* () {
2950
+ const options = command5.optsWithGlobals();
2951
+ if (options.buildName === "") {
2952
+ console.log(`Error: The '--buildName' option cannot be an empty string.`);
2953
+ process.exit(1);
2954
+ }
2924
2955
  let ctx = ctx_default(command5.optsWithGlobals());
2925
2956
  if (!fs5__default.default.existsSync(directory)) {
2926
2957
  console.log(`Error: The provided directory ${directory} not found.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.0.13",
3
+ "version": "4.0.14-rc.0",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"