Commit 6f510fc9ffa for woocommerce
commit 6f510fc9ffa31711ed318a3191f8103ac905eefc
Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com>
Date: Wed Sep 2 16:33:16 2026 +0200
Remove 7 redundant blocks E2E tests covered lower in the pyramid (#68122)
diff --git a/plugins/woocommerce/changelog/testops-234-delete-redundant-blocks-e2e-tests b/plugins/woocommerce/changelog/testops-234-delete-redundant-blocks-e2e-tests
new file mode 100644
index 00000000000..8200dad092b
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-234-delete-redundant-blocks-e2e-tests
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+Comment: Remove 7 redundant blocks E2E tests already covered by PHPUnit and Jest unit tests.
+
diff --git a/plugins/woocommerce/client/blocks/assets/js/filters/unregister-block-types/test/index.ts b/plugins/woocommerce/client/blocks/assets/js/filters/unregister-block-types/test/index.ts
index de291a7ceed..5b62fe96630 100644
--- a/plugins/woocommerce/client/blocks/assets/js/filters/unregister-block-types/test/index.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/filters/unregister-block-types/test/index.ts
@@ -43,15 +43,23 @@ describe( 'unregister block types', () => {
( adminPage ) => {
loadFilter( adminPage, [
'woocommerce/breadcrumbs',
+ 'woocommerce/catalog-sorting',
+ 'woocommerce/product-results-count',
'woocommerce/product-reviews',
'woocommerce/product-search',
'myplugin/client-only',
] );
- expect( unregisterBlockType ).toHaveBeenCalledTimes( 2 );
+ expect( unregisterBlockType ).toHaveBeenCalledTimes( 4 );
expect( unregisterBlockType ).toHaveBeenCalledWith(
'woocommerce/breadcrumbs'
);
+ expect( unregisterBlockType ).toHaveBeenCalledWith(
+ 'woocommerce/catalog-sorting'
+ );
+ expect( unregisterBlockType ).toHaveBeenCalledWith(
+ 'woocommerce/product-results-count'
+ );
expect( unregisterBlockType ).toHaveBeenCalledWith(
'woocommerce/product-reviews'
);
@@ -75,6 +83,7 @@ describe( 'unregister block types', () => {
[
'woocommerce/product-search',
'woocommerce/product-filters',
+ 'woocommerce/cart',
'woocommerce/checkout',
'woocommerce/order-confirmation-status',
'woocommerce/new-widget-compatible-block',
@@ -83,7 +92,10 @@ describe( 'unregister block types', () => {
pageNow
);
- expect( unregisterBlockType ).toHaveBeenCalledTimes( 3 );
+ expect( unregisterBlockType ).toHaveBeenCalledTimes( 4 );
+ expect( unregisterBlockType ).toHaveBeenCalledWith(
+ 'woocommerce/cart'
+ );
expect( unregisterBlockType ).toHaveBeenCalledWith(
'woocommerce/checkout'
);
diff --git a/plugins/woocommerce/client/blocks/changelog/testops-234-name-slugs-in-unregister-block-types-test b/plugins/woocommerce/client/blocks/changelog/testops-234-name-slugs-in-unregister-block-types-test
new file mode 100644
index 00000000000..675778819ba
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/changelog/testops-234-name-slugs-in-unregister-block-types-test
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+Comment: Assert cart, catalog-sorting and product-results-count by name in the unregister-block-types unit test.
+
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-block.merchant.classic_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-block.merchant.classic_theme.spec.ts
deleted file mode 100644
index 6ef6eeddcac..00000000000
--- a/plugins/woocommerce/tests/e2e/tests/blocks/cart/cart-block.merchant.classic_theme.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * External dependencies
- */
-import { test, expect, CLASSIC_THEME_SLUG } from '@woocommerce/e2e-utils';
-
-test.describe( 'Merchant → Cart', () => {
- test.beforeEach( async ( { requestUtils } ) => {
- await requestUtils.activateTheme( CLASSIC_THEME_SLUG );
- } );
-
- test.describe( 'in widget editor', () => {
- test( "can't be inserted in a widget area", async ( {
- admin,
- editor,
- } ) => {
- await admin.visitWidgetEditor();
-
- await editor.openGlobalBlockInserter();
- await editor.page
- .getByRole( 'searchbox', { name: 'Search' } )
- .fill( 'woocommerce/cart' );
- const cartButton = editor.page.getByRole( 'option', {
- name: 'Cart',
- exact: true,
- } );
- await expect( cartButton ).toBeHidden();
- } );
- } );
-} );
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/catalog-sorting/catalog-sorting.block_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/catalog-sorting/catalog-sorting.block_theme.spec.ts
index b0e9dec3811..675f8fd6113 100644
--- a/plugins/woocommerce/tests/e2e/tests/blocks/catalog-sorting/catalog-sorting.block_theme.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/blocks/catalog-sorting/catalog-sorting.block_theme.spec.ts
@@ -10,23 +10,6 @@ const blockData = {
};
test.describe( `${ blockData.slug } Block`, () => {
- test( "block can't be inserted in Post Editor", async ( {
- editor,
- admin,
- } ) => {
- await admin.createNewPost();
-
- try {
- await editor.insertBlock( { name: blockData.slug } );
- } catch ( _error ) {
- // noop
- }
-
- await expect(
- await editor.getBlockByName( blockData.slug )
- ).toBeHidden();
- } );
-
test( 'block can be inserted in the Site Editor', async ( {
admin,
requestUtils,
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/checkout/checkout-block.merchant.classic_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/checkout/checkout-block.merchant.classic_theme.spec.ts
deleted file mode 100644
index 8f8c9ef5c2b..00000000000
--- a/plugins/woocommerce/tests/e2e/tests/blocks/checkout/checkout-block.merchant.classic_theme.spec.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * External dependencies
- */
-import { test, expect, CLASSIC_THEME_SLUG } from '@woocommerce/e2e-utils';
-
-test.describe( 'Merchant → Checkout', () => {
- test.beforeEach( async ( { requestUtils } ) => {
- await requestUtils.activateTheme( CLASSIC_THEME_SLUG );
- } );
-
- test.describe( 'in widget editor', () => {
- test( "can't be inserted in a widget area", async ( {
- admin,
- editor,
- } ) => {
- await admin.visitWidgetEditor();
- await editor.openGlobalBlockInserter();
- await editor.page
- .getByRole( 'searchbox', { name: 'Search' } )
- .fill( 'woocommerce/checkout' );
- const checkoutButton = editor.page.getByRole( 'option', {
- name: 'Checkout',
- exact: true,
- } );
- await expect( checkoutButton ).toBeHidden();
- } );
- } );
-} );
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/customer-account/customer-account.block_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/customer-account/customer-account.block_theme.spec.ts
deleted file mode 100644
index 4e2d028aedd..00000000000
--- a/plugins/woocommerce/tests/e2e/tests/blocks/customer-account/customer-account.block_theme.spec.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * External dependencies
- */
-import { expect, test } from '@woocommerce/e2e-utils';
-
-const blockData = {
- name: 'woocommerce/customer-account',
- selectors: {
- frontend: {
- icon: 'svg',
- label: '.label',
- },
- editor: {
- iconOptions: '.customer-account-display-style select',
- iconToggle: '.wc-block-customer-account__icon-style-toggle',
- },
- },
-};
-
-const selectTextOnlyOption = async ( { page } ) => {
- await page
- .locator( blockData.selectors.editor.iconOptions )
- .selectOption( 'Text-only' );
-
- page.locator( blockData.selectors.editor.iconToggle );
-};
-
-const selectIconOnlyOption = async ( { page } ) => {
- await page
- .locator( blockData.selectors.editor.iconOptions )
- .selectOption( 'Icon-only' );
-
- page.locator( blockData.selectors.editor.iconToggle );
-};
-
-const selectIconAndTextOption = async ( { page } ) => {
- await page
- .locator( blockData.selectors.editor.iconOptions )
- .selectOption( 'Icon and text' );
-
- page.locator( blockData.selectors.editor.iconToggle );
-};
-
-test.describe( `${ blockData.name } Block`, () => {
- test( 'Icon Options can be set to Text-only', async ( {
- admin,
- editor,
- page,
- frontendUtils,
- } ) => {
- await admin.createNewPost();
- await editor.insertBlock( { name: blockData.name } );
-
- await selectTextOnlyOption( { page } );
-
- await editor.publishAndVisitPost();
-
- // We have specified the parent block name as 'main' to ensure that the
- // block is found within the main content area of the page and not the hooked block in the header.
- const block = await frontendUtils.getBlockByName(
- blockData.name,
- 'main'
- );
-
- await expect(
- block.locator( blockData.selectors.frontend.label )
- ).toBeVisible();
- await expect(
- block.locator( blockData.selectors.frontend.icon )
- ).toBeHidden();
- } );
-
- test( 'Icon Options can be set to Icon-only', async ( {
- admin,
- editor,
- page,
- frontendUtils,
- } ) => {
- await admin.createNewPost();
- await editor.insertBlock( { name: blockData.name } );
-
- await selectIconOnlyOption( { page } );
-
- await editor.publishAndVisitPost();
-
- // We have specified the parent block name as 'main' to ensure that the
- // block is found within the main content area of the page and not the hooked block in the header.
- const block = await frontendUtils.getBlockByName(
- blockData.name,
- 'main'
- );
-
- await expect(
- block.locator( blockData.selectors.frontend.label )
- ).toBeHidden();
- await expect(
- block.locator( blockData.selectors.frontend.icon )
- ).toBeVisible();
- } );
-
- test( 'Icon Options can be set to Icon and text', async ( {
- admin,
- editor,
- page,
- frontendUtils,
- } ) => {
- await admin.createNewPost();
- await editor.insertBlock( { name: blockData.name } );
-
- await selectIconAndTextOption( { page } );
-
- await editor.publishAndVisitPost();
-
- // We have specified the parent block name as 'main' to ensure that the
- // block is found within the main content area of the page and not the hooked block in the header.
- const block = await frontendUtils.getBlockByName(
- blockData.name,
- 'main'
- );
-
- await expect(
- block.locator( blockData.selectors.frontend.label )
- ).toBeVisible();
- await expect(
- block.locator( blockData.selectors.frontend.icon )
- ).toBeVisible();
- } );
-} );
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/product-results-count/product-results-count.block_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/product-results-count/product-results-count.block_theme.spec.ts
index 28b9af2fb79..aa27489404d 100644
--- a/plugins/woocommerce/tests/e2e/tests/blocks/product-results-count/product-results-count.block_theme.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/blocks/product-results-count/product-results-count.block_theme.spec.ts
@@ -10,23 +10,6 @@ const blockData = {
};
test.describe( `${ blockData.slug } Block`, () => {
- test( "block can't be inserted in Post Editor", async ( {
- editor,
- admin,
- } ) => {
- await admin.createNewPost();
-
- try {
- await editor.insertBlock( { name: blockData.slug } );
- } catch ( _error ) {
- // noop
- }
-
- await expect(
- await editor.getBlockByName( blockData.slug )
- ).toBeHidden();
- } );
-
test( 'block can be inserted in the Site Editor', async ( {
admin,
requestUtils,