Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(alerts): flaky test error #23860

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions superset-frontend/src/features/alerts/AlertReportModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import AlertReportModal from './AlertReportModal';

jest.mock('src/components/AsyncAceEditor', () => ({
...jest.requireActual('src/components/AsyncAceEditor'),
TextAreaEditor: () => <div data-test="react-ace" />,
}));

const onHide = jest.fn();

test('allows change to None in log retention', async () => {
render(<AlertReportModal show />, { useRedux: true });
render(<AlertReportModal show onHide={onHide} />, { useRedux: true });
// open the log retention select
userEvent.click(screen.getByText('90 days'));
// change it to 30 days
Expand All @@ -42,7 +49,7 @@ test('allows change to None in log retention', async () => {
});

test('renders the appropriate dropdown in Message Content section', async () => {
render(<AlertReportModal show />, { useRedux: true });
render(<AlertReportModal show onHide={onHide} />, { useRedux: true });

const chartRadio = screen.getByRole('radio', { name: /chart/i });

Expand All @@ -62,7 +69,8 @@ test('renders the appropriate dropdown in Message Content section', async () =>
// Click the chart radio option
userEvent.click(chartRadio);

expect(await screen.findByRole('radio', { name: /chart/i })).toBeChecked();
await waitFor(() => expect(chartRadio).toBeChecked());

expect(
await screen.findByRole('radio', {
name: /dashboard/i,
Expand Down