Merge pull request #18041 from timvandermeij/integration-tests-timeout-freetext
Remove most `waitForTimeout` usage from the freetext editor integration tests
This commit is contained in:
commit
14e87469db
@ -74,13 +74,7 @@ describe("Annotation highlight", () => {
|
|||||||
pages.map(async ([browserName, page]) => {
|
pages.map(async ([browserName, page]) => {
|
||||||
for (const i of [23, 22, 14]) {
|
for (const i of [23, 22, 14]) {
|
||||||
await page.click(`[data-annotation-id='${i}R']`);
|
await page.click(`[data-annotation-id='${i}R']`);
|
||||||
await page.waitForFunction(
|
await page.waitForSelector(`#pdfjs_internal_id_${i}R:focus`);
|
||||||
id =>
|
|
||||||
document.activeElement ===
|
|
||||||
document.querySelector(`#pdfjs_internal_id_${id}R`),
|
|
||||||
{},
|
|
||||||
i
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@ -56,9 +56,6 @@ const copyPaste = async page => {
|
|||||||
await kbCopy(page);
|
await kbCopy(page);
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
await waitForTimeout(10);
|
|
||||||
|
|
||||||
promise = waitForEvent(page, "paste");
|
promise = waitForEvent(page, "paste");
|
||||||
await kbPaste(page);
|
await kbPaste(page);
|
||||||
await promise;
|
await promise;
|
||||||
@ -1364,9 +1361,6 @@ describe("FreeText Editor", () => {
|
|||||||
// Enter in editing mode.
|
// Enter in editing mode.
|
||||||
await switchToFreeText(page);
|
await switchToFreeText(page);
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
await waitForTimeout(200);
|
|
||||||
|
|
||||||
// Disable editing mode.
|
// Disable editing mode.
|
||||||
await page.click("#editorFreeText");
|
await page.click("#editorFreeText");
|
||||||
await page.waitForSelector(
|
await page.waitForSelector(
|
||||||
@ -2411,14 +2405,7 @@ describe("FreeText Editor", () => {
|
|||||||
|
|
||||||
// The editor must be moved in the DOM and potentially the focus
|
// The editor must be moved in the DOM and potentially the focus
|
||||||
// will be lost, hence there's a callback will get back the focus.
|
// will be lost, hence there's a callback will get back the focus.
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
await page.waitForSelector(`${getEditorSelector(1)}:focus`);
|
||||||
await waitForTimeout(200);
|
|
||||||
|
|
||||||
const focused = await page.evaluate(sel => {
|
|
||||||
const editor = document.querySelector(sel);
|
|
||||||
return editor === document.activeElement;
|
|
||||||
}, getEditorSelector(1));
|
|
||||||
expect(focused).withContext(`In ${browserName}`).toEqual(true);
|
|
||||||
|
|
||||||
expect(await pos(0))
|
expect(await pos(0))
|
||||||
.withContext(`In ${browserName}`)
|
.withContext(`In ${browserName}`)
|
||||||
|
|||||||
@ -1591,18 +1591,12 @@ describe("Highlight Editor", () => {
|
|||||||
await page.focus(getEditorSelector(1));
|
await page.focus(getEditorSelector(1));
|
||||||
|
|
||||||
await kbFocusPrevious(page);
|
await kbFocusPrevious(page);
|
||||||
await page.waitForFunction(
|
await page.waitForSelector(
|
||||||
sel => document.querySelector(sel) === document.activeElement,
|
`.page[data-page-number="1"] > .textLayer:focus`
|
||||||
{},
|
|
||||||
`.page[data-page-number="1"] > .textLayer`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await kbFocusNext(page);
|
await kbFocusNext(page);
|
||||||
await page.waitForFunction(
|
await page.waitForSelector(`${getEditorSelector(1)}:focus`);
|
||||||
sel => document.querySelector(sel) === document.activeElement,
|
|
||||||
{},
|
|
||||||
getEditorSelector(1)
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user