From a52107d2f1ffee9428d5d26e351f67c6c91e6c45 Mon Sep 17 00:00:00 2001 From: Karol Manijak Date: Tue, 24 Jan 2023 15:59:32 +0100 Subject: [PATCH] Add E2E test that the Classic Template can be replaced with the blockified version --- .../backend/site-editing-templates.test.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/e2e/specs/backend/site-editing-templates.test.js b/tests/e2e/specs/backend/site-editing-templates.test.js index ccc033c3ae7..4ba80970936 100644 --- a/tests/e2e/specs/backend/site-editing-templates.test.js +++ b/tests/e2e/specs/backend/site-editing-templates.test.js @@ -124,6 +124,14 @@ const SELECTORS = { templateActions: '[aria-label="Templates list - Content"] [aria-label="Actions"]', }, + blockifiedTemplateBlocks: { + storeNotices: '.wc-block-store-notices', + // TODO: Uncomment and add selector when Breadcrumb block becomes available + // breadcrumbs: '', + productResultsCount: '.wc-block-product-results-count', + catalogSorting: '.wc-block-catalog-sorting', + products: '.wp-block-query', + }, }; const CUSTOMIZED_STRING = 'My awesome customization'; @@ -319,6 +327,33 @@ describe( 'Store Editing Templates', () => { timeout: DEFAULT_TIMEOUT, } ); } ); + + it( 'should allow the user to blockify the Classic Template', async () => { + const { + storeNotices, + productResultsCount, + catalogSorting, + products, + } = SELECTORS.blockifiedTemplateBlocks; + const { productArchive } = SELECTORS.blocks; + + await goToTemplateEditor( { + postId: 'woocommerce/woocommerce//archive-product', + } ); + + await expect( page ).toClick( 'button', { + text: 'Upgrade to Products block', + } ); + + await expect( page ).not.toMatchElement( productArchive ); + + await expect( page ).toMatchElement( storeNotices ); + // TODO: Uncomment when Breadcrumb block becomes available + // await expect( page ).toMatchElement( breadcrumbs ); + await expect( page ).toMatchElement( productResultsCount ); + await expect( page ).toMatchElement( catalogSorting ); + await expect( page ).toMatchElement( products ); + } ); } ); describe( 'Product by Category block template', () => {