diff --git a/frontend/tests/resetProject.test.ts b/frontend/tests/resetProject.test.ts index f809179cde..19241f063f 100644 --- a/frontend/tests/resetProject.test.ts +++ b/frontend/tests/resetProject.test.ts @@ -37,20 +37,14 @@ test('reset project and upload .zip file', async ({ page, tempProject, tempDir } await resetProjectModel.assertGone(); // Step 2: Get tip hash and file list from hgweb, check some known values - // It can take a while for the server to pick up the new repo - let beforeResetJson: HgWebJson; - await expect(async () => { - const beforeResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`); - beforeResetJson = await beforeResetResponse.json() as HgWebJson; - expect(beforeResetJson).toHaveProperty('node'); - expect(beforeResetJson.node).not.toEqual(allZeroHash); - expect(beforeResetJson).toHaveProperty('files'); - expect(beforeResetJson.files).toHaveLength(1); - expect(beforeResetJson.files[0]).toHaveProperty('basename'); - expect(beforeResetJson.files[0].basename).toBe('hello.txt'); - }).toPass({ - intervals: [1_000, 3_000, 5_000], - }); + const beforeResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`); + const beforeResetJson = await beforeResetResponse.json() as HgWebJson; + expect(beforeResetJson).toHaveProperty('node'); + expect(beforeResetJson.node).not.toEqual(allZeroHash); + expect(beforeResetJson).toHaveProperty('files'); + expect(beforeResetJson.files).toHaveLength(1); + expect(beforeResetJson.files[0]).toHaveProperty('basename'); + expect(beforeResetJson.files[0].basename).toBe('hello.txt'); // Step 3: reset project, do not upload zip file await projectPage.goto(); @@ -65,16 +59,11 @@ test('reset project and upload .zip file', async ({ page, tempProject, tempDir } await resetProjectModel.assertGone(); // Step 4: confirm it's empty now - // It can take a while for the server to pick up the new repo - await expect(async () => { - const afterResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`); - const afterResetJson = await afterResetResponse.json() as HgWebJson; - expect(afterResetJson.node).toEqual(allZeroHash); - expect(afterResetJson).toHaveProperty('files'); - expect(afterResetJson.files).toHaveLength(0); - }).toPass({ - intervals: [1_000, 3_000, 5_000], - }); + const afterResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`); + const afterResetJson = await afterResetResponse.json() as HgWebJson; + expect(afterResetJson.node).toEqual(allZeroHash); + expect(afterResetJson).toHaveProperty('files'); + expect(afterResetJson.files).toHaveLength(0); // Step 5: reset project again, uploading zip file downloaded from step 1 await projectPage.goto();