From a9efc68c07bd90a6420f756b071d081fc9a143f0 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Thu, 25 Jul 2024 11:49:39 +0200 Subject: [PATCH] [No Jira] Improve test stability --- .../js/apps/users/__tests__/UsersApp-it.tsx | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx index 8061b5fc720..b8886856ade 100644 --- a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx @@ -717,7 +717,8 @@ it('should render external identity Providers', async () => { it('accessibility', async () => { systemHandler.setProvider(null); - const user = userEvent.setup(); + // Skip hover to avoid issues with Tooltip rerenders + const user = userEvent.setup({ skipHover: true }); renderUsersApp(); // user list page should be accessible @@ -727,26 +728,22 @@ it('accessibility', async () => { // user creation dialog should be accessible await user.click(await ui.createUserButton.find()); expect(await ui.dialogCreateUser.find()).toBeInTheDocument(); - await waitFor(async () => { - await expect(ui.dialogCreateUser.get()).toHaveNoA11yViolations(); - }); + await expect(ui.dialogCreateUser.get()).toHaveNoA11yViolations(); + await user.click(ui.cancelButton.get()); // users group membership dialog should be accessible await user.click(await ui.aliceUpdateGroupButton.find()); expect(await ui.dialogGroups.find()).toBeInTheDocument(); - await waitFor(async () => { - await expect(await ui.dialogGroups.find()).toHaveNoA11yViolations(); - }); + await expect(await ui.dialogGroups.find()).toHaveNoA11yViolations(); + await user.click(ui.doneButton.get()); // user update dialog should be accessible await user.click(await ui.aliceUpdateButton.find()); await user.click(await byText('update_details').find()); expect(await ui.dialogUpdateUser.find()).toBeInTheDocument(); - await waitFor(async () => { - await expect(await ui.dialogUpdateUser.find()).toHaveNoA11yViolations(); - }); + await expect(await ui.dialogUpdateUser.find()).toHaveNoA11yViolations(); await user.click(ui.cancelButton.get()); // user tokens dialog should be accessible @@ -759,18 +756,14 @@ it('accessibility', async () => { ); expect(await ui.dialogTokens.find()).toBeInTheDocument(); - await waitFor(async () => { - await expect(await ui.dialogTokens.find()).toHaveNoA11yViolations(); - }); + await expect(await ui.dialogTokens.find()).toHaveNoA11yViolations(); await user.click(ui.closeButton.get()); // user password dialog should be accessible await user.click(await ui.aliceUpdateButton.find()); await user.click(await byText('my_profile.password.title').find()); expect(await ui.dialogPasswords.find()).toBeInTheDocument(); - await waitFor(async () => { - await expect(await ui.dialogPasswords.find()).toHaveNoA11yViolations(); - }); + await expect(await ui.dialogPasswords.find()).toHaveNoA11yViolations(); }); function renderUsersApp(featureList: Feature[] = [], currentUser?: CurrentUser) { -- 2.39.5