From bf6393f9bdb91ecbcadd67b37421da775d6ce768 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 13 Oct 2026 20:39:22 +0800 Subject: [PATCH] gui tests: allow-ips wheels Remove into view before it clicks it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Chinese the 10.0.0.0/8 row's Remove sat at 521–544, with the view's foot at 532. Playwright's scroll before the click is put back (a scroll that isn't the reader's, #1554), so the window's foot (#status) took the click. This was red every run on a75de4c21 in WebKit zh. The test now wheels the button into view as a reader would. Run: allow-ips.test.cjs, 7/7 in WebKit and 7/7 in Chromium. --- internal/gui/tests/allow-ips.test.cjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/gui/tests/allow-ips.test.cjs b/internal/gui/tests/allow-ips.test.cjs index 67e1acb20..0cc728dfe 100644 --- a/internal/gui/tests/allow-ips.test.cjs +++ b/internal/gui/tests/allow-ips.test.cjs @@ -196,9 +196,20 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await scroll(), before, "a refusal moved the page"); await fits(box); - // taken away with its Remove + // taken away with its Remove, wheeled into view first as a reader + // would: the list grew under the field, and in Chinese the button + // sat under the window's foot, where a click lands on the foot (a + // scroll that isn't the reader's is put back, #1554) + const remove = box.locator(".allow-ip-row").filter({ hasText: "10.0.0.0/8" }).locator("button", { hasText: w.remove }); + const viewBox = await view.boundingBox(); + for (let i = 0; i < 20; i++) { + const r = await remove.boundingBox(); + if (r && r.y > viewBox.y && r.y + r.height < viewBox.y + viewBox.height) break; + await page.mouse.wheel(0, 40); + await scroll(); + } before = await scroll(); - await box.locator(".allow-ip-row").filter({ hasText: "10.0.0.0/8" }).locator("button", { hasText: w.remove }).click(); + await remove.click(); await page.waitForFunction(() => document.querySelectorAll("#allowList .allow-ip-row").length === 2); assert.deepEqual(posts.at(-1), ["203.0.113.50", "2001:db8::/32"]); assert.equal(await scroll(), before, "Remove moved the page");