Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add E2E test that the Classic Template can be replaced with the block…
Browse files Browse the repository at this point in the history
…ified version
  • Loading branch information
kmanijak committed Jan 24, 2023
1 parent 52d1313 commit a52107d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/e2e/specs/backend/site-editing-templates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit a52107d

Please sign in to comment.