From 6c4a7ab5c7ee236b1053c09cbdac7f7202495b03 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Tue, 20 Dec 2022 14:31:10 +1100 Subject: [PATCH 1/2] Update performance tests to work with themes that load editor into an iframe --- .../e2e-tests/specs/performance/post-editor.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/e2e-tests/specs/performance/post-editor.test.js b/packages/e2e-tests/specs/performance/post-editor.test.js index 63fa92514728e..e038ef6529cbc 100644 --- a/packages/e2e-tests/specs/performance/post-editor.test.js +++ b/packages/e2e-tests/specs/performance/post-editor.test.js @@ -15,6 +15,7 @@ import { closeGlobalBlockInserter, openListView, closeListView, + canvas, } from '@wordpress/e2e-test-utils'; /** @@ -100,7 +101,8 @@ describe( 'Post Editor Performance', () => { let i = 5; while ( i-- ) { await page.reload(); - await page.waitForSelector( '.wp-block' ); + await page.waitForSelector( 'iframe[name="editor-canvas"]' ); + await canvas().waitForSelector( '.wp-block' ); const { serverResponse, firstPaint, @@ -166,8 +168,8 @@ describe( 'Post Editor Performance', () => { ) ); // Select the block where we type in - await page.waitForSelector( 'p[aria-label="Paragraph block"]' ); - await page.click( 'p[aria-label="Paragraph block"]' ); + await canvas().waitForSelector( 'p[aria-label="Paragraph block"]' ); + await canvas().click( 'p[aria-label="Paragraph block"]' ); // Ignore firsted typed character because it's different // It probably deserves a dedicated metric. // (isTyping triggers so it's slower) @@ -217,7 +219,7 @@ describe( 'Post Editor Performance', () => { ); dispatch( 'core/block-editor' ).resetBlocks( blocks ); } ); - const paragraphs = await page.$$( '.wp-block' ); + const paragraphs = await canvas().$$( '.wp-block' ); await page.tracing.start( { path: traceFile, screenshots: false, From f68cce9f28554caf15eacd488c0f2ca86be3ebfa Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Tue, 20 Dec 2022 15:01:53 +1100 Subject: [PATCH 2/2] Use same waitForSelector() approach that site editor tests use --- packages/e2e-tests/specs/performance/post-editor.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/specs/performance/post-editor.test.js b/packages/e2e-tests/specs/performance/post-editor.test.js index e038ef6529cbc..89952c6e0aeae 100644 --- a/packages/e2e-tests/specs/performance/post-editor.test.js +++ b/packages/e2e-tests/specs/performance/post-editor.test.js @@ -101,8 +101,10 @@ describe( 'Post Editor Performance', () => { let i = 5; while ( i-- ) { await page.reload(); - await page.waitForSelector( 'iframe[name="editor-canvas"]' ); - await canvas().waitForSelector( '.wp-block' ); + await page.waitForSelector( '.edit-post-layout', { + timeout: 120000, + } ); + await canvas().waitForSelector( '.wp-block', { timeout: 120000 } ); const { serverResponse, firstPaint,