From c7bec5bcd2208f4a42c610e3d11dc0d6523c6219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Tue, 23 Mar 2021 15:09:04 +0100 Subject: [PATCH] Remove checks for WP 5.4 from e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/3993) * Remove checks for WP 5.4 from e2e tests * Update e2e local environment set up docs --- .../docs/contributors/javascript-testing.md | 3 +- .../tests/e2e/specs/backend/cart.test.js | 36 +++++++++---------- .../tests/e2e/specs/backend/checkout.test.js | 36 +++++++++---------- plugins/woocommerce-blocks/tests/e2e/utils.js | 4 --- 4 files changed, 34 insertions(+), 45 deletions(-) diff --git a/plugins/woocommerce-blocks/docs/contributors/javascript-testing.md b/plugins/woocommerce-blocks/docs/contributors/javascript-testing.md index 3259b5cda05..89d9c2705ab 100644 --- a/plugins/woocommerce-blocks/docs/contributors/javascript-testing.md +++ b/plugins/woocommerce-blocks/docs/contributors/javascript-testing.md @@ -59,7 +59,8 @@ To modify the environment used by tests locally, you will need to modify `.wp-en ```diff { -+ "core": "WordPress/WordPress#5.6", +- "core": "WordPress/WordPress#5.7-branch", ++ "core": "WordPress/WordPress#5.6-branch", "plugins": [ "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://github.com/WP-API/Basic-Auth/archive/master.zip", diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/backend/cart.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/backend/cart.test.js index 76ddc6a41e2..2e9fb35810c 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/backend/cart.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/backend/cart.test.js @@ -15,7 +15,6 @@ import { import { insertBlockDontWaitForInsertClose, closeInserter, - conditionalDescribe, } from '../../utils.js'; const block = { @@ -41,27 +40,24 @@ describe( `${ block.name } Block`, () => { } ); } ); - conditionalDescribe( process.env.WP_VERSION > 5.4 )( - 'before compatibility notice is dismissed', - () => { - beforeEach( async () => { - await page.evaluate( () => { - localStorage.setItem( - 'wc-blocks_dismissed_compatibility_notices', - '[]' - ); - } ); - await visitBlockPage( `${ block.name } Block` ); - } ); - - it( 'shows compatibility notice', async () => { - const compatibilityNoticeTitle = await page.$x( - `//h1[contains(text(), 'Compatibility notice')]` + describe( 'before compatibility notice is dismissed', () => { + beforeEach( async () => { + await page.evaluate( () => { + localStorage.setItem( + 'wc-blocks_dismissed_compatibility_notices', + '[]' ); - expect( compatibilityNoticeTitle.length ).toBe( 1 ); } ); - } - ); + await visitBlockPage( `${ block.name } Block` ); + } ); + + it( 'shows compatibility notice', async () => { + const compatibilityNoticeTitle = await page.$x( + `//h1[contains(text(), 'Compatibility notice')]` + ); + expect( compatibilityNoticeTitle.length ).toBe( 1 ); + } ); + } ); describe( 'once compatibility notice is dismissed', () => { beforeEach( async () => { diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/backend/checkout.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/backend/checkout.test.js index dc1cd8bdbba..82522d9811d 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/backend/checkout.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/backend/checkout.test.js @@ -14,7 +14,6 @@ import { import { insertBlockDontWaitForInsertClose, closeInserter, - conditionalDescribe, } from '../../utils.js'; const block = { @@ -40,27 +39,24 @@ describe( `${ block.name } Block`, () => { } ); } ); - conditionalDescribe( process.env.WP_VERSION > 5.4 )( - 'before compatibility notice is dismissed', - () => { - beforeEach( async () => { - await page.evaluate( () => { - localStorage.setItem( - 'wc-blocks_dismissed_compatibility_notices', - '[]' - ); - } ); - await visitBlockPage( `${ block.name } Block` ); - } ); - - it( 'shows compatibility notice', async () => { - const compatibilityNoticeTitle = await page.$x( - `//h1[contains(text(), 'Compatibility notice')]` + describe( 'before compatibility notice is dismissed', () => { + beforeEach( async () => { + await page.evaluate( () => { + localStorage.setItem( + 'wc-blocks_dismissed_compatibility_notices', + '[]' ); - expect( compatibilityNoticeTitle.length ).toBe( 1 ); } ); - } - ); + await visitBlockPage( `${ block.name } Block` ); + } ); + + it( 'shows compatibility notice', async () => { + const compatibilityNoticeTitle = await page.$x( + `//h1[contains(text(), 'Compatibility notice')]` + ); + expect( compatibilityNoticeTitle.length ).toBe( 1 ); + } ); + } ); describe( 'once compatibility notice is dismissed', () => { beforeEach( async () => { diff --git a/plugins/woocommerce-blocks/tests/e2e/utils.js b/plugins/woocommerce-blocks/tests/e2e/utils.js index 10715a58070..cad5e8900f7 100644 --- a/plugins/woocommerce-blocks/tests/e2e/utils.js +++ b/plugins/woocommerce-blocks/tests/e2e/utils.js @@ -20,7 +20,3 @@ export async function insertBlockDontWaitForInsertClose( searchTerm ) { export const closeInserter = async () => { await page.click( '.edit-post-header [aria-label="Add block"]' ); }; - -export const conditionalDescribe = ( condition ) => { - return condition ? describe : describe.skip; -};