@lambdatest/smartui-cli 4.0.12 → 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 +47 -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: {
@@ -739,6 +750,10 @@ var SnapshotSchema = {
739
750
  },
740
751
  required: ["devices"],
741
752
  errorMessage: "Invalid snapshot options; mobile must include devices property."
753
+ },
754
+ loadDomContent: {
755
+ type: "boolean",
756
+ errorMessage: "Invalid snapshot options; loadDomContent must be a boolean"
742
757
  }
743
758
  },
744
759
  additionalProperties: false
@@ -963,7 +978,7 @@ var auth_default = (ctx) => {
963
978
  };
964
979
 
965
980
  // package.json
966
- var version = "4.0.12";
981
+ var version = "4.0.14-rc.0";
967
982
  var package_default = {
968
983
  name: "@lambdatest/smartui-cli",
969
984
  version,
@@ -1081,13 +1096,14 @@ var httpClient = class {
1081
1096
  }
1082
1097
  });
1083
1098
  }
1084
- createBuild(git, config, log2) {
1099
+ createBuild(git, config, log2, buildName) {
1085
1100
  return this.request({
1086
1101
  url: "/build",
1087
1102
  method: "POST",
1088
1103
  data: {
1089
1104
  git,
1090
- config
1105
+ config,
1106
+ buildName
1091
1107
  }
1092
1108
  }, log2);
1093
1109
  }
@@ -1223,6 +1239,7 @@ var ctx_default = (options) => {
1223
1239
  let parallelObj;
1224
1240
  let fetchResultObj;
1225
1241
  let fetchResultsFileObj;
1242
+ let buildNameObj;
1226
1243
  try {
1227
1244
  if (options.config) {
1228
1245
  config = JSON.parse(fs5__default.default.readFileSync(options.config, "utf-8"));
@@ -1254,6 +1271,7 @@ var ctx_default = (options) => {
1254
1271
  fetchResultObj = false;
1255
1272
  fetchResultsFileObj = "";
1256
1273
  }
1274
+ buildNameObj = options.buildName || "";
1257
1275
  } catch (error) {
1258
1276
  console.log(`[smartui] Error: ${error.message}`);
1259
1277
  process.exit();
@@ -1301,7 +1319,7 @@ var ctx_default = (options) => {
1301
1319
  },
1302
1320
  build: {
1303
1321
  id: "",
1304
- name: "",
1322
+ name: buildNameObj,
1305
1323
  baseline: false,
1306
1324
  url: ""
1307
1325
  },
@@ -1401,7 +1419,7 @@ var createBuild_default = (ctx) => {
1401
1419
  task: (ctx2, task) => __async(void 0, null, function* () {
1402
1420
  updateLogContext({ task: "createBuild" });
1403
1421
  try {
1404
- 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);
1405
1423
  ctx2.build = {
1406
1424
  id: resp.data.buildId,
1407
1425
  name: resp.data.buildName,
@@ -1779,7 +1797,6 @@ var finalizeBuild_default = (ctx) => {
1779
1797
  ctx2.log.debug(`Closed server`);
1780
1798
  let resp = yield ctx2.client.getS3PreSignedURL(ctx2);
1781
1799
  yield ctx2.client.uploadLogs(ctx2, resp.data.url);
1782
- fs5.unlinkSync(constants_default.LOG_FILE_PATH);
1783
1800
  } catch (error) {
1784
1801
  ctx2.log.debug(error);
1785
1802
  }
@@ -1943,6 +1960,9 @@ function processSnapshot(snapshot, ctx) {
1943
1960
  return true;
1944
1961
  return false;
1945
1962
  };
1963
+ if (options.loadDomContent) {
1964
+ processedOptions.loadDomContent = true;
1965
+ }
1946
1966
  if (options.web && Object.keys(options.web).length) {
1947
1967
  processedOptions.web = {};
1948
1968
  if (options.web.viewports && options.web.viewports.length > 0) {
@@ -2006,6 +2026,9 @@ function processSnapshot(snapshot, ctx) {
2006
2026
  }
2007
2027
  }
2008
2028
  }
2029
+ if (options.ignoreType) {
2030
+ processedOptions.ignoreType = options.ignoreType;
2031
+ }
2009
2032
  }
2010
2033
  let navigated = false;
2011
2034
  let previousDeviceType = null;
@@ -2397,8 +2420,13 @@ var Queue = class {
2397
2420
 
2398
2421
  // src/commander/exec.ts
2399
2422
  var command = new commander.Command();
2400
- 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) {
2401
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
+ }
2402
2430
  let ctx = ctx_default(command5.optsWithGlobals());
2403
2431
  if (!which__default.default.sync(execCommand[0], { nothrow: true })) {
2404
2432
  ctx.log.error(`Error: Command not found "${execCommand[0]}"`);
@@ -2836,8 +2864,13 @@ var captureScreenshots_default = (ctx) => {
2836
2864
 
2837
2865
  // src/commander/capture.ts
2838
2866
  var command2 = new commander.Command();
2839
- 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) {
2840
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
+ }
2841
2874
  let ctx = ctx_default(command5.optsWithGlobals());
2842
2875
  if (!fs5__default.default.existsSync(file)) {
2843
2876
  ctx.log.error(`Web Static Config file ${file} not found.`);
@@ -2912,8 +2945,13 @@ command3.name("upload").description("Upload screenshots from given directory").a
2912
2945
  return val.split(",").map((ext) => ext.trim().toLowerCase());
2913
2946
  }).option("-E, --removeExtensions", "Strips file extensions from snapshot names").option("-i, --ignoreDir <patterns>", "Comma-separated list of directories to ignore", (val) => {
2914
2947
  return val.split(",").map((pattern) => pattern.trim());
2915
- }).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) {
2916
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
+ }
2917
2955
  let ctx = ctx_default(command5.optsWithGlobals());
2918
2956
  if (!fs5__default.default.existsSync(directory)) {
2919
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.12",
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/**/*"