Skip to content

Commit

Permalink
Fix await in focusEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Dec 7, 2023
1 parent 4cfc3b1 commit 2c5b210
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/lexical-playground/__tests__/utils/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,16 @@ export async function focusEditor(page, parentSelector = '.editor-shell') {
if (IS_COLLAB) {
await page.waitForSelector('iframe[name="left"]');
const leftFrame = page.frame('left');
if ((await leftFrame.$$('.loading').length) !== 0) {
if ((await leftFrame.$$('.loading')).length !== 0) {
await leftFrame.waitForSelector('.loading', {
state: 'detached',
});
await sleep(500);
}
// This sleep used to be "conditional" based on a broken version of
// the above test (undefined !== 0 is always true). It turns out there
// were tests that needed this sleep even when the left frame was not
// in a loading state.
await sleep(500);
await leftFrame.focus(selector);
} else {
await page.focus(selector);
Expand Down

0 comments on commit 2c5b210

Please sign in to comment.