usage-sessions-agents-fit test: in WebKit the last agent is clicked as an element — the test failed ~70% of runs in WebKit, en and zh (a timeout waiting for Zed to be picked), and had since c6e318e1 added it: no commit turned it red. Playwright's WebKit stops hit-testing a scroller's children once it has been scrolled: on a bare page with a display:flex, overflow-x:auto strip, after scrollLeft is set every click on its buttons lands on the strip (57/57 lost; Chromium 0/58), elementFromPoint gives the strip from the next frame on, and in this test a wheel scroll does it too. The system's WKWebView, which the Mac app uses, takes the click: the same page in a WKWebView in an AppKit window, scrolled the same way, hit-tests and clicks the button. So it isn't the app. Chromium still clicks with the mouse; WebKit clicks the button through the DOM, which runs the same onclick and redraw. What the test guards is kept: with the button reuse and the bring-into-view both taken out of app.js, the WebKit cases still fail ("the picked agent stays in view"). No app change.

Verified: usage-sessions-agents-fit 8/8 runs green in Chromium and WebKit, en and zh; also at 440px (a copy with 860/440); sess-agent-strip, sessions-toolbar and sessions-usage-open pass. sessions-overview's WebKit en case fails 2 runs in 3 on its own, with "ResizeObserver loop completed with undelivered notifications" caught as a page error, a different cause, not in this commit.
This commit is contained in:
yetone committed 2026-10-06 13:51:38 +08:00
1 parent c0c3b20b95
commit b45fe28c9d
1 file changed
+9 -2
@@ -72,8 +72,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// the strip drawn again kept its buttons and where it was scrolled
await strip.evaluate((e) => { e.scrollLeft = e.scrollWidth; });
const last = strip.locator(".opt").last();
const lb = await last.boundingBox();
await page.mouse.click(lb.x + lb.width / 2, lb.y + lb.height / 2);
// Playwright's WebKit stops hit-testing a scroller's children once it
// has been scrolled (a click lands on the strip, ~70% of runs; the
// system's WKWebView takes it, tried from a WKWebView in AppKit), so
// there the button is clicked as an element
if (engine === "webkit") await last.evaluate((b) => b.click());
else {
const lb = await last.boundingBox();
await page.mouse.click(lb.x + lb.width / 2, lb.y + lb.height / 2);
}
await page.waitForFunction(() => document.querySelector("#sessAgent .opt.on")?.textContent === "Zed");
await settle();
assert.equal(await strip.getByRole("button", { pressed: true }).textContent(), "Zed", "the reused button exposes its new selection");