mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[Editor] Add a first test to test the new alt text flow
This commit is contained in:
parent
b6b99a7b75
commit
debcb2267e
3 changed files with 267 additions and 7 deletions
|
@ -84,6 +84,13 @@ function closePages(pages) {
|
|||
return Promise.all(pages.map(([_, page]) => closeSinglePage(page)));
|
||||
}
|
||||
|
||||
function isVisible(page, selector) {
|
||||
return page.evaluate(
|
||||
sel => document.querySelector(sel)?.checkVisibility(),
|
||||
selector
|
||||
);
|
||||
}
|
||||
|
||||
async function closeSinglePage(page) {
|
||||
// Avoid to keep something from a previous test.
|
||||
await page.evaluate(async () => {
|
||||
|
@ -119,13 +126,23 @@ function waitForTimeout(milliseconds) {
|
|||
});
|
||||
}
|
||||
|
||||
async function clearInput(page, selector) {
|
||||
await page.click(selector);
|
||||
await kbSelectAll(page);
|
||||
await page.keyboard.press("Backspace");
|
||||
await page.waitForFunction(
|
||||
`document.querySelector('${selector}').value === ""`
|
||||
);
|
||||
async function clearInput(page, selector, waitForInputEvent = false) {
|
||||
const action = async () => {
|
||||
await page.click(selector);
|
||||
await kbSelectAll(page);
|
||||
await page.keyboard.press("Backspace");
|
||||
await page.waitForFunction(
|
||||
`document.querySelector('${selector}').value === ""`
|
||||
);
|
||||
};
|
||||
return waitForInputEvent
|
||||
? waitForEvent({
|
||||
page,
|
||||
eventName: "input",
|
||||
action,
|
||||
selector,
|
||||
})
|
||||
: action();
|
||||
}
|
||||
|
||||
function getSelector(id) {
|
||||
|
@ -711,6 +728,7 @@ export {
|
|||
getSerialized,
|
||||
getSpanRectFromText,
|
||||
hover,
|
||||
isVisible,
|
||||
kbBigMoveDown,
|
||||
kbBigMoveLeft,
|
||||
kbBigMoveRight,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue