Skip to content
Open
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
4 changes: 4 additions & 0 deletions test/integration/reorganize_pages_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ async function drawInkLine(page, pageNumber) {
}

async function waitForHavingContents(page, expected) {
// Only visible pages render their text layer: enlarge the viewport so that,
// once shrunk to the minimum scale in WRAPPED mode below, all the pages fit
// on screen even for documents with many pages.
await page.setViewport({ width: 1500, height: 1500 });

@timvandermeij timvandermeij Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit unexpected to change the viewport size in the scope of a helper function. Wouldn't it be better to set a large enough viewport size in general for the tests then?

Alternatively, maybe we can find a better way to make sure all pages are rendered so we don't need to have this workaround of setting a custom viewer scroll mode and page scale altogether? For example we might be able to add a TESTING-only option that forces text rendering of all pages and emits an event if it's done that we can listen for.

await page.evaluate(() => {
// Make sure all the pages will be visible.
window.PDFViewerApplication.pdfViewer.scrollMode = 2 /* = ScrollMode.WRAPPED = */;
Expand Down
Loading