Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close the page in the text layer caret selection integration test #18317

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions test/integration/test_utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -634,6 +634,7 @@ export {
awaitPromise,
clearInput,
closePages,
closeSinglePage,
createPromise,
dragAndDropAnnotation,
firstPageOnTop,
Expand Down
8 changes: 7 additions & 1 deletion test/integration/text_layer_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -227,6 +232,7 @@ describe("Text layer", () => {
);
});
afterAll(async () => {
await closeSinglePage(page);
await browser.close();
});

Expand Down