Skip to content

Commit 4fd3bad

Browse files
committed
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.
1 parent b87c999 commit 4fd3bad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/integration/viewer_spec.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,10 +1453,12 @@ describe("PDF viewer", () => {
14531453
const rect = await getRect(page, annotationSelector);
14541454
const containerRect = await getRect(page, "#viewerContainer");
14551455
expect(
1456-
Math.abs(2 * (rect.y - containerRect.y) - containerRect.height)
1456+
Math.abs(
1457+
2 * (Math.ceil(rect.y) - containerRect.y) - containerRect.height
1458+
)
14571459
)
14581460
.withContext(`In ${browserName}`)
1459-
.toBeLessThan(1);
1461+
.toBeLessThanOrEqual(1);
14601462
})
14611463
);
14621464
});

0 commit comments

Comments
 (0)