From e5fc583a980d9038bea7b0b5ab79faf2c515ffab Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 29 Oct 2026 16:58:58 +0800 Subject: [PATCH] gui tests: plugin-move reads where the reader scrolled once WebKit's wheel settles plugin-move's "moves to its plugin for good" scrolls the editor with 30px wheel steps 80ms apart and records scrollTop as the place the move must keep. In WebKit the last step can still be landing when it is read: 367, then 397 600ms later, with nothing pressed yet. The move kept the editor where it was, and the test called it moved ("the failure moved the editor", 397 !== 367). On main the editor's Advanced section ends sooner, so the timing happened to work there. #4145's Reply headers field makes the editor taller, and webkit en and zh went red 2 of 2 alone at that head on WSL. The place is now read once two reads 150ms apart agree. This waits on the state, not a duration. Run (wsl-run, magpie-desktop, Playwright 1.62.0) at this commit plus #4145: - plugin-move.test.cjs alone, chromium and webkit, en and zh: 8 of 8. - A diagnostic print showed top 367 / 600ms later 397 / end 397 in webkit en, and 235 / 265 / 265 in zh. Chromium settles at once. - Broken by hand: scrolling the editor 40px between the press and the failure turns all 4 "for good" subtests red with "the failure moved the editor". - Alone on origin/main c201fe226 without this change: 8 of 8. --- internal/gui/tests/plugin-move.test.cjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/gui/tests/plugin-move.test.cjs b/internal/gui/tests/plugin-move.test.cjs index edc0fb884..bff18d0ce 100644 --- a/internal/gui/tests/plugin-move.test.cjs +++ b/internal/gui/tests/plugin-move.test.cjs @@ -134,7 +134,16 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.waitForTimeout(80); if (await at() === was) break; } - const top = await at(); + // WebKit can still be applying the last wheel when the loop ends + // (367, then 397 a moment later): the place the reader left is + // where the scroll settles, two reads 150ms apart agreeing + let top = await at(); + for (let i = 0; i < 40; i++) { + await page.waitForTimeout(150); + const now = await at(); + if (now === top) break; + top = now; + } assert.ok(top > 0, "the editor doesn't scroll: the test proves nothing about keeping its place"); // a press where the button is, as the reader's mouse does const press = async () => {