From 8c10513d6da63859332e28cefaf9003fbe2ed889 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:40:37 +0000 Subject: [PATCH] fix: add Promise.resolve() after advancing fake timers to flush state updates Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com> --- .../components/update-dsl-modal.spec.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/app/components/rag-pipeline/components/update-dsl-modal.spec.tsx b/web/app/components/rag-pipeline/components/update-dsl-modal.spec.tsx index bc8c0cdb6e..cbc38ed268 100644 --- a/web/app/components/rag-pipeline/components/update-dsl-modal.spec.tsx +++ b/web/app/components/rag-pipeline/components/update-dsl-modal.spec.tsx @@ -720,13 +720,14 @@ describe('UpdateDSLModal', () => { await Promise.resolve() // Advance past the 300ms setTimeout in the component await vi.advanceTimersByTimeAsync(350) + // Flush any pending state updates + await Promise.resolve() }) vi.useRealTimers() - await waitFor(() => { - expect(screen.getByText('newApp.appCreateDSLErrorTitle')).toBeInTheDocument() - }, { timeout: 5000 }) + // Element should be immediately available after advancing timers and flushing + expect(screen.getByText('newApp.appCreateDSLErrorTitle')).toBeInTheDocument() }) it('should show version info in error modal', async () => { @@ -852,11 +853,13 @@ describe('UpdateDSLModal', () => { await Promise.resolve() // Advance past the 300ms setTimeout in the component await vi.advanceTimersByTimeAsync(350) + // Flush any pending state updates + await Promise.resolve() }) vi.useRealTimers() - // Element should be immediately available after advancing timers + // Element should be immediately available after advancing timers and flushing expect(screen.getByText('newApp.appCreateDSLErrorTitle')).toBeInTheDocument() // Click confirm button @@ -1152,11 +1155,13 @@ describe('UpdateDSLModal', () => { await Promise.resolve() // Advance past the 300ms setTimeout in the component await vi.advanceTimersByTimeAsync(350) + // Flush any pending state updates + await Promise.resolve() }) vi.useRealTimers() - // Element should be immediately available after advancing timers + // Element should be immediately available after advancing timers and flushing expect(screen.getByText('newApp.appCreateDSLErrorTitle')).toBeInTheDocument() const confirmButton = screen.getByText('newApp.Confirm')