From 7aff89a0322ec0ec94b1d761164ce282f1a57efc Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Thu, 13 Apr 2023 10:35:48 +0800 Subject: [PATCH] Try another approach --- .../src/admin/visit-site-editor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts index 3b36c5d426942..a4c3adc747a1e 100644 --- a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts +++ b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts @@ -34,7 +34,6 @@ export async function visitSiteEditor( } ).slice( 1 ); await this.visitAdminPage( 'site-editor.php', path ); - await this.page.waitForSelector( CANVAS_SELECTOR ); if ( skipWelcomeGuide ) { await this.page.evaluate( () => { @@ -47,4 +46,12 @@ export async function visitSiteEditor( .toggle( 'core/edit-site', 'welcomeGuideStyles', false ); } ); } + + // 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(); }