1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Fix the highlight integration test when highlighting with the keyboard

These tests were failing with Puppeteer 23.9.0.
This commit is contained in:
Calixte Denizet 2024-11-26 19:41:55 +01:00
parent 079eb24621
commit 5d77a64e1f

View file

@ -697,7 +697,12 @@ describe("Highlight Editor", () => {
await page.keyboard.press("ArrowRight");
}
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown");
// Here and elsewhere, we add a small delay between press and release
// to make sure that a keyup event for Shift is triggered after
// selectionchange (it's why adding the delay on the last before
// releasing shift is enough).
// It works with a value of 10ms, but we use 100ms to be sure.
await page.keyboard.press("ArrowDown", { delay: 100 });
await page.keyboard.up("Shift");
await page.waitForSelector(sel);
@ -1066,7 +1071,7 @@ describe("Highlight Editor", () => {
15
);
await page.keyboard.down("Shift");
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
await page.keyboard.up("Shift");
await page.waitForSelector(getEditorSelector(0));
@ -1715,7 +1720,7 @@ describe("Highlight Editor", () => {
);
await page.keyboard.down("Shift");
for (let i = 0; i < 3; i++) {
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
}
await page.keyboard.up("Shift");
@ -1730,7 +1735,7 @@ describe("Highlight Editor", () => {
);
await page.keyboard.down("Shift");
for (let i = 0; i < 3; i++) {
await page.keyboard.press("ArrowDown");
await page.keyboard.press("ArrowDown", { delay: 100 });
}
await page.keyboard.up("Shift");
await page.waitForSelector(getEditorSelector(1));