Tweak the "scroll into view" viewer integration test

On GitHub Actions this test could fail with `Expected 1.3125 to be less
than 1` due to slight differences in the decimals of the `rect.y` value.
However, for this check we're only really interested in full pixels, so
this commit rounds the value up to the next integer to not be affected
by small decimal differences so the test passes on GitHub Actions too.
This commit is contained in:
Tim van der Meij 2025-10-19 17:33:11 +02:00
parent b87c999815
commit 4fd3bad67f
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -1453,10 +1453,12 @@ describe("PDF viewer", () => {
const rect = await getRect(page, annotationSelector);
const containerRect = await getRect(page, "#viewerContainer");
expect(
Math.abs(2 * (rect.y - containerRect.y) - containerRect.height)
Math.abs(
2 * (Math.ceil(rect.y) - containerRect.y) - containerRect.height
)
)
.withContext(`In ${browserName}`)
.toBeLessThan(1);
.toBeLessThanOrEqual(1);
})
);
});