gui tests: allow-ips wheels Remove into view before it clicks it

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.
This commit is contained in:
yetone
2026-10-13 20:39:39 +08:00
parent 4325e9970d
commit bf6393f9bd
+13 -2
View File
@@ -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");