Skip to content

Commit

Permalink
test: fix flaky download assertion
Browse files Browse the repository at this point in the history
Signed-off-by: rare-magma <[email protected]>
  • Loading branch information
rare-magma committed Jul 3, 2024
1 parent 55a1625 commit 43f63a2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions e2e/settingsHappyPath.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ test("should complete the settings happy path", async ({ page, isMobile }) => {
await page.getByLabel("import or export budget").click();
await expect(page.getByText("json")).toBeVisible();

const jsonDownloadPromise = page.waitForEvent("download");
await page.getByLabel("export budget as json").click();
const jsonDownload = await jsonDownloadPromise;
const [jsonDownload] = await Promise.all([
page.waitForEvent("download"),
page.getByLabel("export budget as json").click(),
]);

let downloadError = await jsonDownload.failure();
if (downloadError !== null) {
console.log("Error on download:", downloadError);
throw new Error(downloadError);
}

expect(jsonDownload.suggestedFilename()).toMatch(/.json/);
expect(
(await fs.promises.stat(await jsonDownload.path())).size,
Expand Down

0 comments on commit 43f63a2

Please sign in to comment.