From 4cbde14cea7b41f6acef44cf33021eac9c65abe3 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 9 Oct 2026 13:31:30 +0800 Subject: [PATCH] gui tests: rate-limited-sink wheels the WorkBuddy AI pool's "Goes to the back" into sight before clicking it, as aab2e441 did for the group editor's rows (#1376) The pool sits under the 1400px window's foot. In WebKit Playwright's own scroll into view is put back by the page (it undoes a scroll the reader didn't make), so the click timed out with the option outside the viewport, en and zh. The test now wheels to it as the reader would, then reads the scroll position the "a click never scrolls the page" check compares against, so that check still covers the click alone. Ran: before the change, BROWSER=webkit: 2 pass, 2 fail (both "the Routing page sets it", "element is outside of the viewport"). After: Chromium + WebKit, en + zh (the languages this test covers), 3 runs of 8/8 pass, then WebKit alone 3 runs of 4/4 pass. --- internal/gui/tests/rate-limited-sink.test.cjs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/gui/tests/rate-limited-sink.test.cjs b/internal/gui/tests/rate-limited-sink.test.cjs index 64f219c8..58957eac 100644 --- a/internal/gui/tests/rate-limited-sink.test.cjs +++ b/internal/gui/tests/rate-limited-sink.test.cjs @@ -145,8 +145,18 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // the providers with several accounts: set at once const pool = page.locator(".rt-pool", { hasText: "WorkBuddy AI" }); await pool.waitFor(); + // the pool sits under the window's foot: wheeled to, as the reader + // would (WebKit's own scroll into view is put back by the page, which + // undoes a scroll the reader didn't make, and the click timed out + // with the option outside the viewport, #1376) + const back = pool.locator(".sink-pick .opt", { hasText: new RegExp(`^${w.back}$`) }); + await page.mouse.move(550, 600); + for (let i = 0; i < 10 && (await back.boundingBox()).y > 1400 - 260; i++) { + await page.mouse.wheel(0, 300); + await page.waitForTimeout(150); + } const y = await page.evaluate(() => document.scrollingElement.scrollTop); - await pool.locator(".sink-pick .opt", { hasText: new RegExp(`^${w.back}$`) }).click(); + await back.click(); await page.waitForTimeout(200); const sent = posts.find((p) => p.path === "/api/provider/sink"); assert.deepEqual(sent?.body, { id: "workbuddy-ai", sink: true });