1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Fix editor tests on Windows

- In #15373, we implemented copy/paste actions in using the system
clipboard.
For any reasons, on Windows, the clipboard doesn't contain the expected
data when the tests are ran in parallel, hence the tests which are
using the clipboard need to be ran sequentially.
- Make sure that we can paste after having copied.
This commit is contained in:
Calixte Denizet 2022-10-25 15:28:22 +02:00
parent 22225a1eaa
commit 2384fbcb89
3 changed files with 262 additions and 243 deletions

View file

@ -87,3 +87,16 @@ function getSelectedEditors(page) {
});
}
exports.getSelectedEditors = getSelectedEditors;
async function waitForEvent(page, eventName, timeout = 30000) {
await Promise.race([
// add event listener and wait for event to fire before returning
page.evaluate(name => {
return new Promise(resolve => {
document.addEventListener(name, resolve, { once: true });
});
}, eventName),
page.waitForTimeout(timeout),
]);
}
exports.waitForEvent = waitForEvent;