You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2022/12/15 03:28:49 UTC

[superset] branch lyndsi/fix-act-errors-vizTypeControl created (now 55cb41639d)

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

lyndsi pushed a change to branch lyndsi/fix-act-errors-vizTypeControl
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 55cb41639d 66 act errors fixed in VizTypeControl test

This branch includes the following new commits:

     new 55cb41639d 66 act errors fixed in VizTypeControl test

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: 66 act errors fixed in VizTypeControl test

Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lyndsi pushed a commit to branch lyndsi/fix-act-errors-vizTypeControl
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 55cb41639ddebe33e1c76e595ce9c92fb6854878
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Wed Dec 14 21:28:27 2022 -0600

    66 act errors fixed in VizTypeControl test
---
 .../VizTypeControl/VizTypeControl.test.tsx         | 51 ++++++++++++----------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
index ee3bfdaee9..2ee9bfab0e 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
@@ -17,7 +17,13 @@
  * under the License.
  */
 import { Preset } from '@superset-ui/core';
-import { render, cleanup, screen, within } from 'spec/helpers/testing-library';
+import {
+  render,
+  cleanup,
+  screen,
+  within,
+  waitFor,
+} from 'spec/helpers/testing-library';
 import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore';
 import React from 'react';
 import userEvent from '@testing-library/user-event';
@@ -90,30 +96,31 @@ describe('VizTypeControl', () => {
     isModalOpenInit: true,
   };
 
-  const renderWrapper = (
+  const waitForRenderWrapper = (
     props: typeof defaultProps = defaultProps,
     state: object = stateWithoutNativeFilters,
-  ) => {
-    render(
-      <DynamicPluginProvider>
-        <VizTypeControl {...props} />
-      </DynamicPluginProvider>,
-      { useRedux: true, initialState: state },
-    );
-  };
+  ) =>
+    waitFor(() => {
+      render(
+        <DynamicPluginProvider>
+          <VizTypeControl {...props} />
+        </DynamicPluginProvider>,
+        { useRedux: true, initialState: state },
+      );
+    });
 
   afterEach(() => {
     cleanup();
     jest.clearAllMocks();
   });
 
-  it('Fast viz switcher tiles render', () => {
+  it('Fast viz switcher tiles render', async () => {
     const props = {
       ...defaultProps,
       value: 'echarts_timeseries_line',
       isModalOpenInit: false,
     };
-    renderWrapper(props);
+    await waitForRenderWrapper(props);
     expect(screen.getByLabelText('line-chart-tile')).toBeVisible();
     expect(screen.getByLabelText('table-chart-tile')).toBeVisible();
     expect(screen.getByLabelText('big-number-chart-tile')).toBeVisible();
@@ -152,13 +159,13 @@ describe('VizTypeControl', () => {
     ).not.toBeInTheDocument();
   });
 
-  it('Render viz tiles when non-featured chart is selected', () => {
+  it('Render viz tiles when non-featured chart is selected', async () => {
     const props = {
       ...defaultProps,
       value: 'line',
       isModalOpenInit: false,
     };
-    renderWrapper(props);
+    await waitForRenderWrapper(props);
 
     expect(screen.getByLabelText('monitor')).toBeVisible();
     expect(
@@ -166,7 +173,7 @@ describe('VizTypeControl', () => {
     ).toBeVisible();
   });
 
-  it('Render viz tiles when non-featured is rendered', () => {
+  it('Render viz tiles when non-featured is rendered', async () => {
     const props = {
       ...defaultProps,
       value: 'line',
@@ -186,20 +193,20 @@ describe('VizTypeControl', () => {
         },
       },
     };
-    renderWrapper(props, state);
+    await waitForRenderWrapper(props, state);
     expect(screen.getByLabelText('check-square')).toBeVisible();
     expect(
       within(screen.getByTestId('fast-viz-switcher')).getByText('Line Chart'),
     ).toBeVisible();
   });
 
-  it('Change viz type on click', () => {
+  it('Change viz type on click', async () => {
     const props = {
       ...defaultProps,
       value: 'echarts_timeseries_line',
       isModalOpenInit: false,
     };
-    renderWrapper(props);
+    await waitForRenderWrapper(props);
     userEvent.click(
       within(screen.getByTestId('fast-viz-switcher')).getByText(
         'Time-series Line Chart',
@@ -213,7 +220,7 @@ describe('VizTypeControl', () => {
   });
 
   it('Open viz gallery modal on "View all charts" click', async () => {
-    renderWrapper({ ...defaultProps, isModalOpenInit: false });
+    await waitForRenderWrapper({ ...defaultProps, isModalOpenInit: false });
     expect(
       screen.queryByText('Select a visualization type'),
     ).not.toBeInTheDocument();
@@ -224,7 +231,7 @@ describe('VizTypeControl', () => {
   });
 
   it('Search visualization type', async () => {
-    renderWrapper();
+    await waitForRenderWrapper();
 
     const visualizations = screen.getByTestId(getTestId('viz-row'));
 
@@ -265,8 +272,8 @@ describe('VizTypeControl', () => {
     ).not.toBeInTheDocument();
   });
 
-  it('Submit on viz type double-click', () => {
-    renderWrapper();
+  it('Submit on viz type double-click', async () => {
+    await waitForRenderWrapper();
     userEvent.click(screen.getByRole('button', { name: 'ballot All charts' }));
     const visualizations = screen.getByTestId(getTestId('viz-row'));
     userEvent.click(within(visualizations).getByText('Time-series Bar Chart'));