From a7cee19912e86ab6fc63daeaec1ac28e7187d1b6 Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 14 Nov 2026 12:02:17 +0100 Subject: [PATCH] test(xlsx): wait for the formula bar to snap to a whole line The bar rounds its scroll position to a whole line in its scroll handler, which runs a frame after the browser scrolled the caret into view. The test read scrollTop right after typing and sometimes saw the browser's partial scroll (1.77 lines instead of 2); it now waits up to 2 s for the snap before asserting. Co-Authored-By: Claude Opus 5.5 --- e2e/xlsx.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/xlsx.spec.ts b/e2e/xlsx.spec.ts index 681373c..7b7d00b 100644 --- a/e2e/xlsx.spec.ts +++ b/e2e/xlsx.spec.ts @@ -117,7 +117,10 @@ describe('xlsx editing', () => { await v.page.keyboard.press('Alt+Enter') await v.page.keyboard.type('c') expect(await bar.inputValue()).toBe('a\nb\nc') - expect(await bar.evaluate((el) => el.scrollTop / parseFloat(getComputedStyle(el).lineHeight))).toBe(2) + // the bar snaps to a whole line in its scroll handler, a frame after the browser scrolled the caret into view + const lines = (el: HTMLElement) => el.scrollTop / parseFloat(getComputedStyle(el).lineHeight) + await v.page.waitForFunction((el) => el.scrollTop / parseFloat(getComputedStyle(el).lineHeight) === 2, await bar.elementHandle(), { timeout: 2000 }).catch(() => {}) + expect(await bar.evaluate(lines)).toBe(2) await v.page.keyboard.press('Enter') await v.page.waitForTimeout(200) expect(await v.shown('J12')).toBe('a\nb\nc')