Skip to content

Commit 76bd6dc

Browse files
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
2 parents 83f06b4 + 32dc2a5 commit 76bd6dc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

test/integration/test_utils.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@ async function firstPageOnTop(page) {
717717
}
718718

719719
async function setCaretAt(page, pageNumber, text, position) {
720+
// Wait for the text layer to finish rendering before trying to find the span.
721+
await page.waitForSelector(
722+
`.page[data-page-number="${pageNumber}"] .textLayer .endOfContent`
723+
);
720724
await page.evaluate(
721725
(pageN, string, pos) => {
722726
for (const el of document.querySelectorAll(

0 commit comments

Comments
 (0)