@lambdatest/smartui-cli 4.1.52 → 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.
- package/dist/index.cjs +40 -7
- 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.
|
|
2898
|
+
var version = "4.1.54-beta.0";
|
|
2899
2899
|
var package_default = {
|
|
2900
2900
|
name: "@lambdatest/smartui-cli",
|
|
2901
2901
|
version,
|
|
@@ -3662,7 +3662,7 @@ var httpClient = class {
|
|
|
3662
3662
|
}
|
|
3663
3663
|
});
|
|
3664
3664
|
}
|
|
3665
|
-
uploadPdf(ctx, form, buildName) {
|
|
3665
|
+
uploadPdf(ctx, form, buildName, pdfNames) {
|
|
3666
3666
|
return __async(this, null, function* () {
|
|
3667
3667
|
form.append("projectToken", this.projectToken);
|
|
3668
3668
|
if (ctx.build.name !== void 0 && ctx.build.name !== "") {
|
|
@@ -3671,6 +3671,9 @@ var httpClient = class {
|
|
|
3671
3671
|
if (ctx.options.markBaseline) {
|
|
3672
3672
|
form.append("markBaseline", ctx.options.markBaseline.toString());
|
|
3673
3673
|
}
|
|
3674
|
+
if (pdfNames && pdfNames !== "") {
|
|
3675
|
+
form.append("pdfNames", pdfNames);
|
|
3676
|
+
}
|
|
3674
3677
|
try {
|
|
3675
3678
|
const response = yield this.axiosInstance.request({
|
|
3676
3679
|
url: ctx.env.SMARTUI_UPLOAD_URL + "/pdf/upload",
|
|
@@ -3924,7 +3927,8 @@ var ctx_default = (options) => {
|
|
|
3924
3927
|
githubURL: options.gitURL || options.githubURL || "",
|
|
3925
3928
|
showRenderErrors: options.showRenderErrors ? true : false,
|
|
3926
3929
|
userName: options.userName || "",
|
|
3927
|
-
accessKey: options.accessKey || ""
|
|
3930
|
+
accessKey: options.accessKey || "",
|
|
3931
|
+
pdfNames: options.pdfNames || ""
|
|
3928
3932
|
},
|
|
3929
3933
|
cliVersion: version,
|
|
3930
3934
|
totalSnapshots: -1,
|
|
@@ -6023,6 +6027,17 @@ var createBuild_default = (ctx) => {
|
|
|
6023
6027
|
rendererOptions: { persistentOutput: true }
|
|
6024
6028
|
};
|
|
6025
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
|
+
}
|
|
6026
6041
|
function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, renderViewports) {
|
|
6027
6042
|
return __async(this, null, function* () {
|
|
6028
6043
|
ctx.log.debug(`*** urlConfig ${JSON.stringify(urlConfig)}`);
|
|
@@ -6229,7 +6244,24 @@ function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, rend
|
|
|
6229
6244
|
}
|
|
6230
6245
|
let ssPath = `screenshots/${ssId}/${`${browserName}-${viewport.width}x${viewport.height}`}-${ssId}.png`;
|
|
6231
6246
|
yield page == null ? void 0 : page.setViewportSize({ width: viewport.width, height: viewport.height || constants_default.MIN_VIEWPORT_HEIGHT });
|
|
6232
|
-
|
|
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
|
+
}
|
|
6233
6265
|
yield page == null ? void 0 : page.waitForTimeout(waitForTimeout || 0);
|
|
6234
6266
|
yield executeDocumentScripts(ctx, page, "beforeSnapshot", beforeSnapshotScript);
|
|
6235
6267
|
discoveryErrors.name = name;
|
|
@@ -7529,18 +7561,19 @@ function uploadPdfs(ctx, pdfPath) {
|
|
|
7529
7561
|
formData.append("pathToFiles", fs6__default.default.createReadStream(pdfPath));
|
|
7530
7562
|
} else {
|
|
7531
7563
|
const files = fs6__default.default.readdirSync(pdfPath);
|
|
7532
|
-
const pdfFiles = files.filter((file) => file.endsWith(".pdf"));
|
|
7564
|
+
const pdfFiles = files.filter((file) => file.endsWith(".pdf")).sort();
|
|
7533
7565
|
pdfFiles.forEach((pdf) => {
|
|
7534
7566
|
const filePath = path3__default.default.join(pdfPath, pdf);
|
|
7535
7567
|
formData.append("pathToFiles", fs6__default.default.createReadStream(filePath));
|
|
7536
7568
|
});
|
|
7537
7569
|
}
|
|
7538
7570
|
const buildName = ctx.options.buildName;
|
|
7571
|
+
const pdfNames = ctx.options.pdfNames;
|
|
7539
7572
|
if (buildName) {
|
|
7540
7573
|
ctx.build.name = buildName;
|
|
7541
7574
|
}
|
|
7542
7575
|
try {
|
|
7543
|
-
const response = yield ctx.client.uploadPdf(ctx, formData, buildName);
|
|
7576
|
+
const response = yield ctx.client.uploadPdf(ctx, formData, buildName, pdfNames);
|
|
7544
7577
|
if (response && response.buildId) {
|
|
7545
7578
|
ctx.build.id = response.buildId;
|
|
7546
7579
|
ctx.log.debug(`PDF upload successful. Build ID: ${ctx.build.id}`);
|
|
@@ -7556,7 +7589,7 @@ function uploadPdfs(ctx, pdfPath) {
|
|
|
7556
7589
|
|
|
7557
7590
|
// src/commander/uploadPdf.ts
|
|
7558
7591
|
var command10 = new commander.Command();
|
|
7559
|
-
command10.name("upload-pdf").description("Upload PDFs for visual comparison").argument("<directory>", "Path of the directory containing PDFs").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--markBaseline", "Mark this build baseline").action(function(directory, _, command11) {
|
|
7592
|
+
command10.name("upload-pdf").description("Upload PDFs for visual comparison").argument("<directory>", "Path of the directory containing PDFs").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--markBaseline", "Mark this build baseline").option("--pdfNames <string>", "Specify PDF names for the upload").action(function(directory, _, command11) {
|
|
7560
7593
|
return __async(this, null, function* () {
|
|
7561
7594
|
const options = command11.optsWithGlobals();
|
|
7562
7595
|
if (options.buildName === "") {
|