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.
This commit is contained in:
yetone committed 2026-10-09 13:31:30 +08:00
1 parent 2c36d3f282
commit 4cbde14cea
1 file changed
+11 -1
+11 -1
View File
@@ -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 });