From 87a04ca6f815d3c8f17be1ee0bb54dc8ead6b901 Mon Sep 17 00:00:00 2001 From: Epinephrine Date: Thu, 12 Nov 2026 17:58:31 +0900 Subject: [PATCH] test(gui): await the target-switch layout commit before assertions --- gui/tests/codex-account-pool-target-switch.test.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui/tests/codex-account-pool-target-switch.test.tsx b/gui/tests/codex-account-pool-target-switch.test.tsx index c0f34182ab0..34117fe5beb 100644 --- a/gui/tests/codex-account-pool-target-switch.test.tsx +++ b/gui/tests/codex-account-pool-target-switch.test.tsx @@ -143,7 +143,12 @@ async function switchTarget(targetKey: string, releasePrevious: () => void) { configureApiTargets(relay("/same", targetKey)); actEnvironment(false); try { - root!.render(); + // A timer scheduled before React commits can win the race on a loaded runner. + // Observe the layout commit itself; release the old read in that same phase so + // the regression still exercises the interval before passive effects run. + await new Promise(resolve => { + root!.render( { releasePrevious(); resolve(); }} />); + }); await new Promise(resolve => setTimeout(resolve, 0)); } finally { actEnvironment(true);