diff --git a/test/integration/test_utils.mjs b/test/integration/test_utils.mjs index 85c715acdb20f..65c7f29141ae3 100644 --- a/test/integration/test_utils.mjs +++ b/test/integration/test_utils.mjs @@ -81,16 +81,16 @@ function awaitPromise(promise) { } function closePages(pages) { - return Promise.all( - pages.map(async ([_, page]) => { - // Avoid to keep something from a previous test. - await page.evaluate(async () => { - await window.PDFViewerApplication.testingClose(); - window.localStorage.clear(); - }); - await page.close({ runBeforeUnload: false }); - }) - ); + return Promise.all(pages.map(([_, page]) => closeSinglePage(page))); +} + +async function closeSinglePage(page) { + // Avoid to keep something from a previous test. + await page.evaluate(async () => { + await window.PDFViewerApplication.testingClose(); + window.localStorage.clear(); + }); + await page.close({ runBeforeUnload: false }); } async function waitForSandboxTrip(page) { @@ -634,6 +634,7 @@ export { awaitPromise, clearInput, closePages, + closeSinglePage, createPromise, dragAndDropAnnotation, firstPageOnTop, diff --git a/test/integration/text_layer_spec.mjs b/test/integration/text_layer_spec.mjs index 1fd8296b808ba..d34b519c6853e 100644 --- a/test/integration/text_layer_spec.mjs +++ b/test/integration/text_layer_spec.mjs @@ -13,7 +13,12 @@ * limitations under the License. */ -import { closePages, getSpanRectFromText, loadAndWait } from "./test_utils.mjs"; +import { + closePages, + closeSinglePage, + getSpanRectFromText, + loadAndWait, +} from "./test_utils.mjs"; import { startBrowser } from "../test.mjs"; describe("Text layer", () => { @@ -227,6 +232,7 @@ describe("Text layer", () => { ); }); afterAll(async () => { + await closeSinglePage(page); await browser.close(); });