gui tests: context-tune waits for the picker's box while the row re-renders under the wheel (#4221)

"webkit: a window of the reader's own" read
`(await row.locator(".ctx-tune-pick").boundingBox()).y` in its scroll
loop. When the row re-renders after the history answers, the picker has
no box for a moment, boundingBox() returns null and the test throws
"Cannot read properties of null (reading 'y')" (zh-TW 360x760 in a WSL
run). The loop now waits up to ~1s for a box and fails with a plain
message if none comes.

Run (WSL, magpie-desktop, at this tree on origin/main f41b63232):
- context-tune, i18n-keys, gui-zh-tw, gui-ja, gui-de with
  --test-concurrency=2 (Chromium + WebKit): 127 of 127 pass
Broken by hand: a copy of the test that hides the picker for 150ms just
before the scroll loop fails every case of "a window of the reader's
own" with the #4221 error on the old loop, and passes 22 of 22 with the
new one.
Not tried: reproducing the original re-render timing without injection.
This commit is contained in:
yetone
2026-10-29 18:01:01 +08:00
parent f41b63232a
commit fff5ad0ef7
+11 -1
View File
@@ -239,7 +239,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.locator(".ctx-none").waitFor(); // the history has answered: the pane is its full length
// the reader scrolls to the picker, as a wheel does
await page.mouse.move(width / 2, 300);
for (let i = 0; i < 20 && (await row.locator(".ctx-tune-pick").boundingBox()).y > height * 0.6; i++) {
// the row can re-render under the wheel, and a picker being replaced has no box
// for a moment: wait for one instead of reading null (#4221)
const pickY = async () => {
for (let i = 0; i < 50; i++) {
const b = await row.locator(".ctx-tune-pick").boundingBox();
if (b) return b.y;
await page.waitForTimeout(20);
}
throw new Error("the picker never had a box");
};
for (let i = 0; i < 20 && (await pickY()) > height * 0.6; i++) {
await page.mouse.wheel(0, 120);
await page.waitForTimeout(60);
}