From b31251ddc3748151add4a700620470add8c20673 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 15 Feb 2023 11:49:21 +0100 Subject: [PATCH 1/5] Make the performance tests more stable --- packages/e2e-test-utils/src/site-editor.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/e2e-test-utils/src/site-editor.js b/packages/e2e-test-utils/src/site-editor.js index bccbb51057912d..e21f08fdedb397 100644 --- a/packages/e2e-test-utils/src/site-editor.js +++ b/packages/e2e-test-utils/src/site-editor.js @@ -166,13 +166,14 @@ export async function openPreviousGlobalStylesPanel() { * Enters edit mode. */ export async function enterEditMode() { - const isViewMode = await page.$( - '.edit-site-visual-editor__editor-canvas[role="button"]' - ); + const isSidebarVisible = await page.$( '.edit-site-layout__sidebar' ); // This check is necessary for the performance tests in old branches // where the site editor toggle was not implemented yet. - if ( ! isViewMode ) { + if ( ! isSidebarVisible ) { return; } + await page.waitForSelector( + '.edit-site-visual-editor__editor-canvas[role="button"]' + ); await canvas().click( 'body' ); } From eb64e702b648493f5cba1da1a43390bc34b6b66b Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 16 Feb 2023 09:40:25 +0100 Subject: [PATCH 2/5] Try a different fix --- packages/e2e-test-utils/src/site-editor.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/e2e-test-utils/src/site-editor.js b/packages/e2e-test-utils/src/site-editor.js index e21f08fdedb397..4afab23513d07b 100644 --- a/packages/e2e-test-utils/src/site-editor.js +++ b/packages/e2e-test-utils/src/site-editor.js @@ -166,14 +166,15 @@ export async function openPreviousGlobalStylesPanel() { * Enters edit mode. */ export async function enterEditMode() { - const isSidebarVisible = await page.$( '.edit-site-layout__sidebar' ); - // This check is necessary for the performance tests in old branches - // where the site editor toggle was not implemented yet. - if ( ! isSidebarVisible ) { - return; + try { + await page.waitForSelector( + '.edit-site-visual-editor__editor-canva[role="button"]', + { timeout: 3000 } + ); + + await canvas().click( 'body' ); + } catch { + // This catch is necessary for the performance tests in old branches + // where the site editor toggle was not implemented yet. } - await page.waitForSelector( - '.edit-site-visual-editor__editor-canvas[role="button"]' - ); - await canvas().click( 'body' ); } From 468711ebd299341d04b1dbaa252c8b8b4c15707b Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 16 Feb 2023 13:12:33 +0100 Subject: [PATCH 3/5] Fix typo --- packages/e2e-test-utils/src/site-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-test-utils/src/site-editor.js b/packages/e2e-test-utils/src/site-editor.js index 4afab23513d07b..97f1c0e16bdda6 100644 --- a/packages/e2e-test-utils/src/site-editor.js +++ b/packages/e2e-test-utils/src/site-editor.js @@ -168,7 +168,7 @@ export async function openPreviousGlobalStylesPanel() { export async function enterEditMode() { try { await page.waitForSelector( - '.edit-site-visual-editor__editor-canva[role="button"]', + '.edit-site-visual-editor__editor-canvas[role="button"]', { timeout: 3000 } ); From c4c52512f3922714df432a4324eab636c383a84f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 21 Feb 2023 08:02:22 +0100 Subject: [PATCH 4/5] Remove path --- packages/e2e-tests/specs/performance/site-editor.test.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/e2e-tests/specs/performance/site-editor.test.js b/packages/e2e-tests/specs/performance/site-editor.test.js index e67aad6d0ff6c0..897126111564c0 100644 --- a/packages/e2e-tests/specs/performance/site-editor.test.js +++ b/packages/e2e-tests/specs/performance/site-editor.test.js @@ -90,10 +90,6 @@ describe( 'Site Editor Performance', () => { await visitSiteEditor( { postId: id, postType: 'page', - // This shouldn't be necessary, but without it the tests fail. - // Could be related to having the necessary cookies in the browser. - // See https://github.com/WordPress/gutenberg/pull/48240/files#r1111760556 - path: '/navigation/single', } ); } ); From 67998fbceadfa70b9c5e793b912a58733093c2d6 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 21 Feb 2023 11:58:31 +0100 Subject: [PATCH 5/5] Fix performance tests --- bin/plugin/commands/performance.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/plugin/commands/performance.js b/bin/plugin/commands/performance.js index 5d2fe7437ed297..433f9931334e61 100644 --- a/bin/plugin/commands/performance.js +++ b/bin/plugin/commands/performance.js @@ -323,14 +323,14 @@ async function runPerformanceTests( branches, options ) { log( ` >> Fetching the ${ fancyBranch } branch` ); // @ts-ignore await SimpleGit( buildPath ).reset( 'hard' ).checkout( branch ); - - log( ` >> Building the ${ fancyBranch } branch` ); - await runShellScript( - 'npm ci && npm run prebuild:packages && node ./bin/packages/build.js && npx wp-scripts build', - buildPath - ); } + log( ` >> Building the ${ fancyBranch } branch` ); + await runShellScript( + 'npm ci && npm run prebuild:packages && node ./bin/packages/build.js && npx wp-scripts build', + buildPath + ); + await runShellScript( 'cp ' + path.resolve(