Remove most waitForTimeout usage from the freetext editor integration tests
This commit replaces a `waitForTimeout` occurrence with an equivalent `waitForSelector` expression, and removes two other `waitForTimeout` occurrences that are obsolete because we already wait for an observable event to trigger or class change to happen. Note that the other `waitForTimeout` occurrences in this file are either part of #17931 or remain until we find a good way to ensure that nothing happened (because currently there is nothing we can await there).
This commit is contained in:
parent
d79aaee62a
commit
5c5c107ec5
@ -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}`)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user