From b9ad353dbe183ca741ce142a9dee9f52267c71cd Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 1 Nov 2026 07:39:08 +0800 Subject: [PATCH] gui tests: editor-advanced-align measures the editor drawn last, once its observer has seen it Red in a whole GUI suite run on Linux and alone on mote, about 1 run in 8 at the accounts-at-once head (4 of 33), 0 of 31 at main 41b5c0f19: "ja 1000: Advanced starts at 292, its fields at 364", "zh web 390: Advanced starts at 106, its fields at 20". Each miss is the 86px fallback of --ed-at: the editor was drawn again between two frames, and the test measured the new details before edAlign's ResizeObserver had run for it. The user never sees that state, since the observer runs before the frame is painted. The test now waits until the current details has --ed-at, then two frames, then measures. Run on mote: head with this change, 20 runs alone, 0 red. Broken by hand (--ed-at 30px too far): red in both engines at en 1000. Not tried: why the accounts-at-once change makes the redraw land between frames more often; the extra field is inside the folded Advanced. --- internal/gui/tests/editor-advanced-align.test.cjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/gui/tests/editor-advanced-align.test.cjs b/internal/gui/tests/editor-advanced-align.test.cjs index ce8c8551c..a0091a507 100644 --- a/internal/gui/tests/editor-advanced-align.test.cjs +++ b/internal/gui/tests/editor-advanced-align.test.cjs @@ -68,6 +68,9 @@ for (const [engine, browserType] of [["chromium", chromium], ["webkit", webkit]] await page.locator(".row.provider", { hasText: "Claude Code" }).first().click(); const adv = page.locator(".editor details.advanced"); await adv.locator("summary").waitFor(); + // the editor drawn last has been laid out: a redraw between two + // frames measured a details its observer hadn't seen yet (86px) + await page.waitForFunction(() => document.querySelector(".editor details.advanced")?.style.getPropertyValue("--ed-at")); await page.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))); let m = await measure(page); const start = m.stacked ? m.edge : m.fields;