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/10 01:27:34 UTC

[superset] branch master updated: test: Fix act errors in AnnotationLayer test (#21423)

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

lyndsi 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 69d3a336b4 test: Fix act errors in AnnotationLayer test (#21423)
69d3a336b4 is described below

commit 69d3a336b43760e880c3df8218e8c68981234c5e
Author: Lyndsi Kay Williams <55...@users.noreply.github.com>
AuthorDate: Fri Sep 9 20:27:21 2022 -0500

    test: Fix act errors in AnnotationLayer test (#21423)
---
 .../AnnotationLayerControl/AnnotationLayer.test.tsx   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.test.tsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.test.tsx
index ed8ae44339..b9fc64a4c2 100644
--- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.test.tsx
+++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.test.tsx
@@ -78,7 +78,7 @@ test('renders extra checkboxes when type is time series', async () => {
   userEvent.click(screen.getAllByText('Formula')[0]);
   userEvent.click(screen.getByText('Time series'));
   expect(
-    screen.getByRole('button', { name: 'Show Markers' }),
+    await screen.findByRole('button', { name: 'Show Markers' }),
   ).toBeInTheDocument();
   expect(screen.getByRole('button', { name: 'Hide Line' })).toBeInTheDocument();
 });
@@ -86,7 +86,7 @@ test('renders extra checkboxes when type is time series', async () => {
 test('enables apply and ok buttons', async () => {
   const { container } = render(<AnnotationLayer {...defaultProps} />);
 
-  waitFor(() => {
+  await waitFor(() => {
     expect(container).toBeInTheDocument();
   });
 
@@ -99,7 +99,7 @@ test('enables apply and ok buttons', async () => {
   userEvent.type(nameInput, 'Name');
   userEvent.type(formulaInput, '2x');
 
-  waitFor(() => {
+  await waitFor(() => {
     expect(screen.getByRole('button', { name: 'Apply' })).toBeEnabled();
     expect(screen.getByRole('button', { name: 'OK' })).toBeEnabled();
   });
@@ -150,13 +150,13 @@ test('renders chart options', async () => {
     screen.getByRole('combobox', { name: 'Annotation source type' }),
   );
   userEvent.click(screen.getByText('Superset annotation'));
-  expect(screen.getByText('Annotation layer')).toBeInTheDocument();
+  expect(await screen.findByText('Annotation layer')).toBeInTheDocument();
 
   userEvent.click(
     screen.getByRole('combobox', { name: 'Annotation source type' }),
   );
   userEvent.click(screen.getByText('Table'));
-  expect(screen.getByText('Chart')).toBeInTheDocument();
+  expect(await screen.findByText('Chart')).toBeInTheDocument();
 });
 
 test('keeps apply disabled when missing required fields', async () => {
@@ -167,25 +167,26 @@ test('keeps apply disabled when missing required fields', async () => {
   userEvent.click(
     screen.getByRole('combobox', { name: 'Annotation layer value' }),
   );
-  userEvent.click(await screen.findByText('Chart A'));
-  expect(
-    screen.getByText('Annotation Slice Configuration'),
-  ).toBeInTheDocument();
+  expect(await screen.findByText('Chart A')).toBeInTheDocument();
+  userEvent.click(screen.getByText('Chart A'));
 
   userEvent.click(screen.getByRole('button', { name: 'Automatic Color' }));
   userEvent.click(
     screen.getByRole('combobox', { name: 'Annotation layer title column' }),
   );
+  expect(await screen.findByText(/none/i)).toBeInTheDocument();
   userEvent.click(screen.getByText('None'));
   userEvent.click(screen.getByText('Style'));
   userEvent.click(
     screen.getByRole('combobox', { name: 'Annotation layer stroke' }),
   );
+  expect(await screen.findByText('Dashed')).toBeInTheDocument();
   userEvent.click(screen.getByText('Dashed'));
   userEvent.click(screen.getByText('Opacity'));
   userEvent.click(
     screen.getByRole('combobox', { name: 'Annotation layer opacity' }),
   );
+  expect(await screen.findByText(/0.5/i)).toBeInTheDocument();
   userEvent.click(screen.getByText('0.5'));
 
   const checkboxes = screen.getAllByRole('checkbox');