From: stanislavh Date: Fri, 23 Feb 2024 12:28:28 +0000 (+0100) Subject: SONAR-21692 Improve Account-it, ProjectDumpApp-it tests X-Git-Tag: 10.5.0.89998~171 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ecae0ab5ff9df5c0aac1f252dd9a976f0b673475;p=sonarqube.git SONAR-21692 Improve Account-it, ProjectDumpApp-it tests --- diff --git a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx index 4fefa37feb8..e4835da67f5 100644 --- a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx +++ b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx @@ -401,9 +401,9 @@ describe('security page', () => { securityPagePath, ); - await waitFor(() => { - selectEvent.openMenu(screen.getByRole('combobox', { name: 'users.tokens.type' })); - }); + expect(await screen.findByText('users.tokens.generate')).toBeInTheDocument(); + + await selectEvent.openMenu(screen.getByRole('combobox', { name: 'users.tokens.type' })); expect(screen.queryByText(`users.tokens.${TokenType.Project}`)).not.toBeInTheDocument(); }); @@ -430,12 +430,10 @@ describe('security page', () => { mockLoggedInUser({ permissions: { global: [Permissions.Scan] } }), securityPagePath, ); - - await waitFor(async () => { - await selectEvent.select(screen.getByRole('combobox', { name: 'users.tokens.type' }), [ - `users.tokens.${TokenType.Project}`, - ]); - }); + expect(await screen.findByText('users.tokens.generate')).toBeInTheDocument(); + await selectEvent.select(screen.getByRole('combobox', { name: 'users.tokens.type' }), [ + `users.tokens.${TokenType.Project}`, + ]); expect(screen.getByText('Project Name 1')).toBeInTheDocument(); }); diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx index ed0305a8f2e..c5cd470108b 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx @@ -114,9 +114,7 @@ it('should show pending->in progress->failed export', async () => { status: TaskStatuses.InProgress, startedAt: '2023-06-08T12:00:00Z', }); - act(() => { - jest.runOnlyPendingTimers(); - }); + jest.runOnlyPendingTimers(); expect(await ui.inProgressExport.find()).toBeInTheDocument(); expect(ui.exportBtn.query()).not.toBeInTheDocument(); @@ -164,9 +162,7 @@ it('should show pending->in progress->failed import', async () => { status: TaskStatuses.InProgress, startedAt: '2023-06-08T12:00:00Z', }); - act(() => { - jest.runOnlyPendingTimers(); - }); + jest.runOnlyPendingTimers(); expect(await ui.inProgressImport.find()).toBeInTheDocument(); expect(ui.importBtn.query()).not.toBeInTheDocument();