From 2b092e2179d03c30954c5f5eec1eff74f9ee6840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gomes?= Date: Fri, 10 Feb 2023 14:01:16 +0000 Subject: [PATCH] Move page closing to `beforeEach` --- packages/e2e-tests/config/setup-performance-test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/e2e-tests/config/setup-performance-test.js b/packages/e2e-tests/config/setup-performance-test.js index 384a88b8a3f2d..2c34960502693 100644 --- a/packages/e2e-tests/config/setup-performance-test.js +++ b/packages/e2e-tests/config/setup-performance-test.js @@ -35,17 +35,19 @@ beforeAll( async () => { await trashAllPosts(); await trashAllPosts( 'wp_block' ); await clearLocalStorage(); - await setupPage(); await activatePlugin( 'gutenberg-test-plugin-disables-the-css-animations' ); } ); -afterEach( async () => { - // Clear localStorage between tests so that the next test starts clean. - await clearLocalStorage(); - // Close the previous page entirely and create a new page, so that the next test +beforeEach( async () => { + // Close the previous page entirely and create a new page, so that the test // isn't affected by page unload work. await page.close(); page = await browser.newPage(); // Set up testing config on new page. await setupPage(); } ); + +afterEach( async () => { + // Clear localStorage between tests so that the next test starts clean. + await clearLocalStorage(); +} );