Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't wait for scripting to be ready in the
autoprint
integration test
This integration test fails often because we wait for scripting to be ready before we check the printed page, but most of the time the PDF is already done printing before scripting is reported to be ready. This happens because the print trigger is on the `Open` event, which is one of the first events to be dispatched and, most notably, before scripting is marked as ready; please see https://github.com/mozilla/pdf.js/blob/master/web/pdf_scripting_manager.js#L176-L191. Given that the PDF document is only one page, printing it is usually finished between triggering the `Open` event and scripting reported to be ready. If this happens the printed page is already destroyed before we get to our actual test, which will then timeout because it will never find the printed page in the DOM. This commit fixes the problem by not awaiting scripting to be ready because the fact that the printed page appears is already enough to know that autoprint was triggered (after all, there is no other user interaction involved here). While we're here we also switch to the shorter `page.waitForSelector` function.
- Loading branch information