Skip to content

Commit 032abe7

Browse files
eschuthoclaude
andcommitted
fix(tests): improve reliability of pre-filter validation test
Replace `waitFor` with `getByText` pattern with `findByText` which automatically waits for the element to appear. This follows React Testing Library best practices and eliminates flaky test failures caused by timing issues with fake/real timers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1faaa21 commit 032abe7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,9 @@ test('validates the pre-filter value', async () => {
346346
jest.runOnlyPendingTimers();
347347
jest.useRealTimers();
348348

349-
await waitFor(() => {
350-
expect(screen.getByText(PRE_FILTER_REQUIRED_REGEX)).toBeInTheDocument();
351-
});
349+
expect(
350+
await screen.findByText(PRE_FILTER_REQUIRED_REGEX),
351+
).toBeInTheDocument();
352352
}, 50000); // Slow-running test, increase timeout to 50 seconds.
353353

354354
// eslint-disable-next-line jest/no-disabled-tests

0 commit comments

Comments
 (0)