Merge pull request #20903 from calixteman/fix_intermittent_setCaret

Wait to have all the spans in the text layer before trying to set the caret in integration tests
This commit is contained in:
Tim van der Meij 2026-03-17 21:58:10 +01:00 committed by GitHub
commit 76bd6dc0dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -717,6 +717,10 @@ async function firstPageOnTop(page) {
}
async function setCaretAt(page, pageNumber, text, position) {
// Wait for the text layer to finish rendering before trying to find the span.
await page.waitForSelector(
`.page[data-page-number="${pageNumber}"] .textLayer .endOfContent`
);
await page.evaluate(
(pageN, string, pos) => {
for (const el of document.querySelectorAll(