You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ju...@apache.org on 2023/04/28 15:58:07 UTC

[superset] branch master updated: fix(alerts): flaky test error (#23860)

This is an automated email from the ASF dual-hosted git repository.

justinpark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 594d3e0e0c fix(alerts): flaky test error (#23860)
594d3e0e0c is described below

commit 594d3e0e0c4add06c1216490c63cdc6ac43e2f5a
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Fri Apr 28 08:57:57 2023 -0700

    fix(alerts): flaky test error (#23860)
---
 .../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 fd0457aa9f..e4f7454fec 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: () => <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
@@ -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 });
 
@@ -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,