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

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 +33 -10
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1517,7 +1517,7 @@ var authExec_default = (ctx) => {
1517
1517
  };
1518
1518
 
1519
1519
  // package.json
1520
- var version = "4.1.4-beta.0";
1520
+ var version = "4.1.4";
1521
1521
  var package_default = {
1522
1522
  name: "@lambdatest/smartui-cli",
1523
1523
  version,
@@ -2320,6 +2320,9 @@ var finalizeBuild_default = (ctx) => {
2320
2320
  if (ctx2.build.id) {
2321
2321
  yield ctx2.client.finalizeBuild(ctx2.build.id, ctx2.totalSnapshots, ctx2.log);
2322
2322
  }
2323
+ if (ctx2.build.hasDiscoveryError) {
2324
+ ctx2.log.warn(`We found some network errors while capturing DOM snapshots. These network errors may cause visual differences in your screenshots. Please go to ${ctx2.build.url} for more details`);
2325
+ }
2323
2326
  } catch (error) {
2324
2327
  ctx2.log.debug(error);
2325
2328
  task.output = chalk__default.default.gray(error.message);
@@ -2395,11 +2398,10 @@ function processSnapshot(snapshot, ctx) {
2395
2398
  url: "",
2396
2399
  timestamp: "",
2397
2400
  snapshotUUID: "",
2398
- browsers: {
2399
- chrome: {}
2400
- }
2401
+ browsers: {}
2401
2402
  };
2402
2403
  let globalViewport = "";
2404
+ let globalBrowser = constants_default.CHROME;
2403
2405
  let launchOptions = {
2404
2406
  headless: isHeadless,
2405
2407
  args: constants_default.LAUNCH_ARGS
@@ -2526,13 +2528,15 @@ function processSnapshot(snapshot, ctx) {
2526
2528
  url: requestUrl,
2527
2529
  resourceType: request.resourceType()
2528
2530
  };
2529
- if (!discoveryErrors.browsers.chrome) {
2530
- discoveryErrors.browsers.chrome = {};
2531
+ if (!discoveryErrors.browsers[globalBrowser]) {
2532
+ discoveryErrors.browsers[globalBrowser] = {};
2533
+ }
2534
+ if (discoveryErrors.browsers[globalBrowser] && !discoveryErrors.browsers[globalBrowser][globalViewport]) {
2535
+ discoveryErrors.browsers[globalBrowser][globalViewport] = [];
2531
2536
  }
2532
- if (!discoveryErrors.browsers.chrome[globalViewport]) {
2533
- discoveryErrors.browsers.chrome[globalViewport] = [];
2537
+ if (discoveryErrors.browsers[globalBrowser]) {
2538
+ (_a2 = discoveryErrors.browsers[globalBrowser][globalViewport]) == null ? void 0 : _a2.push(data);
2534
2539
  }
2535
- (_a2 = discoveryErrors.browsers.chrome[globalViewport]) == null ? void 0 : _a2.push(data);
2536
2540
  } else {
2537
2541
  ctx.log.debug(`Handling request ${requestUrl}
2538
2542
  - content-type ${response.headers()["content-type"]}`);
@@ -2670,6 +2674,11 @@ function processSnapshot(snapshot, ctx) {
2670
2674
  ctx.log.debug(`Page resized to ${viewport.width}x${viewport.height || MIN_VIEWPORT_HEIGHT}`);
2671
2675
  globalViewport = viewportString;
2672
2676
  ctx.log.debug(`globalViewport : ${globalViewport}`);
2677
+ if (globalViewport.toLowerCase().includes("iphone") || globalViewport.toLowerCase().includes("ipad")) {
2678
+ globalBrowser = constants_default.WEBKIT;
2679
+ } else {
2680
+ globalBrowser = constants_default.CHROME;
2681
+ }
2673
2682
  if (!navigated) {
2674
2683
  try {
2675
2684
  discoveryErrors.url = snapshot.url;
@@ -2756,7 +2765,21 @@ function processSnapshot(snapshot, ctx) {
2756
2765
  }
2757
2766
  ctx.log.debug(`Processed options: ${JSON.stringify(processedOptions)}`);
2758
2767
  }
2759
- discoveryErrors.timestamp = (/* @__PURE__ */ new Date()).toISOString();
2768
+ let hasBrowserErrors = false;
2769
+ for (let browser in discoveryErrors.browsers) {
2770
+ if (discoveryErrors.browsers[browser]) {
2771
+ for (let viewport in discoveryErrors.browsers[browser]) {
2772
+ if (discoveryErrors.browsers[browser][viewport].length > 0) {
2773
+ hasBrowserErrors = true;
2774
+ ctx.build.hasDiscoveryError = true;
2775
+ break;
2776
+ }
2777
+ }
2778
+ }
2779
+ }
2780
+ if (hasBrowserErrors) {
2781
+ discoveryErrors.timestamp = (/* @__PURE__ */ new Date()).toISOString();
2782
+ }
2760
2783
  return {
2761
2784
  processedSnapshot: {
2762
2785
  name: snapshot.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.4-beta.0",
3
+ "version": "4.1.4",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"