Skip to content

Commit

Permalink
Restore canvas check to avoid unrelated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Oct 17, 2023
1 parent d2aba51 commit 9559d8e
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface SiteEditorOptions {
showWelcomeGuide?: boolean;
}

const CANVAS_SELECTOR = 'iframe[title="Editor canvas"i] >> visible=true';

/**
* Visits the Site Editor main page.
*
Expand Down Expand Up @@ -40,7 +42,18 @@ export async function visitSiteEditor(
} );
}

// TODO: Ideally the content underneath the canvas loader should be marked inert until it's ready.
// Check if the current page has an editor canvas first.
if ( ( await this.page.locator( CANVAS_SELECTOR ).count() ) > 0 ) {
// The site editor initially loads with an empty body,
// we need to wait for the editor canvas to be rendered.
await this.page
.frameLocator( CANVAS_SELECTOR )
.locator( 'body > *' )
.first()
.waitFor();
}
// TODO: Ideally the content underneath the canvas loader should be marked
// inert until it's ready.
await this.page
.locator( '.edit-site-canvas-loader' )
// Bigger timeout is needed for larger entities, for example the large
Expand Down

0 comments on commit 9559d8e

Please sign in to comment.