From e0b64e5895d76510211bc6a561658e2deba0a06a Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Thu, 5 Nov 2026 18:34:52 -0800 Subject: [PATCH] Let the note tray go quiet before the Ask picview test opens a picture AI Assisted --- scripts/test-web-console-page-ask.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/test-web-console-page-ask.mjs b/scripts/test-web-console-page-ask.mjs index 6e0f17a..6538776 100644 --- a/scripts/test-web-console-page-ask.mjs +++ b/scripts/test-web-console-page-ask.mjs @@ -197,6 +197,24 @@ test("a picture thumbnail opens the picview from the note tray and a sent Ask me const aside = s.page.locator("#aside"); await aside.locator('input[type="file"]').setInputFiles({ name: "shot.png", mimeType: "image/png", buffer: PNG }); await aside.locator(".attach-thumb.is-ready").waitFor(); + // The tray can redraw a moment after an upload lands (the state it rides on arrives by event), + // and a redraw after Esc would take the restored focus with the old button: let it go quiet first. + await aside.evaluate( + (n) => + new Promise((resolve) => { + let timer; + const done = () => { + observer.disconnect(); + resolve(); + }; + const observer = new MutationObserver(() => { + clearTimeout(timer); + timer = setTimeout(done, 500); + }); + observer.observe(n, { subtree: true, childList: true, attributes: true }); + timer = setTimeout(done, 500); + }) + ); await aside.locator(".attach-open").click(); await s.page.locator("#picview[open]").waitFor();