diff --git a/__tests__/task-requests/task-requestDetails.test.js b/__tests__/task-requests/task-requestDetails.test.js index 4a2b7ad7..0c827846 100644 --- a/__tests__/task-requests/task-requestDetails.test.js +++ b/__tests__/task-requests/task-requestDetails.test.js @@ -36,7 +36,7 @@ describe('Request container for non-super users', () => { } }); await page.goto( - 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq5', + 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq5&dev=true', ); }); @@ -45,10 +45,7 @@ describe('Request container for non-super users', () => { }); it('Approve and Reject buttons should not render for non-super users', async function () { - await page.goto( - 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq5&dev=true', - ); - await page.waitForTimeout(2000); + await page.waitForNetworkIdle(); const approveButton = await page.$('[data-testid="task-approve-button"]'); const rejectButton = await page.$('[data-testid="task-reject-button"]'); expect(approveButton).toBeNull(); @@ -56,10 +53,7 @@ describe('Request container for non-super users', () => { }); it('Should render task status for non-super users', async function () { - await page.goto( - 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq5&dev=true', - ); - await page.waitForTimeout(2000); + await page.waitForNetworkIdle(); const taskRequestStatus = await page.$( '[data-testid="requestors-task-status"]', ); @@ -156,7 +150,7 @@ describe('Task request details page', () => { await page.goto( 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq5&dev=true', ); - await page.waitForTimeout(2000); + await page.waitForNetworkIdle(); const approveButton = await page.$('[data-testid="task-approve-button"]'); const rejectButton = await page.$('[data-testid="task-reject-button"]'); expect(approveButton).toBeTruthy(); @@ -251,7 +245,7 @@ describe('Task request details page with markdown support in description', () => await page.goto( 'http://localhost:8000/task-requests/details/?id=dM5wwD9QsiTzi7eG7Oq6&dev=true', ); - await page.waitForTimeout(2000); + await page.waitForNetworkIdle(); const approveButton = await page.$('[data-testid="task-approve-button"]'); const rejectButton = await page.$('[data-testid="task-reject-button"]'); expect(approveButton).toBeTruthy();