test(ui): compare the composer height with a sub-pixel tolerance

Chromium reported 175.99998 px before focus and 176 px after, so the
exact toBe check failed in about half of the runs. Allow half a pixel.

Assisted-by: Claude:claude-sonnet-5-5 playwright
This commit is contained in:
Ettore Di Giacinto committed 2026-11-03 23:14:30 +00:00
1 parent ca284491aa
commit 48bc71c38a
1 file changed
+2 -1
+2 -1
View File
@@ -69,7 +69,8 @@ test.describe('Home composer', () => {
await expect(card).toHaveCSS('box-shadow', /inset/)
await expect(box).toHaveCSS('outline-style', 'none')
await expect(box).toHaveCSS('box-shadow', 'none')
expect((await card.boundingBox()).height).toBe(before)
// Layout rounds to 1/64 px, so compare with a sub-pixel tolerance.
expect(Math.abs((await card.boundingBox()).height - before)).toBeLessThan(0.5)
// the control that takes keyboard focus next keeps its own ring
await page.keyboard.press('Shift+Tab')
await expect(card.locator(':focus-visible')).toHaveCSS('outline-style', 'solid')