@lambdatest/smartui-cli 4.0.9 → 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 +45 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -853,6 +853,8 @@ var env_default = () => {
|
|
|
853
853
|
SMARTUI_DO_NOT_USE_CAPTURED_COOKIES,
|
|
854
854
|
HTTP_PROXY,
|
|
855
855
|
HTTPS_PROXY,
|
|
856
|
+
SMARTUI_HTTP_PROXY,
|
|
857
|
+
SMARTUI_HTTPS_PROXY,
|
|
856
858
|
GITHUB_ACTIONS,
|
|
857
859
|
FIGMA_TOKEN,
|
|
858
860
|
LT_USERNAME,
|
|
@@ -867,6 +869,8 @@ var env_default = () => {
|
|
|
867
869
|
SMARTUI_GIT_INFO_FILEPATH,
|
|
868
870
|
HTTP_PROXY,
|
|
869
871
|
HTTPS_PROXY,
|
|
872
|
+
SMARTUI_HTTP_PROXY,
|
|
873
|
+
SMARTUI_HTTPS_PROXY,
|
|
870
874
|
GITHUB_ACTIONS,
|
|
871
875
|
FIGMA_TOKEN,
|
|
872
876
|
LT_USERNAME,
|
|
@@ -951,7 +955,7 @@ var auth_default = (ctx) => {
|
|
|
951
955
|
};
|
|
952
956
|
|
|
953
957
|
// package.json
|
|
954
|
-
var version = "4.0.
|
|
958
|
+
var version = "4.0.11";
|
|
955
959
|
var package_default = {
|
|
956
960
|
name: "@lambdatest/smartui-cli",
|
|
957
961
|
version,
|
|
@@ -1771,6 +1775,8 @@ function processSnapshot(snapshot, ctx) {
|
|
|
1771
1775
|
if (!((_b = ctx.browser) == null ? void 0 : _b.isConnected())) {
|
|
1772
1776
|
if (ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY)
|
|
1773
1777
|
launchOptions.proxy = { server: ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY };
|
|
1778
|
+
if (ctx.env.SMARTUI_HTTP_PROXY || ctx.env.SMARTUI_HTTPS_PROXY)
|
|
1779
|
+
launchOptions.proxy = { server: ctx.env.SMARTUI_HTTP_PROXY || ctx.env.SMARTUI_HTTPS_PROXY };
|
|
1774
1780
|
ctx.browser = yield test.chromium.launch(launchOptions);
|
|
1775
1781
|
ctx.log.debug(`Chromium launched with options ${JSON.stringify(launchOptions)}`);
|
|
1776
1782
|
}
|
|
@@ -2011,6 +2017,30 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2011
2017
|
throw new Error(`for snapshot ${snapshot.name} viewport ${viewportString}, multiple elements found for selector ${processedOptions.element}`);
|
|
2012
2018
|
}
|
|
2013
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}`);
|
|
2014
2044
|
let locators = [];
|
|
2015
2045
|
if (!Array.isArray(processedOptions[ignoreOrSelectBoxes][viewportString]))
|
|
2016
2046
|
processedOptions[ignoreOrSelectBoxes][viewportString] = [];
|
|
@@ -2024,13 +2054,20 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2024
2054
|
}
|
|
2025
2055
|
for (const locator of locators) {
|
|
2026
2056
|
let bb = yield locator.boundingBox();
|
|
2027
|
-
if (bb)
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
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
|
+
}
|
|
2034
2071
|
}
|
|
2035
2072
|
}
|
|
2036
2073
|
ctx.log.debug(`Processed options: ${JSON.stringify(processedOptions)}`);
|