Skip to content

Commit

Permalink
test: cleanup remaining timeouts (#4213)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaten committed Nov 13, 2024
1 parent a8194f5 commit 1d0ecd4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions e2e/testFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {

/* eslint-disable sonarjs/no-duplicate-string -- ignoring duplicate strings here */

// Timeout constants
const EXPORT_REQUEST_TIMEOUT = 60000;
const DOWNLOAD_TIMEOUT = 10000;

/**
* Get an array of all visible column header names
* @param page - a Playwright page object
Expand Down Expand Up @@ -777,8 +781,6 @@ export async function testDeselectFiltersThroughSearchBar(
}
}

const EXPORT_REQUEST_TIMEOUT = 60000;

/**
* Get the first link to a backpage with specified backpage access
* @param page - a Playright page locator
Expand Down Expand Up @@ -1147,8 +1149,12 @@ export async function testBulkDownloadIndexExportWorkflow(
const exportActionButtonLocator = page.getByRole("link", {
name: tab.indexExportPage?.exportActionButtonText,
});
await expect(exportActionButtonLocator).toBeEnabled({ timeout: 60000 });
const downloadPromise = page.waitForEvent("download", { timeout: 10000 }); // This timeout is necessary, as otherwise the test will wait for the global test timeout
await expect(exportActionButtonLocator).toBeEnabled({
timeout: EXPORT_REQUEST_TIMEOUT,
});
const downloadPromise = page.waitForEvent("download", {
timeout: DOWNLOAD_TIMEOUT,
}); // This timeout is necessary, as otherwise the test will wait for the global test timeout
await exportActionButtonLocator.click();
const download = await downloadPromise;
// Cancel the download when it occurs, since there's no need to let it fully download
Expand Down

0 comments on commit 1d0ecd4

Please sign in to comment.