From 60f87223c3a2fc2ef9848277e4a6e7be874c6051 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 6 Oct 2026 22:21:46 +0800 Subject: [PATCH] gui tests: skill-how clicks a By agent choice once its sheet has finished growing in (skill-how.test.cjs red on WebKit about 2 runs in 5, Codex's way posted "" where "link" was asked) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test's press() reads a button's box and clicks the middle of it with the mouse. The By agent sheet opens with the dialog's entrance, which grows it from about a third of its size, and on WebKit the box was read some 25 ms in (transform matrix(0.34…), Links 16 px wide at x 346); by the time the click landed the sheet had grown, and that point was over Library's way, left of Links. So Codex was given the library's way, and posts[2] said how "" in both en and zh. Chromium was mostly through the entrance by then. library.js has no race here: a click lands where the sheet is drawn when it lands. press() now waits until #modal has no running animations before reading the box, as other GUI tests do with getAnimations. Before: 3 of 6 WebKit runs failed with how '' at line 168 (a probe logged the box mid-entrance each time). After: 15 of 15 WebKit and 15 of 15 Chromium runs of skill-how.test.cjs pass. No change outside the test. --- internal/gui/tests/skill-how.test.cjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/gui/tests/skill-how.test.cjs b/internal/gui/tests/skill-how.test.cjs index 59ac05b3..a2dad193 100644 --- a/internal/gui/tests/skill-how.test.cjs +++ b/internal/gui/tests/skill-how.test.cjs @@ -61,7 +61,12 @@ function server(lang, posts) { } const scrolled = (page) => page.evaluate(() => [window.scrollX, window.scrollY, ...[...document.querySelectorAll("*")].filter((e) => e.scrollTop || e.scrollLeft).map((e) => `${e.className}:${e.scrollTop},${e.scrollLeft}`)].join(" ")); +// A click at the middle of loc, as a mouse gives it. The dialog grows in from +// a third of its size: a box read while it does is where the button was, not +// where it is when the click lands (Library's way, left of Links), so the +// dialog is let settle first. const press = async (page, loc) => { + await page.waitForFunction(() => !document.querySelector("#modal").getAnimations({ subtree: true }).length); const b = await loc.boundingBox(); await page.mouse.click(b.x + b.width / 2, b.y + b.height / 2); };