From c7364a1e395aa11c251b53229e49c786012b23bd Mon Sep 17 00:00:00 2001 From: Callum Alpass Date: Mon, 2 Nov 2026 22:54:21 +1100 Subject: [PATCH] Wait for a stable frame in app tests instead of a fixed sleep Under the full suite the fixed 20ms wasn't enough for React to re-render. --- test/app/harness.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/app/harness.tsx b/test/app/harness.tsx index cc46ee5..d54c75d 100644 --- a/test/app/harness.tsx +++ b/test/app/harness.tsx @@ -66,10 +66,21 @@ export async function renderApp(options: { readonly session?: ReturnType { await new Promise((resolve) => setTimeout(resolve, ms)); await rig.renderOnce(); + let last = rig.captureCharFrame(); + for (let tries = 0; tries < 50; tries++) { + await new Promise((resolve) => setTimeout(resolve, 15)); + await rig.renderOnce(); + const next = rig.captureCharFrame(); + if (next === last) return; + last = next; + } }; await settle(150); const named: Record = { escape: "ESCAPE", return: "RETURN", tab: "TAB", up: "ARROW_UP", down: "ARROW_DOWN", left: "ARROW_LEFT", right: "ARROW_RIGHT", backspace: "BACKSPACE" };