Skip to content

Commit efd505a

Browse files
Playwright - cap element screenshot height at viewport, add CI-matching Dockerfile
1 parent 9ab6522 commit efd505a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

e2e/testcafe-devextreme/playwright-helpers/screenshotUtils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ export async function getLocatorScrollClip(
66
return locator.evaluate((el) => {
77
const r = el.getBoundingClientRect();
88
const width = Math.max(el.scrollWidth, el.offsetWidth);
9-
const height = Math.max(el.scrollHeight, el.offsetHeight);
9+
const rawHeight = Math.max(el.scrollHeight, el.offsetHeight);
10+
const vh = window.innerHeight;
11+
const y = Math.max(0, Math.round(r.y));
12+
const maxHeight = vh - y;
13+
const height = Math.min(rawHeight, maxHeight);
1014
if (width === Math.round(r.width) && height === Math.round(r.height)) {
1115
return null;
1216
}
1317
return {
1418
x: Math.round(r.x),
15-
y: Math.round(r.y),
19+
y,
1620
width,
1721
height,
1822
};

0 commit comments

Comments
 (0)