Fix intermittent errors in the "check that first text field has focus" scripting test

This commit fixes the "Expected null to equal '401R'" errors that
surfaced after the Puppeteer 18 upgrade. Note that even before that
this would have been an improvement because it takes some time between
scripting being reported ready (i.e., triggering the execution of any
OpenActions) and those OpenActions actually completing execution, so
it's only safe to check which element is focused if we know an element
actually became focused.
This commit is contained in:
Tim van der Meij 2022-10-01 17:50:58 +02:00
parent 9525bfaa66
commit 606fb8c394
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -51,6 +51,7 @@ describe("Interaction", () => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
await page.waitForFunction(`window.document.activeElement !== null`);
// The document has an open action in order to give the focus to 401R.
const id = await page.evaluate(() => {