From 1f4a8b98340d83ff9b265395bc63c73ce64e0dfd Mon Sep 17 00:00:00 2001 From: SagarRajput-7 <162284829+SagarRajput-7@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:40:49 +0530 Subject: [PATCH] fix: fixed flaky pipelineSearchSection test case (#5189) --- .../PipelinePage/tests/PipelinesSearchSection.test.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/container/PipelinePage/tests/PipelinesSearchSection.test.tsx b/frontend/src/container/PipelinePage/tests/PipelinesSearchSection.test.tsx index bfe69adcd1..2ef069a8f5 100644 --- a/frontend/src/container/PipelinePage/tests/PipelinesSearchSection.test.tsx +++ b/frontend/src/container/PipelinePage/tests/PipelinesSearchSection.test.tsx @@ -42,9 +42,11 @@ describe('PipelinePage container test', () => { jest.advanceTimersByTime(299); expect(setPipelineValue).not.toHaveBeenCalled(); - // Wait for the debounce delay to pass + // Fast-forward time by 1ms to reach the debounce delay + jest.advanceTimersByTime(1); + + // Wait for the debounce delay to pass and expect the callback to be called await waitFor(() => { - // Expect the callback to be called after debounce delay expect(setPipelineValue).toHaveBeenCalledWith('sample_pipeline'); });