Commit 2345bd670be for woocommerce

commit 2345bd670be8989514d3ae54f706a696f727cb77
Author: Luigi Teschio <gigitux@gmail.com>
Date:   Mon Jun 8 10:42:10 2026 +0200

    Fix editor canvas frame detection in Playwright utils (#65532)

    * Fix editor canvas frame detection in Playwright utils

    * Add changelog entry for editor canvas frame fix

    * add log

diff --git a/packages/js/e2e-utils-playwright/changelog/fix-editor-canvas-frame-race b/packages/js/e2e-utils-playwright/changelog/fix-editor-canvas-frame-race
new file mode 100644
index 00000000000..97ba50b321f
--- /dev/null
+++ b/packages/js/e2e-utils-playwright/changelog/fix-editor-canvas-frame-race
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Wait for the Gutenberg editor canvas iframe before falling back to the page context in Playwright tests.
diff --git a/packages/js/e2e-utils-playwright/src/editor.ts b/packages/js/e2e-utils-playwright/src/editor.ts
index e970b9f2d82..f6ae7cd7739 100644
--- a/packages/js/e2e-utils-playwright/src/editor.ts
+++ b/packages/js/e2e-utils-playwright/src/editor.ts
@@ -99,6 +99,13 @@ export const openEditorSettings = async ( {
  */
 export const getCanvas = async ( page: Page ): Promise< EditorCanvas > => {
 	const iframeLocator = page.locator( 'iframe[name="editor-canvas"]' );
+	await iframeLocator.waitFor( { state: 'attached' } ).catch( ( error ) => {
+		console.warn(
+			'The editor canvas iframe was not found. Falling back to the page context.',
+			error
+		);
+	} );
+
 	if ( ( await iframeLocator.count() ) > 0 ) {
 		return iframeLocator.contentFrame();
 	}