@lambdatest/smartui-cli 4.1.53 → 4.1.54-beta.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 +30 -2
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2895,7 +2895,7 @@ var authExec_default = (ctx) => {
2895
2895
  };
2896
2896
 
2897
2897
  // package.json
2898
- var version = "4.1.53";
2898
+ var version = "4.1.54-beta.0";
2899
2899
  var package_default = {
2900
2900
  name: "@lambdatest/smartui-cli",
2901
2901
  version,
@@ -6027,6 +6027,17 @@ var createBuild_default = (ctx) => {
6027
6027
  rendererOptions: { persistentOutput: true }
6028
6028
  };
6029
6029
  };
6030
+ function humanLikeScroll(page) {
6031
+ return __async(this, null, function* () {
6032
+ yield page.waitForTimeout(2e3);
6033
+ yield page.mouse.move(100, 100);
6034
+ yield page.waitForTimeout(300);
6035
+ yield page.mouse.move(300, 200);
6036
+ yield page.waitForTimeout(300);
6037
+ yield page.mouse.move(500, 300);
6038
+ yield page.waitForTimeout(2e3);
6039
+ });
6040
+ }
6030
6041
  function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, renderViewports) {
6031
6042
  return __async(this, null, function* () {
6032
6043
  ctx.log.debug(`*** urlConfig ${JSON.stringify(urlConfig)}`);
@@ -6233,7 +6244,24 @@ function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, rend
6233
6244
  }
6234
6245
  let ssPath = `screenshots/${ssId}/${`${browserName}-${viewport.width}x${viewport.height}`}-${ssId}.png`;
6235
6246
  yield page == null ? void 0 : page.setViewportSize({ width: viewport.width, height: viewport.height || constants_default.MIN_VIEWPORT_HEIGHT });
6236
- if (fullPage) yield page == null ? void 0 : page.evaluate(scrollToBottomAndBackToTop);
6247
+ yield page == null ? void 0 : page.goto(url.trim(), pageOptions);
6248
+ ctx.log.debug(`Capturing screenshot for URL: ${url} on ${browserName} with viewport: ${viewportString} (fullPage: ${fullPage})`);
6249
+ if (page && ctx.config.lazyLoadConfiguration) {
6250
+ yield humanLikeScroll(page);
6251
+ }
6252
+ if (fullPage) {
6253
+ if (ctx.config.lazyLoadConfiguration && ctx.config.lazyLoadConfiguration.enabled) {
6254
+ let stepValue = ctx.config.lazyLoadConfiguration.scrollStep || 250;
6255
+ let delayValue = ctx.config.lazyLoadConfiguration.scrollDelay || 300;
6256
+ let maxScrollsValue = ctx.config.lazyLoadConfiguration.maxScrolls || 50;
6257
+ let jumpBackToTopValue = ctx.config.lazyLoadConfiguration.jumpBackToTop !== false;
6258
+ ctx.log.debug("Capture: Starting lazy load scrolling with configuration: " + JSON.stringify({ step: stepValue, delay: delayValue, maxScrolls: maxScrollsValue, jumpBackToTop: jumpBackToTopValue }));
6259
+ yield page == null ? void 0 : page.evaluate(smoothScrollToBottom, { step: stepValue, delay: delayValue, maxScrolls: maxScrollsValue, jumpBackToTop: jumpBackToTopValue });
6260
+ ctx.log.debug("Capture: Completed lazy load scrolling");
6261
+ } else {
6262
+ yield page == null ? void 0 : page.evaluate(scrollToBottomAndBackToTop, { frequency: 100, timing: ctx.config.scrollTime });
6263
+ }
6264
+ }
6237
6265
  yield page == null ? void 0 : page.waitForTimeout(waitForTimeout || 0);
6238
6266
  yield executeDocumentScripts(ctx, page, "beforeSnapshot", beforeSnapshotScript);
6239
6267
  discoveryErrors.name = name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.53",
3
+ "version": "4.1.54-beta.0",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"