From 69d3a336b43760e880c3df8218e8c68981234c5e Mon Sep 17 00:00:00 2001 From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Date: Fri, 9 Sep 2022 20:27:21 -0500 Subject: [PATCH] test: Fix act errors in AnnotationLayer test (#21423) --- .../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(); - 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');