Merge pull request #18317 from timvandermeij/integration-test-separate-browser-cleanup

Close the page in the text layer caret selection integration test
This commit is contained in:
Tim van der Meij 2024-06-23 16:13:00 +02:00 committed by GitHub
commit b4393a7e79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View File

@ -81,16 +81,16 @@ function awaitPromise(promise) {
} }
function closePages(pages) { function closePages(pages) {
return Promise.all( return Promise.all(pages.map(([_, page]) => closeSinglePage(page)));
pages.map(async ([_, page]) => { }
// Avoid to keep something from a previous test.
await page.evaluate(async () => { async function closeSinglePage(page) {
await window.PDFViewerApplication.testingClose(); // Avoid to keep something from a previous test.
window.localStorage.clear(); await page.evaluate(async () => {
}); await window.PDFViewerApplication.testingClose();
await page.close({ runBeforeUnload: false }); window.localStorage.clear();
}) });
); await page.close({ runBeforeUnload: false });
} }
async function waitForSandboxTrip(page) { async function waitForSandboxTrip(page) {
@ -634,6 +634,7 @@ export {
awaitPromise, awaitPromise,
clearInput, clearInput,
closePages, closePages,
closeSinglePage,
createPromise, createPromise,
dragAndDropAnnotation, dragAndDropAnnotation,
firstPageOnTop, firstPageOnTop,

View File

@ -13,7 +13,12 @@
* limitations under the License. * 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"; import { startBrowser } from "../test.mjs";
describe("Text layer", () => { describe("Text layer", () => {
@ -227,6 +232,7 @@ describe("Text layer", () => {
); );
}); });
afterAll(async () => { afterAll(async () => {
await closeSinglePage(page);
await browser.close(); await browser.close();
}); });