diff --git a/src/ui/__tests__/TUIChat.input.test.tsx b/src/ui/__tests__/TUIChat.input.test.tsx
index ce3184e92..401b60a99 100644
--- a/src/ui/__tests__/TUIChat.input.test.tsx
+++ b/src/ui/__tests__/TUIChat.input.test.tsx
@@ -17,15 +17,21 @@ describe("TUIChat - User Input Tests", () => {
});
it("clears input field after pressing Enter", async () => {
- const { lastFrame, stdin } = render();
+ const { lastFrame, stdin, rerender } = render();
stdin.write("Test message");
const beforeEnter = lastFrame();
stdin.write("\r");
- // Wait for the UI to update after pressing enter
- await new Promise((resolve) => setTimeout(resolve, 50));
+ // Wait for the async message processing and UI updates
+ await new Promise((resolve) => setTimeout(resolve, 200));
+
+ // Force a rerender to ensure the UI has updated
+ rerender();
+
+ // Give it a bit more time for the message to appear in the chat
+ await new Promise((resolve) => setTimeout(resolve, 100));
const afterEnter = lastFrame();