Skip to content

Commit

Permalink
Merge pull request #17090 from timvandermeij/autoprint-intermittent
Browse files Browse the repository at this point in the history
Activate the selector check for the `autoprint` integration test as soon as possible
  • Loading branch information
timvandermeij authored Oct 7, 2023
2 parents f2c9b64 + 2c1d95b commit 60a458d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/integration/scripting_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,16 @@ describe("Interaction", () => {
let pages;

beforeAll(async () => {
pages = await loadAndWait("autoprint.pdf", ".endOfContent");
// Autoprinting is triggered by the `Open` event, which is one of the
// first events to be dispatched to the sandbox, even before scripting
// is reported to be ready. It's therefore important that `loadAndWait`
// returns control as soon as possible after opening the PDF document,
// and the first element we can check for is the `<html>` tag of the
// viewer. Note that the `autoprint.pdf` file is very small, so printing
// it is usually very fast and therefore activating the selector check
// too late will cause it to never resolve because printing is already
// done (and the printed page div removed) before we even get to it.
pages = await loadAndWait("autoprint.pdf", "html");
});

afterAll(async () => {
Expand Down

0 comments on commit 60a458d

Please sign in to comment.