From 0cb540c3f80fe8618e1a48cdb0cd7a50ead75ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A4=A7=E7=8C=AB?= <16399091+binaricat@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:33:45 +0800 Subject: [PATCH] fix(ci): wait for plugin log dialog focus cleanup --- components/settings/tabs/PluginLogSettings.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/settings/tabs/PluginLogSettings.test.tsx b/components/settings/tabs/PluginLogSettings.test.tsx index ccd3095f2..9cb567bfb 100644 --- a/components/settings/tabs/PluginLogSettings.test.tsx +++ b/components/settings/tabs/PluginLogSettings.test.tsx @@ -66,9 +66,15 @@ test('local logging controls default off, disclose verbose risk, and call host-o assert.match(document.querySelector('[role=alert]')!.textContent!, /synthetic preferences write failed/); await act(async () => button('Close').click()); assert.equal(document.querySelector('[role=dialog]'), null); - assert.equal(document.activeElement, configure); + // Radix restores focus in a setTimeout(0) after the dialog unmounts. + // act() can finish before that timer, so drain it before checking focus. + await new Promise((resolve) => setTimeout(resolve, 0)); + // Comparing DOM objects directly makes Node inspect the entire JSDOM graph + // on failure, which can stall the test process while formatting the diff. + assert.ok(document.activeElement === configure, `expected focus on Configure, got ${document.activeElement?.tagName}`); } finally { await act(async () => root.unmount()); + await new Promise((resolve) => setTimeout(resolve, 0)); dom.window.close(); for (const [key, descriptor] of previous) { if (descriptor) Object.defineProperty(globalThis, key, descriptor);