@lambdatest/smartui-cli 4.0.10 → 4.0.11
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 +39 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -955,7 +955,7 @@ var auth_default = (ctx) => {
|
|
|
955
955
|
};
|
|
956
956
|
|
|
957
957
|
// package.json
|
|
958
|
-
var version = "4.0.
|
|
958
|
+
var version = "4.0.11";
|
|
959
959
|
var package_default = {
|
|
960
960
|
name: "@lambdatest/smartui-cli",
|
|
961
961
|
version,
|
|
@@ -2017,6 +2017,30 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2017
2017
|
throw new Error(`for snapshot ${snapshot.name} viewport ${viewportString}, multiple elements found for selector ${processedOptions.element}`);
|
|
2018
2018
|
}
|
|
2019
2019
|
} else if (selectors.length) {
|
|
2020
|
+
let height = 0;
|
|
2021
|
+
height = yield page.evaluate(() => {
|
|
2022
|
+
const DEFAULT_HEIGHT = 16384;
|
|
2023
|
+
const body = document.body;
|
|
2024
|
+
const html = document.documentElement;
|
|
2025
|
+
if (!body || !html) {
|
|
2026
|
+
ctx.log.debug("Document body or html element is missing, using default height");
|
|
2027
|
+
return DEFAULT_HEIGHT;
|
|
2028
|
+
}
|
|
2029
|
+
const measurements = [
|
|
2030
|
+
(body == null ? void 0 : body.scrollHeight) || 0,
|
|
2031
|
+
(body == null ? void 0 : body.offsetHeight) || 0,
|
|
2032
|
+
(html == null ? void 0 : html.clientHeight) || 0,
|
|
2033
|
+
(html == null ? void 0 : html.scrollHeight) || 0,
|
|
2034
|
+
(html == null ? void 0 : html.offsetHeight) || 0
|
|
2035
|
+
];
|
|
2036
|
+
const allMeasurementsInvalid = measurements.every((measurement) => !measurement);
|
|
2037
|
+
if (allMeasurementsInvalid) {
|
|
2038
|
+
ctx.log.debug("All height measurements are invalid, using default height");
|
|
2039
|
+
return DEFAULT_HEIGHT;
|
|
2040
|
+
}
|
|
2041
|
+
return Math.max(...measurements);
|
|
2042
|
+
});
|
|
2043
|
+
ctx.log.debug(`Calculated content height: ${height}`);
|
|
2020
2044
|
let locators = [];
|
|
2021
2045
|
if (!Array.isArray(processedOptions[ignoreOrSelectBoxes][viewportString]))
|
|
2022
2046
|
processedOptions[ignoreOrSelectBoxes][viewportString] = [];
|
|
@@ -2030,13 +2054,20 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2030
2054
|
}
|
|
2031
2055
|
for (const locator of locators) {
|
|
2032
2056
|
let bb = yield locator.boundingBox();
|
|
2033
|
-
if (bb)
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2057
|
+
if (bb) {
|
|
2058
|
+
const top = bb.y;
|
|
2059
|
+
const bottom = bb.y + bb.height;
|
|
2060
|
+
if (top <= height && bottom <= height) {
|
|
2061
|
+
processedOptions[ignoreOrSelectBoxes][viewportString].push({
|
|
2062
|
+
left: bb.x,
|
|
2063
|
+
top,
|
|
2064
|
+
right: bb.x + bb.width,
|
|
2065
|
+
bottom
|
|
2066
|
+
});
|
|
2067
|
+
} else {
|
|
2068
|
+
ctx.log.debug(`Bounding box for selector skipped due to exceeding height: ${JSON.stringify({ top, bottom, height })}`);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2040
2071
|
}
|
|
2041
2072
|
}
|
|
2042
2073
|
ctx.log.debug(`Processed options: ${JSON.stringify(processedOptions)}`);
|