@lambdatest/smartui-cli 4.1.38-beta.0 → 4.1.38

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 +137 -68
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -5,9 +5,9 @@ var commander = require('commander');
5
5
  var which = require('which');
6
6
  var listr2 = require('listr2');
7
7
  var chalk = require('chalk');
8
- var path2 = require('path');
8
+ var path3 = require('path');
9
9
  var fastify = require('fastify');
10
- var fs5 = require('fs');
10
+ var fs6 = require('fs');
11
11
  var Ajv = require('ajv');
12
12
  var addErrors = require('ajv-errors');
13
13
  var test = require('@playwright/test');
@@ -46,9 +46,9 @@ function _interopNamespace(e) {
46
46
 
47
47
  var which__default = /*#__PURE__*/_interopDefault(which);
48
48
  var chalk__default = /*#__PURE__*/_interopDefault(chalk);
49
- var path2__default = /*#__PURE__*/_interopDefault(path2);
49
+ var path3__default = /*#__PURE__*/_interopDefault(path3);
50
50
  var fastify__default = /*#__PURE__*/_interopDefault(fastify);
51
- var fs5__default = /*#__PURE__*/_interopDefault(fs5);
51
+ var fs6__default = /*#__PURE__*/_interopDefault(fs6);
52
52
  var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
53
53
  var addErrors__default = /*#__PURE__*/_interopDefault(addErrors);
54
54
  var stringify__default = /*#__PURE__*/_interopDefault(stringify);
@@ -297,6 +297,7 @@ var constants_default = {
297
297
  MOBILE_ORIENTATION_PORTRAIT: "portrait",
298
298
  MOBILE_ORIENTATION_LANDSCAPE: "landscape",
299
299
  // build status
300
+ BUILD_RUNNING: "running",
300
301
  BUILD_COMPLETE: "completed",
301
302
  BUILD_ERROR: "error",
302
303
  // CI
@@ -1487,8 +1488,8 @@ var lambdaTunnel = __require("@lambdatest/node-tunnel");
1487
1488
  util$1.promisify(setTimeout);
1488
1489
  var tunnelInstance;
1489
1490
  function delDir(dir) {
1490
- if (fs5__default.default.existsSync(dir)) {
1491
- fs5__default.default.rmSync(dir, { recursive: true });
1491
+ if (fs6__default.default.existsSync(dir)) {
1492
+ fs6__default.default.rmSync(dir, { recursive: true });
1492
1493
  }
1493
1494
  }
1494
1495
  function scrollToBottomAndBackToTop({
@@ -1689,7 +1690,7 @@ function startPolling(ctx, build_id, baseline, projectToken) {
1689
1690
  if (ctx.options.fetchResults && ctx.options.fetchResultsFileName && ctx.build && ctx.build.id && resp.build.build_id === ctx.build.id) {
1690
1691
  fileName = `${ctx.options.fetchResultsFileName}`;
1691
1692
  }
1692
- fs5__default.default.writeFileSync(`${fileName}`, JSON.stringify(resp, null, 2));
1693
+ fs6__default.default.writeFileSync(`${fileName}`, JSON.stringify(resp, null, 2));
1693
1694
  ctx.log.debug(`Updated results in ${fileName}`);
1694
1695
  if (resp.build.build_status_ind === constants_default.BUILD_COMPLETE || resp.build.build_status_ind === constants_default.BUILD_ERROR) {
1695
1696
  clearInterval(intervalId);
@@ -1920,7 +1921,7 @@ function startPdfPolling(ctx) {
1920
1921
  attempts++;
1921
1922
  try {
1922
1923
  const response = yield ctx.client.fetchPdfResults(ctx);
1923
- if (response.screenshots && ((_a = response.build) == null ? void 0 : _a.build_status) === constants_default.BUILD_COMPLETE) {
1924
+ if (response.screenshots && ((_a = response.build) == null ? void 0 : _a.build_status) !== constants_default.BUILD_RUNNING) {
1924
1925
  clearInterval(interval);
1925
1926
  const pdfGroups = groupScreenshotsByPdf(response.screenshots);
1926
1927
  const pdfsWithMismatches = countPdfsWithMismatches(pdfGroups);
@@ -1957,7 +1958,7 @@ function startPdfPolling(ctx) {
1957
1958
  };
1958
1959
  if (ctx.options.fetchResults && ctx.options.fetchResultsFileName) {
1959
1960
  const filename = ctx.options.fetchResultsFileName !== "" ? ctx.options.fetchResultsFileName : "pdf-results.json";
1960
- fs5__default.default.writeFileSync(filename, JSON.stringify(formattedResults, null, 2));
1961
+ fs6__default.default.writeFileSync(filename, JSON.stringify(formattedResults, null, 2));
1961
1962
  console.log(chalk__default.default.green(`
1962
1963
  Results saved to ${filename}`));
1963
1964
  }
@@ -2086,12 +2087,13 @@ function listenToSmartUISSE(baseURL, accessToken, ctx, onEvent) {
2086
2087
  const url = `${baseURL}/api/v1/sse/smartui`;
2087
2088
  const abortController = new AbortController();
2088
2089
  try {
2090
+ const cookieKey = baseURL === "https://server-events.lambdatest.com" ? "accessToken" : "stageAccessToken";
2089
2091
  const response = yield fetch(url, {
2090
2092
  method: "GET",
2091
2093
  headers: {
2092
2094
  "Accept": "text/event-stream",
2093
2095
  "Cache-Control": "no-cache",
2094
- "Cookie": `stageAccessToken=Basic ${accessToken}`
2096
+ "Cookie": `${cookieKey}=Basic ${accessToken}`
2095
2097
  },
2096
2098
  signal: abortController.signal
2097
2099
  });
@@ -2240,7 +2242,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
2240
2242
  bodyLimit: 3e7
2241
2243
  });
2242
2244
  const opts = {};
2243
- const SMARTUI_DOM = fs5.readFileSync(path2__default.default.resolve(__dirname, "dom-serializer.js"), "utf-8");
2245
+ const SMARTUI_DOM = fs6.readFileSync(path3__default.default.resolve(__dirname, "dom-serializer.js"), "utf-8");
2244
2246
  server.get("/healthcheck", opts, (_, reply) => {
2245
2247
  reply.code(200).send({ cliVersion: ctx.cliVersion });
2246
2248
  });
@@ -2650,7 +2652,7 @@ var authExec_default = (ctx) => {
2650
2652
  };
2651
2653
 
2652
2654
  // package.json
2653
- var version = "4.1.38-beta.0";
2655
+ var version = "4.1.38";
2654
2656
  var package_default = {
2655
2657
  name: "@lambdatest/smartui-cli",
2656
2658
  version,
@@ -3108,7 +3110,7 @@ var httpClient = class {
3108
3110
  }
3109
3111
  uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
3110
3112
  browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
3111
- const file = fs5__default.default.readFileSync(ssPath);
3113
+ const file = fs6__default.default.readFileSync(ssPath);
3112
3114
  const form = new FormData__default.default();
3113
3115
  form.append("screenshot", file, { filename: `${ssName}.png`, contentType: "image/png" });
3114
3116
  form.append("browser", browserName);
@@ -3234,8 +3236,8 @@ var httpClient = class {
3234
3236
  }, ctx.log);
3235
3237
  }
3236
3238
  uploadLogs(ctx, uploadURL) {
3237
- const fileStream = fs5__default.default.createReadStream(constants_default.LOG_FILE_PATH);
3238
- const { size } = fs5__default.default.statSync(constants_default.LOG_FILE_PATH);
3239
+ const fileStream = fs6__default.default.createReadStream(constants_default.LOG_FILE_PATH);
3240
+ const { size } = fs6__default.default.statSync(constants_default.LOG_FILE_PATH);
3239
3241
  return this.request({
3240
3242
  url: uploadURL,
3241
3243
  method: "PUT",
@@ -3251,7 +3253,7 @@ var httpClient = class {
3251
3253
  }, ctx.log);
3252
3254
  }
3253
3255
  sendCliLogsToLSRS(ctx) {
3254
- const logContent = fs5__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
3256
+ const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
3255
3257
  return this.request({
3256
3258
  url: `/upload/logs`,
3257
3259
  method: "POST",
@@ -3418,7 +3420,7 @@ var ctx_default = (options) => {
3418
3420
  let loadDomContent = false;
3419
3421
  try {
3420
3422
  if (options.config) {
3421
- config = JSON.parse(fs5__default.default.readFileSync(options.config, "utf-8"));
3423
+ config = JSON.parse(fs6__default.default.readFileSync(options.config, "utf-8"));
3422
3424
  if ((_a = config.web) == null ? void 0 : _a.resolutions) {
3423
3425
  config.web.viewports = config.web.resolutions;
3424
3426
  delete config.web.resolutions;
@@ -3625,7 +3627,7 @@ var git_default = (ctx) => {
3625
3627
  githubURL = ctx.options.githubURL;
3626
3628
  }
3627
3629
  if (ctx.env.SMARTUI_GIT_INFO_FILEPATH) {
3628
- let gitInfo = JSON.parse(fs5__default.default.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, "utf-8"));
3630
+ let gitInfo = JSON.parse(fs6__default.default.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, "utf-8"));
3629
3631
  if (ctx.options.markBaseline) {
3630
3632
  ctx.env.BASELINE_BRANCH = ctx.env.CURRENT_BRANCH || gitInfo.branch || "";
3631
3633
  ctx.env.SMART_GIT = false;
@@ -3719,7 +3721,8 @@ var createBuildExec_default = (ctx) => {
3719
3721
  name: resp.data.buildName,
3720
3722
  url: resp.data.buildURL,
3721
3723
  baseline: resp.data.baseline,
3722
- useKafkaFlow: resp.data.useKafkaFlow || false
3724
+ useKafkaFlow: resp.data.useKafkaFlow || false,
3725
+ checkPendingRequests: resp.data.checkPendingRequests || false
3723
3726
  };
3724
3727
  process.env.SMARTUI_BUILD_ID = resp.data.buildId;
3725
3728
  process.env.SMARTUI_BUILD_NAME = resp.data.buildName;
@@ -3807,7 +3810,7 @@ var exec_default = (ctx) => {
3807
3810
  }
3808
3811
  updateLogContext({ task: "exec" });
3809
3812
  return new Promise((resolve, reject) => {
3810
- var _a2, _b, _c;
3813
+ var _a2, _b, _c, _d, _e;
3811
3814
  const childProcess = spawn__default.default(ctx2.args.execCommand[0], (_a2 = ctx2.args.execCommand) == null ? void 0 : _a2.slice(1));
3812
3815
  let totalOutput = "";
3813
3816
  if (!ctx2.env.LT_SDK_SKIP_EXECUTION_LOGS) {
@@ -3817,6 +3820,20 @@ var exec_default = (ctx) => {
3817
3820
  });
3818
3821
  (_b = childProcess.stdout) == null ? void 0 : _b.pipe(output);
3819
3822
  (_c = childProcess.stderr) == null ? void 0 : _c.pipe(output);
3823
+ } else {
3824
+ const logFileName = `execution-logs.log`;
3825
+ const logFilePath = path3__default.default.join(process.cwd(), logFileName);
3826
+ const logStream = fs6__default.default.createWriteStream(logFilePath, { flags: "a" });
3827
+ task.output = chalk__default.default.gray(`Execution logs being written to: ${logFileName}`);
3828
+ (_d = childProcess.stdout) == null ? void 0 : _d.on("data", (data) => {
3829
+ logStream.write(data);
3830
+ });
3831
+ (_e = childProcess.stderr) == null ? void 0 : _e.on("data", (data) => {
3832
+ logStream.write(data);
3833
+ });
3834
+ childProcess.on("close", () => {
3835
+ logStream.end();
3836
+ });
3820
3837
  }
3821
3838
  childProcess.on("error", (error) => {
3822
3839
  var _a3;
@@ -3991,8 +4008,20 @@ var globalCache = new NodeCache__default.default({ stdTTL: 3600, checkperiod: 60
3991
4008
  var MAX_RESOURCE_SIZE = 15 * 1024 ** 2;
3992
4009
  var ALLOWED_RESOURCES = ["document", "stylesheet", "image", "media", "font", "other"];
3993
4010
  var ALLOWED_STATUSES = [200, 201];
3994
- var REQUEST_TIMEOUT = 18e5;
4011
+ var REQUEST_TIMEOUT = 18e4;
3995
4012
  var MIN_VIEWPORT_HEIGHT = 1080;
4013
+ var MAX_WAIT_FOR_REQUEST_CALL = 3e4;
4014
+ var normalizeSameSite = (value) => {
4015
+ if (!value)
4016
+ return "Lax";
4017
+ const normalized = value.trim().toLowerCase();
4018
+ const mapping = {
4019
+ "lax": "Lax",
4020
+ "strict": "Strict",
4021
+ "none": "None"
4022
+ };
4023
+ return mapping[normalized] || value;
4024
+ };
3996
4025
  function prepareSnapshot(snapshot, ctx) {
3997
4026
  return __async(this, null, function* () {
3998
4027
  let processedOptions = {};
@@ -4215,7 +4244,8 @@ function processSnapshot(snapshot, ctx) {
4215
4244
  ctx.log.debug(`Skipping invalid custom cookie: missing required fields (name, value, or domain)`);
4216
4245
  return false;
4217
4246
  }
4218
- if (cookie.sameSite && !["Strict", "Lax", "None"].includes(cookie.sameSite)) {
4247
+ const sameSiteValue = normalizeSameSite(cookie.sameSite);
4248
+ if (!["Strict", "Lax", "None"].includes(sameSiteValue)) {
4219
4249
  ctx.log.debug(`Skipping invalid custom cookie: invalid sameSite value '${cookie.sameSite}'`);
4220
4250
  return false;
4221
4251
  }
@@ -4227,7 +4257,7 @@ function processSnapshot(snapshot, ctx) {
4227
4257
  path: cookie.path || "/",
4228
4258
  httpOnly: cookie.httpOnly || false,
4229
4259
  secure: cookie.secure || false,
4230
- sameSite: cookie.sameSite || "Lax"
4260
+ sameSite: normalizeSameSite(cookie.sameSite)
4231
4261
  }));
4232
4262
  if (validCustomCookies.length > 0) {
4233
4263
  try {
@@ -4251,6 +4281,7 @@ function processSnapshot(snapshot, ctx) {
4251
4281
  };
4252
4282
  }
4253
4283
  }
4284
+ const pendingRequests = /* @__PURE__ */ new Set();
4254
4285
  yield page.route("**/*", (route, request) => __async(this, null, function* () {
4255
4286
  var _a2;
4256
4287
  const requestUrl = request.url();
@@ -4300,8 +4331,14 @@ function processSnapshot(snapshot, ctx) {
4300
4331
  body = globalCache.get(requestUrl).body;
4301
4332
  } else {
4302
4333
  ctx.log.debug(`Resource not found in cache or global cache ${requestUrl} fetching from server`);
4334
+ if (ctx.build.checkPendingRequests) {
4335
+ pendingRequests.add(requestUrl);
4336
+ }
4303
4337
  response = yield page.request.fetch(request, requestOptions);
4304
4338
  body = yield response.body();
4339
+ if (ctx.build.checkPendingRequests) {
4340
+ pendingRequests.delete(requestUrl);
4341
+ }
4305
4342
  }
4306
4343
  if (!body) {
4307
4344
  ctx.log.debug(`Handling request ${requestUrl}
@@ -4333,8 +4370,14 @@ function processSnapshot(snapshot, ctx) {
4333
4370
  }
4334
4371
  let responseOfRetry, bodyOfRetry;
4335
4372
  ctx.log.debug(`Resource had a disallowed status ${requestUrl} fetching from server again`);
4373
+ if (ctx.build.checkPendingRequests) {
4374
+ pendingRequests.add(requestUrl);
4375
+ }
4336
4376
  responseOfRetry = yield page.request.fetch(request, requestOptions);
4337
4377
  bodyOfRetry = yield responseOfRetry.body();
4378
+ if (ctx.build.checkPendingRequests) {
4379
+ pendingRequests.delete(requestUrl);
4380
+ }
4338
4381
  if (responseOfRetry && responseOfRetry.status() && ALLOWED_STATUSES.includes(responseOfRetry.status())) {
4339
4382
  ctx.log.debug(`Handling request after retry ${requestUrl}
4340
4383
  - content-type ${responseOfRetry.headers()["content-type"]}`);
@@ -4342,6 +4385,12 @@ function processSnapshot(snapshot, ctx) {
4342
4385
  body: bodyOfRetry.toString("base64"),
4343
4386
  type: responseOfRetry.headers()["content-type"]
4344
4387
  };
4388
+ if (ctx.config.useGlobalCache) {
4389
+ globalCache.set(requestUrl, {
4390
+ body: bodyOfRetry.toString("base64"),
4391
+ type: responseOfRetry.headers()["content-type"]
4392
+ });
4393
+ }
4345
4394
  route.fulfill({
4346
4395
  status: responseOfRetry.status(),
4347
4396
  headers: responseOfRetry.headers(),
@@ -4718,6 +4767,25 @@ function processSnapshot(snapshot, ctx) {
4718
4767
  processedOptions.selectDOM = options == null ? void 0 : options.selectDOM;
4719
4768
  ctx.log.debug(`Processed options: ${JSON.stringify(processedOptions)}`);
4720
4769
  }
4770
+ const checkPending = () => __async(this, null, function* () {
4771
+ let startTime = Date.now();
4772
+ ctx.log.debug(`${pendingRequests.size} Pending requests before wait for ${snapshot.name}: ${Array.from(pendingRequests)}`);
4773
+ while (pendingRequests.size > 0) {
4774
+ const elapsedTime = Date.now() - startTime;
4775
+ if (elapsedTime >= MAX_WAIT_FOR_REQUEST_CALL) {
4776
+ ctx.log.debug(`Timeout reached (${MAX_WAIT_FOR_REQUEST_CALL / 1e3}s). Stopping wait for pending requests.`);
4777
+ ctx.log.debug(`${pendingRequests.size} Pending requests after wait for ${snapshot.name}: ${Array.from(pendingRequests)}`);
4778
+ break;
4779
+ }
4780
+ yield new Promise((resolve) => setTimeout(resolve, 1e3));
4781
+ }
4782
+ if (pendingRequests.size === 0) {
4783
+ ctx.log.debug(`No pending requests for ${snapshot.name}.`);
4784
+ }
4785
+ });
4786
+ if (ctx.build.checkPendingRequests) {
4787
+ yield checkPending();
4788
+ }
4721
4789
  let hasBrowserErrors = false;
4722
4790
  for (let browser in discoveryErrors.browsers) {
4723
4791
  if (discoveryErrors.browsers[browser]) {
@@ -5263,66 +5331,66 @@ command.name("exec").description("Run test commands around SmartUI").argument("<
5263
5331
  var exec_default2 = command;
5264
5332
  function createConfig(filepath) {
5265
5333
  filepath = filepath || ".smartui.json";
5266
- let filetype = path2__default.default.extname(filepath);
5334
+ let filetype = path3__default.default.extname(filepath);
5267
5335
  if (filetype != ".json") {
5268
5336
  console.log("Error: Config file must have .json extension");
5269
5337
  return;
5270
5338
  }
5271
- if (fs5__default.default.existsSync(filepath)) {
5339
+ if (fs6__default.default.existsSync(filepath)) {
5272
5340
  console.log(`Error: SmartUI Config already exists: ${filepath}`);
5273
5341
  console.log(`To create a new file, please specify the file name like: 'smartui config:create .smartui-config.json'`);
5274
5342
  return;
5275
5343
  }
5276
- fs5__default.default.mkdirSync(path2__default.default.dirname(filepath), { recursive: true });
5277
- fs5__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_CONFIG, null, 2) + "\n");
5344
+ fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
5345
+ fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_CONFIG, null, 2) + "\n");
5278
5346
  console.log(`Created SmartUI Config: ${filepath}`);
5279
5347
  }
5280
5348
  function createWebStaticConfig(filepath) {
5281
5349
  filepath = filepath || "url.json";
5282
- let filetype = path2__default.default.extname(filepath);
5350
+ let filetype = path3__default.default.extname(filepath);
5283
5351
  if (filetype != ".json") {
5284
5352
  console.log("Error: Config file must have .json extension");
5285
5353
  return;
5286
5354
  }
5287
- if (fs5__default.default.existsSync(filepath)) {
5355
+ if (fs6__default.default.existsSync(filepath)) {
5288
5356
  console.log(`Error: web-static config already exists: ${filepath}`);
5289
5357
  console.log(`To create a new file, please specify the file name like: 'smartui config:create-web-static links.json'`);
5290
5358
  return;
5291
5359
  }
5292
- fs5__default.default.mkdirSync(path2__default.default.dirname(filepath), { recursive: true });
5293
- fs5__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_WEB_STATIC_CONFIG, null, 2) + "\n");
5360
+ fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
5361
+ fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_WEB_STATIC_CONFIG, null, 2) + "\n");
5294
5362
  console.log(`Created web-static config: ${filepath}`);
5295
5363
  }
5296
5364
  function createFigmaConfig(filepath) {
5297
5365
  filepath = filepath || "designs.json";
5298
- let filetype = path2__default.default.extname(filepath);
5366
+ let filetype = path3__default.default.extname(filepath);
5299
5367
  if (filetype != ".json") {
5300
5368
  console.log("Error: designs config file must have .json extension");
5301
5369
  return;
5302
5370
  }
5303
- if (fs5__default.default.existsSync(filepath)) {
5371
+ if (fs6__default.default.existsSync(filepath)) {
5304
5372
  console.log(`Error: designs config already exists: ${filepath}`);
5305
5373
  console.log(`To create a new file, please specify the file name like: 'smartui config:figma-config designs.json'`);
5306
5374
  return;
5307
5375
  }
5308
- fs5__default.default.mkdirSync(path2__default.default.dirname(filepath), { recursive: true });
5309
- fs5__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_FIGMA_CONFIG, null, 2) + "\n");
5376
+ fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
5377
+ fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_FIGMA_CONFIG, null, 2) + "\n");
5310
5378
  console.log(`Created designs config: ${filepath}`);
5311
5379
  }
5312
5380
  function createWebFigmaConfig(filepath) {
5313
5381
  filepath = filepath || ".smartui.json";
5314
- let filetype = path2__default.default.extname(filepath);
5382
+ let filetype = path3__default.default.extname(filepath);
5315
5383
  if (filetype != ".json") {
5316
5384
  console.log("Error: figma config file must have .json extension");
5317
5385
  return;
5318
5386
  }
5319
- if (fs5__default.default.existsSync(filepath)) {
5387
+ if (fs6__default.default.existsSync(filepath)) {
5320
5388
  console.log(`Error: figma config already exists: ${filepath}`);
5321
5389
  console.log(`To create a new file, please specify the file name like: 'smartui config:create-figma-web <fileName>.json'`);
5322
5390
  return;
5323
5391
  }
5324
- fs5__default.default.mkdirSync(path2__default.default.dirname(filepath), { recursive: true });
5325
- fs5__default.default.writeFileSync(filepath, JSON.stringify(constants_default.WEB_FIGMA_CONFIG, null, 2) + "\n");
5392
+ fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
5393
+ fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.WEB_FIGMA_CONFIG, null, 2) + "\n");
5326
5394
  console.log(`Created figma web config: ${filepath}`);
5327
5395
  }
5328
5396
  function verifyFigmaWebConfig(ctx) {
@@ -5368,18 +5436,18 @@ function isValidArray(input) {
5368
5436
  }
5369
5437
  function createAppFigmaConfig(filepath) {
5370
5438
  filepath = filepath || ".smartui.json";
5371
- let filetype = path2__default.default.extname(filepath);
5439
+ let filetype = path3__default.default.extname(filepath);
5372
5440
  if (filetype != ".json") {
5373
5441
  console.log("Error: figma app config file must have .json extension");
5374
5442
  return;
5375
5443
  }
5376
- if (fs5__default.default.existsSync(filepath)) {
5444
+ if (fs6__default.default.existsSync(filepath)) {
5377
5445
  console.log(`Error: figma app config already exists: ${filepath}`);
5378
5446
  console.log(`To create a new figma app config, please specify the file name like: 'smartui config:create-figma-app <fileName>.json'`);
5379
5447
  return;
5380
5448
  }
5381
- fs5__default.default.mkdirSync(path2__default.default.dirname(filepath), { recursive: true });
5382
- fs5__default.default.writeFileSync(filepath, JSON.stringify(constants_default.APP_FIGMA_CONFIG, null, 2) + "\n");
5449
+ fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
5450
+ fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.APP_FIGMA_CONFIG, null, 2) + "\n");
5383
5451
  console.log(`Created figma app config: ${filepath}`);
5384
5452
  }
5385
5453
 
@@ -5451,7 +5519,8 @@ var createBuild_default = (ctx) => {
5451
5519
  name: resp.data.buildName,
5452
5520
  url: resp.data.buildURL,
5453
5521
  baseline: resp.data.baseline,
5454
- useKafkaFlow: resp.data.useKafkaFlow || false
5522
+ useKafkaFlow: resp.data.useKafkaFlow || false,
5523
+ checkPendingRequests: resp.data.checkPendingRequests || false
5455
5524
  };
5456
5525
  process.env.SMARTUI_BUILD_ID = resp.data.buildId;
5457
5526
  process.env.SMARTUI_BUILD_NAME = resp.data.buildName;
@@ -5623,7 +5692,7 @@ function captureScreenshots(ctx) {
5623
5692
  });
5624
5693
  }
5625
5694
  function getImageDimensions(filePath) {
5626
- const buffer = fs5__default.default.readFileSync(filePath);
5695
+ const buffer = fs6__default.default.readFileSync(filePath);
5627
5696
  let width, height;
5628
5697
  if (buffer.toString("hex", 0, 2) === "ffd8") {
5629
5698
  let offset = 2;
@@ -5648,7 +5717,7 @@ function getImageDimensions(filePath) {
5648
5717
  function isAllowedImage(filePath) {
5649
5718
  return __async(this, null, function* () {
5650
5719
  try {
5651
- const fileBuffer = fs5__default.default.readFileSync(filePath);
5720
+ const fileBuffer = fs6__default.default.readFileSync(filePath);
5652
5721
  const isMagicValid = constants_default.MAGIC_NUMBERS.some((magic) => fileBuffer.slice(0, magic.magic.length).equals(magic.magic));
5653
5722
  const metadata = yield sharp__default.default(filePath).metadata();
5654
5723
  if (metadata.format === constants_default.FILE_EXTENSION_GIFS) {
@@ -5672,11 +5741,11 @@ function uploadScreenshots(ctx) {
5672
5741
  let noOfScreenshots = 0;
5673
5742
  function processDirectory(directory, relativePath = "") {
5674
5743
  return __async(this, null, function* () {
5675
- const files = fs5__default.default.readdirSync(directory);
5744
+ const files = fs6__default.default.readdirSync(directory);
5676
5745
  for (let file of files) {
5677
- const filePath = path2__default.default.join(directory, file);
5678
- const stat = fs5__default.default.statSync(filePath);
5679
- const relativeFilePath = path2__default.default.join(relativePath, file);
5746
+ const filePath = path3__default.default.join(directory, file);
5747
+ const stat = fs6__default.default.statSync(filePath);
5748
+ const relativeFilePath = path3__default.default.join(relativePath, file);
5680
5749
  if (stat.isDirectory() && ctx.options.ignorePattern.includes(relativeFilePath)) {
5681
5750
  ctx.log.info(`Ignoring Directory ${relativeFilePath}`);
5682
5751
  continue;
@@ -5684,7 +5753,7 @@ function uploadScreenshots(ctx) {
5684
5753
  if (stat.isDirectory()) {
5685
5754
  yield processDirectory(filePath, relativeFilePath);
5686
5755
  } else {
5687
- let fileExtension = path2__default.default.extname(file).toLowerCase();
5756
+ let fileExtension = path3__default.default.extname(file).toLowerCase();
5688
5757
  if (allowedExtensions.includes(fileExtension)) {
5689
5758
  const isValid = yield isAllowedImage(filePath);
5690
5759
  if (!isValid) {
@@ -5693,7 +5762,7 @@ function uploadScreenshots(ctx) {
5693
5762
  }
5694
5763
  let ssId = relativeFilePath;
5695
5764
  if (ctx.options.stripExtension) {
5696
- ssId = path2__default.default.join(relativePath, path2__default.default.basename(file, fileExtension));
5765
+ ssId = path3__default.default.join(relativePath, path3__default.default.basename(file, fileExtension));
5697
5766
  }
5698
5767
  let viewport = "default";
5699
5768
  if (!ctx.options.ignoreResolutions) {
@@ -5868,12 +5937,12 @@ command2.name("capture").description("Capture screenshots of static sites").argu
5868
5937
  }
5869
5938
  let ctx = ctx_default(command11.optsWithGlobals());
5870
5939
  ctx.isSnapshotCaptured = true;
5871
- if (!fs5__default.default.existsSync(file)) {
5940
+ if (!fs6__default.default.existsSync(file)) {
5872
5941
  ctx.log.error(`Web Static Config file ${file} not found.`);
5873
5942
  return;
5874
5943
  }
5875
5944
  try {
5876
- ctx.webStaticConfig = JSON.parse(fs5__default.default.readFileSync(file, "utf8"));
5945
+ ctx.webStaticConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
5877
5946
  if (!validateWebStaticConfig(ctx.webStaticConfig)) {
5878
5947
  ctx.log.debug(JSON.stringify(validateWebStaticConfig.errors, null, 2));
5879
5948
  (_a = validateWebStaticConfig.errors) == null ? void 0 : _a.forEach((error) => {
@@ -5963,11 +6032,11 @@ command3.name("upload").description("Upload screenshots from given directory").a
5963
6032
  }
5964
6033
  let ctx = ctx_default(command11.optsWithGlobals());
5965
6034
  ctx.isSnapshotCaptured = true;
5966
- if (!fs5__default.default.existsSync(directory)) {
6035
+ if (!fs6__default.default.existsSync(directory)) {
5967
6036
  console.log(`Error: The provided directory ${directory} not found.`);
5968
6037
  return;
5969
6038
  }
5970
- if (path2__default.default.extname(directory).toLowerCase() === constants_default.FILE_EXTENSION_ZIP) {
6039
+ if (path3__default.default.extname(directory).toLowerCase() === constants_default.FILE_EXTENSION_ZIP) {
5971
6040
  ctx.log.debug(`Error: The provided directory ${directory} is a zip file. Zips are not accepted.`);
5972
6041
  return;
5973
6042
  }
@@ -6246,12 +6315,12 @@ uploadFigma.name("upload-figma").description("Capture screenshots of static site
6246
6315
  var _a, _b;
6247
6316
  let ctx = ctx_default(command11.optsWithGlobals());
6248
6317
  ctx.isSnapshotCaptured = true;
6249
- if (!fs5__default.default.existsSync(file)) {
6318
+ if (!fs6__default.default.existsSync(file)) {
6250
6319
  console.log(`Error: Figma Config file ${file} not found.`);
6251
6320
  return;
6252
6321
  }
6253
6322
  try {
6254
- ctx.figmaDesignConfig = JSON.parse(fs5__default.default.readFileSync(file, "utf8"));
6323
+ ctx.figmaDesignConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
6255
6324
  if (!validateFigmaDesignConfig(ctx.figmaDesignConfig)) {
6256
6325
  const validationError = (_b = (_a = validateFigmaDesignConfig.errors) == null ? void 0 : _a[0]) == null ? void 0 : _b.message;
6257
6326
  throw new Error(validationError || "Invalid figma design Config");
@@ -6287,12 +6356,12 @@ uploadWebFigmaCommand.name("upload-figma-web").description("Capture figma screen
6287
6356
  return __async(this, null, function* () {
6288
6357
  var _a;
6289
6358
  let ctx = ctx_default(command11.optsWithGlobals());
6290
- if (!fs5__default.default.existsSync(file)) {
6359
+ if (!fs6__default.default.existsSync(file)) {
6291
6360
  console.log(`Error: figma-web config file ${file} not found.`);
6292
6361
  return;
6293
6362
  }
6294
6363
  try {
6295
- ctx.config = JSON.parse(fs5__default.default.readFileSync(file, "utf8"));
6364
+ ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
6296
6365
  ctx.log.info(JSON.stringify(ctx.config));
6297
6366
  if (!validateWebFigmaConfig(ctx.config)) {
6298
6367
  ctx.log.debug(JSON.stringify(validateWebFigmaConfig.errors, null, 2));
@@ -6340,12 +6409,12 @@ uploadAppFigmaCommand.name("upload-figma-app").description("Capture figma screen
6340
6409
  return __async(this, null, function* () {
6341
6410
  var _a;
6342
6411
  let ctx = ctx_default(command11.optsWithGlobals());
6343
- if (!fs5__default.default.existsSync(file)) {
6412
+ if (!fs6__default.default.existsSync(file)) {
6344
6413
  console.log(`Error: figma-app config file ${file} not found.`);
6345
6414
  return;
6346
6415
  }
6347
6416
  try {
6348
- ctx.config = JSON.parse(fs5__default.default.readFileSync(file, "utf8"));
6417
+ ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
6349
6418
  ctx.log.info(JSON.stringify(ctx.config));
6350
6419
  if (!validateAppFigmaConfig(ctx.config)) {
6351
6420
  ctx.log.debug(JSON.stringify(validateAppFigmaConfig.errors, null, 2));
@@ -6815,13 +6884,13 @@ function uploadPdfs(ctx, pdfPath) {
6815
6884
  return __async(this, null, function* () {
6816
6885
  const formData = new FormData__default.default();
6817
6886
  if (pdfPath.endsWith(".pdf")) {
6818
- formData.append("pathToFiles", fs5__default.default.createReadStream(pdfPath));
6887
+ formData.append("pathToFiles", fs6__default.default.createReadStream(pdfPath));
6819
6888
  } else {
6820
- const files = fs5__default.default.readdirSync(pdfPath);
6889
+ const files = fs6__default.default.readdirSync(pdfPath);
6821
6890
  const pdfFiles = files.filter((file) => file.endsWith(".pdf"));
6822
6891
  pdfFiles.forEach((pdf) => {
6823
- const filePath = path2__default.default.join(pdfPath, pdf);
6824
- formData.append("pathToFiles", fs5__default.default.createReadStream(filePath));
6892
+ const filePath = path3__default.default.join(pdfPath, pdf);
6893
+ formData.append("pathToFiles", fs6__default.default.createReadStream(filePath));
6825
6894
  });
6826
6895
  }
6827
6896
  const buildName = ctx.options.buildName;
@@ -6853,7 +6922,7 @@ command10.name("upload-pdf").description("Upload PDFs for visual comparison").ar
6853
6922
  process.exit(1);
6854
6923
  }
6855
6924
  let ctx = ctx_default(command11.optsWithGlobals());
6856
- if (!fs5__default.default.existsSync(directory)) {
6925
+ if (!fs6__default.default.existsSync(directory)) {
6857
6926
  console.log(`Error: The provided directory ${directory} not found.`);
6858
6927
  process.exit(1);
6859
6928
  }
@@ -6896,7 +6965,7 @@ var commander_default = program2;
6896
6965
  let client = new httpClient(env_default());
6897
6966
  let log2 = logger_default;
6898
6967
  try {
6899
- fs5__default.default.unlinkSync(constants_default.LOG_FILE_PATH);
6968
+ fs6__default.default.unlinkSync(constants_default.LOG_FILE_PATH);
6900
6969
  let { data: { latestVersion, deprecated, additionalDescription } } = yield client.checkUpdate(log2);
6901
6970
  log2.info(`
6902
6971
  LambdaTest SmartUI CLI v${package_default.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.38-beta.0",
3
+ "version": "4.1.38",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"