@lambdatest/smartui-cli 4.1.34 → 4.1.36
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 +55 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1166,6 +1166,14 @@ var SnapshotSchema = {
|
|
|
1166
1166
|
minimum: 0,
|
|
1167
1167
|
maximum: 100,
|
|
1168
1168
|
errorMessage: "Invalid snapshot options; rejectionThreshold must be a number between 0 and 100"
|
|
1169
|
+
},
|
|
1170
|
+
customCookies: {
|
|
1171
|
+
type: "array",
|
|
1172
|
+
items: {
|
|
1173
|
+
type: "object",
|
|
1174
|
+
minProperties: 1
|
|
1175
|
+
},
|
|
1176
|
+
errorMessage: "Invalid snapshot options; customCookies must be an array of objects with string properties"
|
|
1169
1177
|
}
|
|
1170
1178
|
},
|
|
1171
1179
|
additionalProperties: false
|
|
@@ -1887,10 +1895,11 @@ function startPdfPolling(ctx) {
|
|
|
1887
1895
|
const maxAttempts = 60;
|
|
1888
1896
|
console.log(chalk__default.default.yellow("Waiting for results..."));
|
|
1889
1897
|
const interval = setInterval(() => __async(this, null, function* () {
|
|
1898
|
+
var _a;
|
|
1890
1899
|
attempts++;
|
|
1891
1900
|
try {
|
|
1892
1901
|
const response = yield ctx.client.fetchPdfResults(ctx);
|
|
1893
|
-
if (response.screenshots) {
|
|
1902
|
+
if (response.screenshots && ((_a = response.build) == null ? void 0 : _a.build_status) === constants_default.BUILD_COMPLETE) {
|
|
1894
1903
|
clearInterval(interval);
|
|
1895
1904
|
const pdfGroups = groupScreenshotsByPdf(response.screenshots);
|
|
1896
1905
|
const pdfsWithMismatches = countPdfsWithMismatches(pdfGroups);
|
|
@@ -2479,7 +2488,7 @@ var authExec_default = (ctx) => {
|
|
|
2479
2488
|
};
|
|
2480
2489
|
|
|
2481
2490
|
// package.json
|
|
2482
|
-
var version = "4.1.
|
|
2491
|
+
var version = "4.1.36";
|
|
2483
2492
|
var package_default = {
|
|
2484
2493
|
name: "@lambdatest/smartui-cli",
|
|
2485
2494
|
version,
|
|
@@ -3152,6 +3161,9 @@ var httpClient = class {
|
|
|
3152
3161
|
if (ctx.build.name !== void 0 && ctx.build.name !== "") {
|
|
3153
3162
|
form.append("buildName", buildName);
|
|
3154
3163
|
}
|
|
3164
|
+
if (ctx.options.markBaseline) {
|
|
3165
|
+
form.append("markBaseline", ctx.options.markBaseline.toString());
|
|
3166
|
+
}
|
|
3155
3167
|
try {
|
|
3156
3168
|
const response = yield this.axiosInstance.request({
|
|
3157
3169
|
url: ctx.env.SMARTUI_UPLOAD_URL + "/pdf/upload",
|
|
@@ -4004,6 +4016,39 @@ function processSnapshot(snapshot, ctx) {
|
|
|
4004
4016
|
ctx.log.debug("No valid cookies to add");
|
|
4005
4017
|
}
|
|
4006
4018
|
}
|
|
4019
|
+
let options = snapshot.options;
|
|
4020
|
+
if ((options == null ? void 0 : options.customCookies) && Array.isArray(options.customCookies) && options.customCookies.length > 0) {
|
|
4021
|
+
ctx.log.debug(`Setting ${options.customCookies.length} custom cookies`);
|
|
4022
|
+
const validCustomCookies = options.customCookies.filter((cookie) => {
|
|
4023
|
+
if (!cookie.name || !cookie.value || !cookie.domain) {
|
|
4024
|
+
ctx.log.debug(`Skipping invalid custom cookie: missing required fields (name, value, or domain)`);
|
|
4025
|
+
return false;
|
|
4026
|
+
}
|
|
4027
|
+
if (cookie.sameSite && !["Strict", "Lax", "None"].includes(cookie.sameSite)) {
|
|
4028
|
+
ctx.log.debug(`Skipping invalid custom cookie: invalid sameSite value '${cookie.sameSite}'`);
|
|
4029
|
+
return false;
|
|
4030
|
+
}
|
|
4031
|
+
return true;
|
|
4032
|
+
}).map((cookie) => ({
|
|
4033
|
+
name: cookie.name,
|
|
4034
|
+
value: cookie.value,
|
|
4035
|
+
domain: cookie.domain,
|
|
4036
|
+
path: cookie.path || "/",
|
|
4037
|
+
httpOnly: cookie.httpOnly || false,
|
|
4038
|
+
secure: cookie.secure || false,
|
|
4039
|
+
sameSite: cookie.sameSite || "Lax"
|
|
4040
|
+
}));
|
|
4041
|
+
if (validCustomCookies.length > 0) {
|
|
4042
|
+
try {
|
|
4043
|
+
yield context.addCookies(validCustomCookies);
|
|
4044
|
+
ctx.log.debug(`Successfully added ${validCustomCookies.length} custom cookies`);
|
|
4045
|
+
} catch (error) {
|
|
4046
|
+
ctx.log.debug(`Failed to add custom cookies: ${error}`);
|
|
4047
|
+
}
|
|
4048
|
+
} else {
|
|
4049
|
+
ctx.log.debug("No valid custom cookies to add");
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4007
4052
|
const page = yield context.newPage();
|
|
4008
4053
|
let cache = {};
|
|
4009
4054
|
if (snapshot.dom.resources.length) {
|
|
@@ -4159,7 +4204,6 @@ function processSnapshot(snapshot, ctx) {
|
|
|
4159
4204
|
route.abort();
|
|
4160
4205
|
}
|
|
4161
4206
|
}));
|
|
4162
|
-
let options = snapshot.options;
|
|
4163
4207
|
let optionWarnings = /* @__PURE__ */ new Set();
|
|
4164
4208
|
let selectors = [];
|
|
4165
4209
|
let ignoreOrSelectDOM;
|
|
@@ -4299,6 +4343,9 @@ function processSnapshot(snapshot, ctx) {
|
|
|
4299
4343
|
yield new Promise((r) => setTimeout(r, 1250));
|
|
4300
4344
|
if (ctx.config.waitForTimeout)
|
|
4301
4345
|
yield page.waitForTimeout(ctx.config.waitForTimeout);
|
|
4346
|
+
yield page.waitForLoadState("networkidle", { timeout: 1e4 }).catch(() => {
|
|
4347
|
+
ctx.log.debug("networkidle event failed to fire within 10s");
|
|
4348
|
+
});
|
|
4302
4349
|
navigated = true;
|
|
4303
4350
|
ctx.log.debug(`Navigated to ${snapshot.url}`);
|
|
4304
4351
|
} catch (error) {
|
|
@@ -4321,7 +4368,7 @@ function processSnapshot(snapshot, ctx) {
|
|
|
4321
4368
|
if (ctx.config.cliEnableJavaScript && fullPage)
|
|
4322
4369
|
yield page.evaluate(scrollToBottomAndBackToTop, { frequency: 100, timing: ctx.config.scrollTime });
|
|
4323
4370
|
try {
|
|
4324
|
-
yield page.waitForLoadState("networkidle", { timeout:
|
|
4371
|
+
yield page.waitForLoadState("networkidle", { timeout: 15e3 });
|
|
4325
4372
|
ctx.log.debug("Network idle 500ms");
|
|
4326
4373
|
} catch (error) {
|
|
4327
4374
|
ctx.log.debug(`Network idle failed due to ${error}`);
|
|
@@ -5237,7 +5284,9 @@ function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, rend
|
|
|
5237
5284
|
ctx.log.debug(`url: ${url} pageOptions: ${JSON.stringify(pageOptions)}`);
|
|
5238
5285
|
let ssId = name.toLowerCase().replace(/\s/g, "_");
|
|
5239
5286
|
let context;
|
|
5240
|
-
let contextOptions = {
|
|
5287
|
+
let contextOptions = {
|
|
5288
|
+
ignoreHTTPSErrors: ctx.config.ignoreHTTPSErrors
|
|
5289
|
+
};
|
|
5241
5290
|
let page;
|
|
5242
5291
|
if (browserName == constants_default.CHROME)
|
|
5243
5292
|
contextOptions.userAgent = constants_default.CHROME_USER_AGENT;
|
|
@@ -6597,7 +6646,7 @@ function uploadPdfs(ctx, pdfPath) {
|
|
|
6597
6646
|
|
|
6598
6647
|
// src/commander/uploadPdf.ts
|
|
6599
6648
|
var command10 = new commander.Command();
|
|
6600
|
-
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").action(function(directory, _, command11) {
|
|
6649
|
+
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) {
|
|
6601
6650
|
return __async(this, null, function* () {
|
|
6602
6651
|
const options = command11.optsWithGlobals();
|
|
6603
6652
|
if (options.buildName === "") {
|