diff --git a/tests/e2e/config/jest.setup.js b/tests/e2e/config/jest.setup.js index 068fd99bbc0..59eb9da95b5 100644 --- a/tests/e2e/config/jest.setup.js +++ b/tests/e2e/config/jest.setup.js @@ -45,22 +45,17 @@ beforeAll(async () => { page.setDefaultTimeout( DEFAULT_TIMEOUT_OVERRIDE ); } - // Update the ready page to prevent concurrent test runs try { + // Update the ready page to prevent concurrent test runs await updateReadyPageStatus('draft'); + await trashExistingPosts(); + await withRestApi.deleteAllProducts(); + await withRestApi.deleteAllCoupons(); + await withRestApi.deleteAllOrders(); } catch ( error ) { // Prevent an error here causing tests to fail. } - // This sometimes returns a 401 in CI - try { - await trashExistingPosts(); - } catch ( error ) { - console.log( 'Error trashing posts' ); - } - await withRestApi.deleteAllProducts(); - await withRestApi.deleteAllCoupons(); - await withRestApi.deleteAllOrders(); await page.goto(WP_ADMIN_LOGIN); await clearLocalStorage(); await setBrowserViewport('large');