diff options
author | David Cho-Lerat <david.cho-lerat@sonarsource.com> | 2023-12-07 12:41:18 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-12-07 20:02:52 +0000 |
commit | 5937ce5c30e70f85869c5d05292451a9061b1e58 (patch) | |
tree | 9cade1f2a5777e62a58da2c3dcdc90703f29c0d0 /server | |
parent | 66d6f7484be1ca152b9ae9e98723fda6c5dddbe4 (diff) | |
download | sonarqube-5937ce5c30e70f85869c5d05292451a9061b1e58.tar.gz sonarqube-5937ce5c30e70f85869c5d05292451a9061b1e58.zip |
SONAR-21217 Wait for all background tasks to be loaded in test
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx index 8844b0974b9..1b6b71d9337 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx @@ -33,6 +33,7 @@ import { } from '../../../helpers/testSelector'; import { EditionKey } from '../../../types/editions'; import { TaskStatuses, TaskTypes } from '../../../types/tasks'; +import { PAGE_SIZE } from '../constants'; import routes from '../routes'; const computeEngineServiceMock = new ComputeEngineServiceMock(); @@ -183,19 +184,22 @@ describe('The Global background task page', () => { const { ui, user } = getPageObject(); computeEngineServiceMock.clearTasks(); - computeEngineServiceMock.createTasks(101); + + const TOTAL_TASKS = 101; + + computeEngineServiceMock.createTasks(TOTAL_TASKS); renderGlobalBackgroundTasksApp(); await ui.appLoaded(); expect(ui.pageHeading.get()).toBeInTheDocument(); - expect(ui.getAllRows()).toHaveLength(100); + expect(ui.getAllRows()).toHaveLength(PAGE_SIZE); user.click(ui.showMoreButton.get()); - await waitFor(() => { - expect(ui.getAllRows()).toHaveLength(101); + await waitFor(async () => { + expect(await screen.findAllByRole('row')).toHaveLength(TOTAL_TASKS + 1); // 1 extra = header }); }); |