]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21692 Improve Account-it, ProjectDumpApp-it tests
authorstanislavh <stanislav.honcharov@sonarsource.com>
Fri, 23 Feb 2024 12:28:28 +0000 (13:28 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 23 Feb 2024 20:02:36 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx

index 4fefa37feb8fdc2b8495bf823465a74eeefc325c..e4835da67f50eba65c7af84bfa1652d604b1bb84 100644 (file)
@@ -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();
   });
index ed0305a8f2e404df853434fc4e622a294ab38cc0..c5cd470108b7e28350f19c93558a12f78765a699 100644 (file)
@@ -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();