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/09/09 18:46:42 UTC

[superset] 01/01: 10 act errors removed from DatasourceControl test

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

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

commit 7442ed4e953e959c1f1d63df7fb689fd8d1a08e1
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Fri Sep 9 13:46:12 2022 -0500

    10 act errors removed from DatasourceControl test
---
 .../DatasourceControl/DatasourceControl.test.tsx   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx b/superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx
index 4d2bbc4684..4d01ec7a79 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx
@@ -62,20 +62,20 @@ const createProps = () => ({
   onDatasourceSave: jest.fn(),
 });
 
-test('Should render', () => {
+test('Should render', async () => {
   const props = createProps();
   render(<DatasourceControl {...props} />);
-  expect(screen.getByTestId('datasource-control')).toBeVisible();
+  expect(await screen.findByTestId('datasource-control')).toBeVisible();
 });
 
-test('Should have elements', () => {
+test('Should have elements', async () => {
   const props = createProps();
   render(<DatasourceControl {...props} />);
-  expect(screen.getByText('channels')).toBeVisible();
+  expect(await screen.findByText('channels')).toBeVisible();
   expect(screen.getByTestId('datasource-menu-trigger')).toBeVisible();
 });
 
-test('Should open a menu', () => {
+test('Should open a menu', async () => {
   const props = createProps();
   render(<DatasourceControl {...props} />);
 
@@ -85,7 +85,7 @@ test('Should open a menu', () => {
 
   userEvent.click(screen.getByTestId('datasource-menu-trigger'));
 
-  expect(screen.getByText('Edit dataset')).toBeInTheDocument();
+  expect(await screen.findByText('Edit dataset')).toBeInTheDocument();
   expect(screen.getByText('Change dataset')).toBeInTheDocument();
   expect(screen.getByText('View in SQL Lab')).toBeInTheDocument();
 });
@@ -154,7 +154,7 @@ test('Edit dataset should be disabled when user is not admin', async () => {
 
   userEvent.click(screen.getByTestId('datasource-menu-trigger'));
 
-  expect(screen.getByTestId('edit-dataset')).toHaveAttribute(
+  expect(await screen.findByTestId('edit-dataset')).toHaveAttribute(
     'aria-disabled',
     'true',
   );
@@ -179,7 +179,7 @@ test('Click on View in SQL Lab', async () => {
   expect(postFormSpy).toBeCalledTimes(1);
 });
 
-test('Should open a different menu when datasource=query', () => {
+test('Should open a different menu when datasource=query', async () => {
   const props = createProps();
   const queryProps = {
     ...props,
@@ -196,12 +196,12 @@ test('Should open a different menu when datasource=query', () => {
 
   userEvent.click(screen.getByTestId('datasource-menu-trigger'));
 
-  expect(screen.getByText('Query preview')).toBeInTheDocument();
+  expect(await screen.findByText('Query preview')).toBeInTheDocument();
   expect(screen.getByText('View in SQL Lab')).toBeInTheDocument();
   expect(screen.getByText('Save as dataset')).toBeInTheDocument();
 });
 
-test('Click on Save as dataset', () => {
+test('Click on Save as dataset', async () => {
   const props = createProps();
   const queryProps = {
     ...props,
@@ -216,7 +216,7 @@ test('Click on Save as dataset', () => {
   userEvent.click(screen.getByText('Save as dataset'));
 
   // Renders a save dataset modal
-  const saveRadioBtn = screen.getByRole('radio', {
+  const saveRadioBtn = await screen.findByRole('radio', {
     name: /save as new/i,
   });
   const overwriteRadioBtn = screen.getByRole('radio', {