Skip to content

Commit

Permalink
Fix flaky test by waiting for modal to be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Jun 29, 2024
1 parent c056aa8 commit c062e83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/src/components/SearchPage/SearchFullUI.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
/* eslint-disable @typescript-eslint/no-empty-function */
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { beforeEach, describe, expect, it, vi } from 'vitest';

Expand Down Expand Up @@ -225,6 +225,7 @@ describe('SearchFullUI', () => {
await userEvent.click(field1Checkbox);
const closeButton = await screen.findByRole('button', { name: 'Close' });
await userEvent.click(closeButton);
await waitForElementToBeRemoved(() => screen.queryByText('Toggle the visibility of search fields'));
expect(screen.queryByLabelText('Field 1')).not.toBeInTheDocument();
});

Expand Down

0 comments on commit c062e83

Please sign in to comment.