diff --git a/packages/app/e2e/support/helpers/sidebar-nav-settings.ts b/packages/app/e2e/support/helpers/sidebar-nav-settings.ts index c3ed13ea67..a8c64f712e 100644 --- a/packages/app/e2e/support/helpers/sidebar-nav-settings.ts +++ b/packages/app/e2e/support/helpers/sidebar-nav-settings.ts @@ -225,6 +225,9 @@ const FOOTER_ICON_TEST_IDS = [ "sidebar-settings", ]; +// Browser layout boxes include floating-point rounding, even for whole-pixel styles. +const FOOTER_GEOMETRY_TOLERANCE = 0.01; + /** * One line of same-size icons: Add project, Usage and Hosts together on the left, Help and * Settings together at the end. @@ -240,10 +243,12 @@ export async function expectFooterIconRow(page: Page): Promise { const [first] = boxes; for (const box of boxes) { expect(Math.abs(box.y + box.height / 2 - first!.y - first!.height / 2)).toBeLessThan(2); - expect(box.width).toBe(first!.width); + expect(Math.abs(box.width - first!.width)).toBeLessThan(FOOTER_GEOMETRY_TOLERANCE); } const gaps = boxes.slice(1).map((box, index) => box.x - (boxes[index]!.x + boxes[index]!.width)); - expect(gaps).toEqual([0, 0, expect.any(Number), 0]); + for (const index of [0, 1, 3]) { + expect(Math.abs(gaps[index]!)).toBeLessThan(FOOTER_GEOMETRY_TOLERANCE); + } expect(gaps[2]).toBeGreaterThan(first!.width); }