Wait to have all the spans in the text layer before trying to set the caret in integration tests

This commit is contained in:
Calixte Denizet 2026-03-17 15:30:57 +01:00
parent 1f94023d42
commit 32dc2a5894

View File

@ -680,6 +680,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(