diff --git a/superset-frontend/src/SqlLab/components/SaveQuery/SaveQuery.test.tsx b/superset-frontend/src/SqlLab/components/SaveQuery/SaveQuery.test.tsx index 8b5dbb833617b..829bfd3054141 100644 --- a/superset-frontend/src/SqlLab/components/SaveQuery/SaveQuery.test.tsx +++ b/superset-frontend/src/SqlLab/components/SaveQuery/SaveQuery.test.tsx @@ -104,7 +104,7 @@ describe('SavedQuery', () => { name: /save query/i, }); - expect(saveQueryModalHeader).toBeVisible(); + expect(saveQueryModalHeader).toBeInTheDocument(); }); it('renders the save query modal UI', () => { @@ -129,17 +129,17 @@ describe('SavedQuery', () => { const saveBtns = screen.getAllByRole('button', { name: /save/i }); const cancelBtn = screen.getByRole('button', { name: /cancel/i }); - expect(closeBtn).toBeVisible(); - expect(saveQueryModalHeader).toBeVisible(); - expect(nameLabel).toBeVisible(); - expect(descriptionLabel).toBeVisible(); + expect(closeBtn).toBeInTheDocument(); + expect(saveQueryModalHeader).toBeInTheDocument(); + expect(nameLabel).toBeInTheDocument(); + expect(descriptionLabel).toBeInTheDocument(); expect(textBoxes.length).toBe(2); - expect(nameTextbox).toBeVisible(); - expect(descriptionTextbox).toBeVisible(); + expect(nameTextbox).toBeInTheDocument(); + expect(descriptionTextbox).toBeInTheDocument(); expect(saveBtns.length).toBe(2); - expect(saveBtns[0]).toBeVisible(); - expect(saveBtns[1]).toBeVisible(); - expect(cancelBtn).toBeVisible(); + expect(saveBtns[0]).toBeInTheDocument(); + expect(saveBtns[1]).toBeInTheDocument(); + expect(cancelBtn).toBeInTheDocument(); }); it('renders a "save as new" and "update" button if query already exists', () => { @@ -163,8 +163,8 @@ describe('SavedQuery', () => { const saveAsNewBtn = screen.getByRole('button', { name: /save as new/i }); const updateBtn = screen.getByRole('button', { name: /update/i }); - expect(saveAsNewBtn).toBeVisible(); - expect(updateBtn).toBeVisible(); + expect(saveAsNewBtn).toBeInTheDocument(); + expect(updateBtn).toBeInTheDocument(); }); it('renders a split save button when allows_virtual_table_explore is enabled', async () => { @@ -188,17 +188,15 @@ describe('SavedQuery', () => { store: mockStore(mockState), }); - await waitFor(() => { - const caretBtn = screen.getByRole('button', { name: /caret-down/i }); - userEvent.click(caretBtn); + const caretBtn = await screen.findByRole('button', { name: /caret-down/i }); + userEvent.click(caretBtn); - const saveDatasetMenuItem = screen.getByText(/save dataset/i); - userEvent.click(saveDatasetMenuItem); - }); + const saveDatasetMenuItem = await screen.findByText(/save dataset/i); + userEvent.click(saveDatasetMenuItem); const saveDatasetHeader = screen.getByText(/save or overwrite dataset/i); - expect(saveDatasetHeader).toBeVisible(); + expect(saveDatasetHeader).toBeInTheDocument(); }); it('renders the save dataset modal UI', async () => { @@ -207,13 +205,11 @@ describe('SavedQuery', () => { store: mockStore(mockState), }); - await waitFor(() => { - const caretBtn = screen.getByRole('button', { name: /caret-down/i }); - userEvent.click(caretBtn); + const caretBtn = await screen.findByRole('button', { name: /caret-down/i }); + userEvent.click(caretBtn); - const saveDatasetMenuItem = screen.getByText(/save dataset/i); - userEvent.click(saveDatasetMenuItem); - }); + const saveDatasetMenuItem = await screen.findByText(/save dataset/i); + userEvent.click(saveDatasetMenuItem); const closeBtn = screen.getByRole('button', { name: /close/i }); const saveDatasetHeader = screen.getByText(/save or overwrite dataset/i); @@ -231,14 +227,14 @@ describe('SavedQuery', () => { /select or type dataset name/i, ); - expect(saveDatasetHeader).toBeVisible(); - expect(closeBtn).toBeVisible(); - expect(saveRadio).toBeVisible(); - expect(saveLabel).toBeVisible(); - expect(saveTextbox).toBeVisible(); - expect(overwriteRadio).toBeVisible(); - expect(overwriteLabel).toBeVisible(); - expect(overwriteCombobox).toBeVisible(); - expect(overwritePlaceholderText).toBeVisible(); + expect(saveDatasetHeader).toBeInTheDocument(); + expect(closeBtn).toBeInTheDocument(); + expect(saveRadio).toBeInTheDocument(); + expect(saveLabel).toBeInTheDocument(); + expect(saveTextbox).toBeInTheDocument(); + expect(overwriteRadio).toBeInTheDocument(); + expect(overwriteLabel).toBeInTheDocument(); + expect(overwriteCombobox).toBeInTheDocument(); + expect(overwritePlaceholderText).toBeInTheDocument(); }); }); diff --git a/superset-frontend/src/components/Modal/Modal.tsx b/superset-frontend/src/components/Modal/Modal.tsx index 3f07ce4b28969..826d2316d52af 100644 --- a/superset-frontend/src/components/Modal/Modal.tsx +++ b/superset-frontend/src/components/Modal/Modal.tsx @@ -148,7 +148,6 @@ export const StyledModal = styled(BaseModal)` .antd5-modal-close-x { display: flex; align-items: center; - justify-content: start; .close { flex: 1 1 auto;