mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 14:54:04 +02:00
Fix intermittent failure in the "must check that the comment sidebar is resizable with the keyboard" comment integration test
In PR #20887 the issue got fixed partly, but two issues remained that unintendedly left room for intermittent failres: - in the "Ctrl+ArrowLeft/Right" loop the `waitForBrowserTrip` call was placed _before_ the actual keypresses, which means that for the final iteration of the loop the last key presses were not properly awaited; - in the "ArrowLeft/ArrowRight" loop the `waitForBrowserTrip` call was absent, which means that we didn't wait for key presses at all. This commit fixes the issues by consistently waiting to a browser trip _after_ each key press to make sure the sidebar got a chance to render.
This commit is contained in:
parent
e10f11bd3a
commit
24e5377240
@ -571,10 +571,10 @@ describe("Comment", () => {
|
||||
const rect = await getRect(page, sidebarSelector);
|
||||
const arrowKey = extraWidth > 0 ? "ArrowLeft" : "ArrowRight";
|
||||
for (let i = 0; i < Math.abs(extraWidth); i++) {
|
||||
await waitForBrowserTrip(page);
|
||||
await kbModifierDown(page);
|
||||
await page.keyboard.press(arrowKey);
|
||||
await kbModifierUp(page);
|
||||
await waitForBrowserTrip(page);
|
||||
}
|
||||
|
||||
const rectAfter = await getRect(page, sidebarSelector);
|
||||
@ -592,6 +592,7 @@ describe("Comment", () => {
|
||||
const arrowKey = extraWidth > 0 ? "ArrowLeft" : "ArrowRight";
|
||||
for (let i = 0; i < Math.abs(extraWidth); i++) {
|
||||
await page.keyboard.press(arrowKey);
|
||||
await waitForBrowserTrip(page);
|
||||
}
|
||||
|
||||
const rectAfter = await getRect(page, sidebarSelector);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user