From 94fcef3e0d4d393ac3351e722ea25b0ceaf45719 Mon Sep 17 00:00:00 2001 From: justin-park Date: Thu, 27 Apr 2023 22:12:50 -0700 Subject: [PATCH] fix(alerts): flaky test error --- .../src/features/alerts/AlertReportModal.test.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx index fd0457aa9fc33..e4f7454fecea1 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx @@ -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: () =>
, +})); + +const onHide = jest.fn(); + test('allows change to None in log retention', async () => { - render(, { useRedux: true }); + render(, { useRedux: true }); // open the log retention select userEvent.click(screen.getByText('90 days')); // change it to 30 days @@ -42,7 +49,7 @@ test('allows change to None in log retention', async () => { }); test('renders the appropriate dropdown in Message Content section', async () => { - render(, { useRedux: true }); + render(, { useRedux: true }); const chartRadio = screen.getByRole('radio', { name: /chart/i }); @@ -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,