From 897564cfdce888bd5b11669cbf80d47901c16c15 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 2 May 2023 12:26:29 +0200 Subject: [PATCH] [NO JIRA] Fix warnings in RTL tests --- .../__tests__/QualityProfilesApp-it.tsx | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx index 00c6ac5aba2..95352a39b97 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { getByText } from '@testing-library/react'; +import { act, getByText } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; import { byRole } from 'testing-library-selector'; @@ -138,7 +138,9 @@ it('should be able to extend Quality Profile', async () => { await user.clear(ui.namePropupInput.get()); await user.type(ui.namePropupInput.get(), ui.newCQualityProfileName); - await user.click(ui.extendButton.get()); + await act(async () => { + await user.click(ui.extendButton.get()); + }); expect(await ui.listLinkNewCQualityProfile.find()).toBeInTheDocument(); // From the create form @@ -148,7 +150,9 @@ it('should be able to extend Quality Profile', async () => { await selectEvent.select(ui.languageSelect.get(), 'C'); await selectEvent.select(ui.profileExtendSelect.get(), ui.newCQualityProfileName); await user.type(ui.nameCreatePopupInput.get(), ui.newCQualityProfileNameFromCreateButton); - await user.click(ui.createButton.get(ui.popup.get())); + await act(async () => { + await user.click(ui.createButton.get(ui.popup.get())); + }); expect(await ui.listLinkNewCQualityProfileFromCreateButton.find()).toBeInTheDocument(); }); @@ -164,7 +168,9 @@ it('should be able to copy Quality Profile', async () => { await user.clear(ui.namePropupInput.get()); await user.type(ui.namePropupInput.get(), ui.newCQualityProfileName); - await user.click(ui.copyButton.get(ui.popup.get())); + await act(async () => { + await user.click(ui.copyButton.get(ui.popup.get())); + }); expect(await ui.listLinkNewCQualityProfile.find()).toBeInTheDocument(); // From the create form @@ -175,7 +181,9 @@ it('should be able to copy Quality Profile', async () => { await selectEvent.select(ui.languageSelect.get(), 'C'); await selectEvent.select(ui.profileCopySelect.get(), ui.newCQualityProfileName); await user.type(ui.nameCreatePopupInput.get(), ui.newCQualityProfileNameFromCreateButton); - await user.click(ui.createButton.get(ui.popup.get())); + await act(async () => { + await user.click(ui.createButton.get(ui.popup.get())); + }); expect(await ui.listLinkNewCQualityProfileFromCreateButton.find()).toBeInTheDocument(); }); @@ -191,7 +199,9 @@ it('should be able to create blank Quality Profile', async () => { await user.click(ui.blankRadio.get()); await selectEvent.select(ui.languageSelect.get(), 'C'); await user.type(ui.nameCreatePopupInput.get(), ui.newCQualityProfileName); - await user.click(ui.createButton.get(ui.popup.get())); + await act(async () => { + await user.click(ui.createButton.get(ui.popup.get())); + }); expect(await ui.listLinkNewCQualityProfile.find()).toBeInTheDocument(); }); -- 2.39.5