From af325812e8bb32d3cece240016029b447c6a411c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 12:50:30 +0000 Subject: [PATCH] fix: wrap file upload and button clicks in act() for async state updates Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com> --- .../components/update-dsl-modal.spec.tsx | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 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 5db7985914..c1a931f048 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 @@ -390,7 +390,12 @@ describe('UpdateDSLModal', () => { // Select a file and click import const fileInput = screen.getByTestId('file-input') const file = new File(['test content'], 'test.pipeline', { type: 'text/yaml' }) - fireEvent.change(fileInput, { target: { files: [file] } }) + + await act(async () => { + fireEvent.change(fileInput, { target: { files: [file] } }) + // Wait for FileReader to process + await new Promise(resolve => queueMicrotask(resolve)) + }) await waitFor(() => { const importButton = screen.getByText('common.overwriteAndImport') @@ -398,7 +403,10 @@ describe('UpdateDSLModal', () => { }) const importButton = screen.getByText('common.overwriteAndImport') - fireEvent.click(importButton) + + await act(async () => { + fireEvent.click(importButton) + }) await waitFor(() => { expect(mockNotify).toHaveBeenCalledWith(expect.objectContaining({ @@ -418,7 +426,12 @@ describe('UpdateDSLModal', () => { const fileInput = screen.getByTestId('file-input') const file = new File(['test content'], 'test.pipeline', { type: 'text/yaml' }) - fireEvent.change(fileInput, { target: { files: [file] } }) + + await act(async () => { + fireEvent.change(fileInput, { target: { files: [file] } }) + // Wait for FileReader to process + await new Promise(resolve => queueMicrotask(resolve)) + }) await waitFor(() => { const importButton = screen.getByText('common.overwriteAndImport') @@ -426,7 +439,10 @@ describe('UpdateDSLModal', () => { }) const importButton = screen.getByText('common.overwriteAndImport') - fireEvent.click(importButton) + + await act(async () => { + fireEvent.click(importButton) + }) await waitFor(() => { expect(mockOnCancel).toHaveBeenCalled()