Commit 53984a0898d for woocommerce
commit 53984a0898d785e85cab3269138552ea895493a5
Author: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
Date: Tue Feb 24 23:05:58 2026 +0800
Adjust E2E tests to WordPress 7.0 (#63424)
* Fix custom HTML selector with WP 7.0
---------
Co-authored-by: Brandon Kraft <public@brandonkraft.com>
diff --git a/plugins/woocommerce/changelog/fix-e2e-tests-with-wp70 b/plugins/woocommerce/changelog/fix-e2e-tests-with-wp70
new file mode 100644
index 00000000000..25454342782
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-e2e-tests-with-wp70
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+E2E tests adjustments to WP 7.0
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts
index d9ec9ff9930..8389c139325 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts
@@ -170,6 +170,7 @@ test.describe( `${ blockData.name } Block`, () => {
editor,
requestUtils,
blockUtils,
+ wpCoreVersion,
} ) => {
// Add to Cart with Options in the Site Editor is only available as
// inner block of the Single Product Block except for the Single Product
@@ -186,7 +187,16 @@ test.describe( `${ blockData.name } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'placeholder' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( { name: 'woocommerce/single-product' } );
@@ -208,6 +218,7 @@ test.describe( `${ blockData.name } Block`, () => {
admin,
editor,
requestUtils,
+ wpCoreVersion,
} ) => {
const template = await requestUtils.createTemplate( 'wp_template', {
slug: 'single-product',
@@ -221,7 +232,16 @@ test.describe( `${ blockData.name } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'placeholder' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( { name: blockData.slug } );
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/breadcrumbs/breadcrumbs.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/breadcrumbs/breadcrumbs.block_theme.spec.ts
index b93ced63519..628b14c7d7a 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/breadcrumbs/breadcrumbs.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/breadcrumbs/breadcrumbs.block_theme.spec.ts
@@ -30,11 +30,12 @@ test.describe( `${ blockData.slug } Block`, () => {
admin,
requestUtils,
editor,
+ wpCoreVersion,
} ) => {
const template = await requestUtils.createTemplate( 'wp_template', {
slug: 'sorter',
title: 'Sorter',
- content: 'howdy',
+ content: 'placeholder',
} );
await admin.visitSiteEditor( {
@@ -43,7 +44,16 @@ test.describe( `${ blockData.slug } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( {
name: blockData.slug,
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/catalog-sorting/catalog-sorting.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/catalog-sorting/catalog-sorting.block_theme.spec.ts
index 6e674a4cd9d..3727e0591f6 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/catalog-sorting/catalog-sorting.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/catalog-sorting/catalog-sorting.block_theme.spec.ts
@@ -31,11 +31,12 @@ test.describe( `${ blockData.slug } Block`, () => {
admin,
requestUtils,
editor,
+ wpCoreVersion,
} ) => {
const template = await requestUtils.createTemplate( 'wp_template', {
slug: 'sorter',
title: 'Sorter',
- content: 'howdy',
+ content: 'placeholder',
} );
await admin.visitSiteEditor( {
@@ -44,7 +45,15 @@ test.describe( `${ blockData.slug } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( {
name: blockData.slug,
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-collection/product-collection.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-collection/product-collection.block_theme.spec.ts
index 93c4427fefa..b3a31f17387 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-collection/product-collection.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-collection/product-collection.block_theme.spec.ts
@@ -788,6 +788,7 @@ test.describe( 'Product Collection', () => {
admin,
editor,
page,
+ wpCoreVersion,
} ) => {
await pageObject.refreshLocators( 'frontend' );
@@ -801,7 +802,7 @@ test.describe( 'Product Collection', () => {
{
slug,
title: 'classic template test',
- content: 'howdy',
+ content: 'placeholder',
}
);
@@ -811,9 +812,15 @@ test.describe( 'Product Collection', () => {
canvas: 'edit',
} );
- await expect(
- editor.canvas.getByText( 'howdy' )
- ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( { name: legacyBlockName } );
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.spec.ts
index f051881781e..b1e30c28bd1 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.spec.ts
@@ -4,29 +4,40 @@
import { test, expect } from '@woocommerce/e2e-utils';
test.describe( 'Product Gallery Thumbnails block', () => {
- test.beforeEach( async ( { admin, editor, requestUtils } ) => {
- const template = await requestUtils.createTemplate( 'wp_template', {
- slug: 'single-product',
- title: 'Custom Single Product',
- content: 'placeholder',
- } );
+ test.beforeEach(
+ async ( { admin, editor, requestUtils, wpCoreVersion } ) => {
+ const template = await requestUtils.createTemplate( 'wp_template', {
+ slug: 'single-product',
+ title: 'Custom Single Product',
+ content: 'placeholder',
+ } );
- await admin.visitSiteEditor( {
- postId: template.id,
- postType: 'wp_template',
- canvas: 'edit',
- } );
+ await admin.visitSiteEditor( {
+ postId: template.id,
+ postType: 'wp_template',
+ canvas: 'edit',
+ } );
- await expect( editor.canvas.getByText( 'placeholder' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
- await editor.insertBlock( {
- name: 'woocommerce/product-gallery',
- } );
+ await expect( placeholderLocator ).toBeVisible();
- await editor.saveSiteEditorEntities( {
- isOnlyCurrentEntityDirty: true,
- } );
- } );
+ await editor.insertBlock( {
+ name: 'woocommerce/product-gallery',
+ } );
+
+ await editor.saveSiteEditorEntities( {
+ isOnlyCurrentEntityDirty: true,
+ } );
+ }
+ );
test( 'renders as expected', async ( { page, editor } ) => {
await test.step( 'in editor', async () => {
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.spec.ts
index 1abf3b340a5..37afb520fa7 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.spec.ts
@@ -67,21 +67,32 @@ const getThumbnailImageIdByNth = async (
};
test.describe( `${ blockData.name }`, () => {
- test.beforeEach( async ( { admin, editor, requestUtils } ) => {
- const template = await requestUtils.createTemplate( 'wp_template', {
- slug: blockData.slug,
- title: 'Custom Single Product',
- content: 'placeholder',
- } );
+ test.beforeEach(
+ async ( { admin, editor, requestUtils, wpCoreVersion } ) => {
+ const template = await requestUtils.createTemplate( 'wp_template', {
+ slug: blockData.slug,
+ title: 'Custom Single Product',
+ content: 'placeholder',
+ } );
- await admin.visitSiteEditor( {
- postId: template.id,
- postType: 'wp_template',
- canvas: 'edit',
- } );
+ await admin.visitSiteEditor( {
+ postId: template.id,
+ postType: 'wp_template',
+ canvas: 'edit',
+ } );
- await expect( editor.canvas.getByText( 'placeholder' ) ).toBeVisible();
- } );
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+
+ await expect( placeholderLocator ).toBeVisible();
+ }
+ );
test.describe( 'with thumbnails', () => {
test( 'should have as first thumbnail, the same image that it is visible in the product block', async ( {
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-results-count/product-results-count.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-results-count/product-results-count.block_theme.spec.ts
index a5abc63af1b..888e5e48039 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/product-results-count/product-results-count.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/product-results-count/product-results-count.block_theme.spec.ts
@@ -31,11 +31,12 @@ test.describe( `${ blockData.slug } Block`, () => {
admin,
requestUtils,
editor,
+ wpCoreVersion,
} ) => {
const template = await requestUtils.createTemplate( 'wp_template', {
slug: 'sorter',
title: 'Sorter',
- content: 'howdy',
+ content: 'placeholder',
} );
await admin.visitSiteEditor( {
@@ -44,7 +45,15 @@ test.describe( `${ blockData.slug } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( {
name: blockData.slug,
} );
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/single-product-details/single-product-details.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/single-product-details/single-product-details.block_theme.spec.ts
index fcfe5fce9f8..2a87972c1c6 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/single-product-details/single-product-details.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/single-product-details/single-product-details.block_theme.spec.ts
@@ -34,12 +34,13 @@ test.describe( `${ blockData.slug } Block`, () => {
admin,
requestUtils,
editor,
+ wpCoreVersion,
} ) => {
const template = await requestUtils.createTemplate( 'wp_template', {
// Single Product Details block is addable only in Single Product Templates
slug: 'single-product-v-neck-t-shirt',
title: 'Sorter',
- content: 'howdy',
+ content: 'placeholder',
} );
await admin.visitSiteEditor( {
@@ -48,7 +49,15 @@ test.describe( `${ blockData.slug } Block`, () => {
canvas: 'edit',
} );
- await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
+ // TODO: WP 7.0 compat - Custom HTML block content is inside an iframe
+ // since WP 7.0. Simplify when WP 7.0 is the minimum supported version.
+ const placeholderLocator =
+ wpCoreVersion >= 7
+ ? editor.canvas
+ .frameLocator( 'iframe' )
+ .getByText( 'placeholder' )
+ : editor.canvas.getByText( 'placeholder' );
+ await expect( placeholderLocator ).toBeVisible();
await editor.insertBlock( {
name: blockData.slug,
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts
index 91e49b1f55c..0e96c27d29a 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts
@@ -41,6 +41,8 @@ test.describe( 'Single Product template', () => {
.click();
await page.getByLabel( 'Close', { exact: true } ).click();
+ await editor.canvas.locator( 'body' ).waitFor( { timeout: 20000 } );
+
// Edit the template.
await editor.insertBlock( {
name: 'core/paragraph',
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme_with_templates.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme_with_templates.spec.ts
index 3567ccfbd5c..81aaf46d72b 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme_with_templates.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/single-product-template.block_theme_with_templates.spec.ts
@@ -34,6 +34,8 @@ test.describe( 'Single Product Template', () => {
canvas: 'edit',
} );
+ await editor.canvas.locator( 'body' ).waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: userText },
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme.spec.ts
index 7d505b2c3a3..fe72e22d540 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme.spec.ts
@@ -34,6 +34,8 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas.locator( 'body' ).waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: userText },
@@ -91,6 +93,10 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas
+ .locator( 'body' )
+ .waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
@@ -156,6 +162,8 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas.locator( 'body' ).waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: woocommerceTemplateUserText },
@@ -175,6 +183,8 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas.locator( 'body' ).waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: userText },
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme_with_templates.spec.ts b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme_with_templates.spec.ts
index 2e2a39eb1f4..5b0aeb2f147 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme_with_templates.spec.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/tests/templates/template-customization.block_theme_with_templates.spec.ts
@@ -43,6 +43,10 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas
+ .locator( 'body' )
+ .waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: userText },
@@ -113,6 +117,10 @@ test.describe( 'Template customization', () => {
canvas: 'edit',
} );
+ await editor.canvas
+ .locator( 'body' )
+ .waitFor( { timeout: 20000 } );
+
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
diff --git a/plugins/woocommerce/client/blocks/tests/e2e/utils/editor/editor-utils.page.ts b/plugins/woocommerce/client/blocks/tests/e2e/utils/editor/editor-utils.page.ts
index 6c83d88a367..d05dc6255a8 100644
--- a/plugins/woocommerce/client/blocks/tests/e2e/utils/editor/editor-utils.page.ts
+++ b/plugins/woocommerce/client/blocks/tests/e2e/utils/editor/editor-utils.page.ts
@@ -119,7 +119,7 @@ export class Editor extends CoreEditor {
*/
async searchTemplate( { templateName }: { templateName: string } ) {
const templateCards = this.page.locator(
- '.dataviews-view-grid > .dataviews-view-grid__card'
+ '.dataviews-view-grid .dataviews-view-grid__card'
);
const templatesBeforeSearch = await templateCards.count();
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/editor/command-palette.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/editor/command-palette.spec.ts
index 5e3875149c2..7e3c8da6cf8 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/editor/command-palette.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/editor/command-palette.spec.ts
@@ -34,13 +34,13 @@ const clickOnCommandPaletteOption = async ( {
)
.fill( optionName );
- // Click on the relevant option.
+ // TODO: WP 7.0 compat - WP 7.0 appends "Action" to command palette option
+ // accessible names. Simplify when WP 7.0 is the minimum supported version.
const option = page.getByRole( 'option', {
- name: optionName,
- exact: true,
+ name: new RegExp( `^${ optionName }( Action)?$` ),
} );
await expect( option ).toBeVisible();
- option.click();
+ await option.click();
};
const test = baseTest.extend( {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/email-editor/email-editor-loads.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/email-editor/email-editor-loads.spec.ts
index d12b869d984..101c8babd33 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/email-editor/email-editor-loads.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/email-editor/email-editor-loads.spec.ts
@@ -35,7 +35,12 @@ test.describe( 'WooCommerce Email Editor Core', () => {
test( 'Can access the email editor', async ( { page } ) => {
// Try with the new order email.
await accessTheEmailEditor( page, 'New order' );
- await page.getByRole( 'tab', { name: 'Email' } ).click();
+ // TODO: WP 7.0 compat - WP 7.0 changed the editor sidebar tab role from
+ // tab to button. Simplify when WP 7.0 is the minimum supported version.
+ const emailTab = page
+ .getByRole( 'tab', { name: 'Email' } )
+ .or( page.getByRole( 'button', { name: 'Email', exact: true } ) );
+ await emailTab.click();
await expect(
page.locator( '.editor-post-card-panel__title' )
).toContainText( 'New order' );
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/js-file-monitor/monitor-js-file-number.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/js-file-monitor/monitor-js-file-number.spec.ts
index 1cea2e40c9f..569f34da516 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/js-file-monitor/monitor-js-file-number.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/js-file-monitor/monitor-js-file-number.spec.ts
@@ -14,8 +14,10 @@ const pageGroups = [
storageState: undefined,
pages: [
{ name: 'Shop page', url: 'shop/', expectedCount: 50 },
- { name: 'Cart', url: 'cart/', expectedCount: 55 },
- { name: 'Checkout', url: 'checkout/', expectedCount: 55 },
+ // TODO: WP 7.0 compat - threshold bumped from 55 for WP 7.0 extra
+ // core scripts. Re-evaluate when WP 7.0 is the minimum version.
+ { name: 'Cart', url: 'cart/', expectedCount: 65 },
+ { name: 'Checkout', url: 'checkout/', expectedCount: 65 },
],
},
{
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/product/product-edit.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/product/product-edit.spec.ts
index 2e6723da105..002c2a65644 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/product/product-edit.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/product/product-edit.spec.ts
@@ -142,9 +142,15 @@ test( 'can bulk edit products', async ( { page, products } ) => {
await test.step( 'select and bulk edit the products', async () => {
await selectAllProducts( page, products );
- await page
- .locator( '#bulk-action-selector-top' )
- .selectOption( 'Edit' );
+ // TODO: WP 7.0 compat - WP 7.0 renamed "Edit" to "Bulk edit" in the
+ // bulk actions dropdown. Simplify when WP 7.0 is the minimum version.
+ const bulkActionSelect = page.locator( '#bulk-action-selector-top' );
+ const bulkEditOption = bulkActionSelect.locator( 'option', {
+ hasText: /^(Bulk edit|Edit)$/,
+ } );
+ await bulkActionSelect.selectOption( {
+ label: ( await bulkEditOption.textContent() ) ?? 'Bulk edit',
+ } );
await page.locator( '#doaction' ).click();
await expect(
@@ -233,9 +239,15 @@ test(
await test.step( 'select and bulk edit the products', async () => {
await selectAllProducts( page, products );
- await page
- .locator( '#bulk-action-selector-top' )
- .selectOption( 'Edit' );
+ const bulkActionSelect = page.locator(
+ '#bulk-action-selector-top'
+ );
+ const bulkEditOption = bulkActionSelect.locator( 'option', {
+ hasText: /^(Bulk edit|Edit)$/,
+ } );
+ await bulkActionSelect.selectOption( {
+ label: ( await bulkEditOption.textContent() ) ?? undefined,
+ } );
await page.locator( '#doaction' ).click();
await expect( page.locator( '#bulk-titles-list li' ) ).toHaveCount(
@@ -288,9 +300,15 @@ test(
await selectAllProducts( page, products );
- await page
- .locator( '#bulk-action-selector-top' )
- .selectOption( 'Edit' );
+ const bulkActionSelect = page.locator(
+ '#bulk-action-selector-top'
+ );
+ const bulkEditOption = bulkActionSelect.locator( 'option', {
+ hasText: /^(Bulk edit|Edit)$/,
+ } );
+ await bulkActionSelect.selectOption( {
+ label: ( await bulkEditOption.textContent() ) ?? undefined,
+ } );
await page.locator( '#doaction' ).click();
await page
@@ -329,9 +347,15 @@ test(
await selectAllProducts( page, products );
- await page
- .locator( '#bulk-action-selector-top' )
- .selectOption( 'Edit' );
+ const bulkActionSelect = page.locator(
+ '#bulk-action-selector-top'
+ );
+ const bulkEditOption = bulkActionSelect.locator( 'option', {
+ hasText: /^(Bulk edit|Edit)$/,
+ } );
+ await bulkActionSelect.selectOption( {
+ label: ( await bulkEditOption.textContent() ) ?? undefined,
+ } );
await page.locator( '#doaction' ).click();
await page
@@ -397,11 +421,16 @@ test(
await selectProduct( page, product );
- await page
- .locator( '#bulk-action-selector-top' )
- .selectOption( 'Edit' );
+ const bulkActionSelect = page.locator(
+ '#bulk-action-selector-top'
+ );
+ const bulkEditOption = bulkActionSelect.locator( 'option', {
+ hasText: /^(Bulk edit|Edit)$/,
+ } );
+ await bulkActionSelect.selectOption( {
+ label: ( await bulkEditOption.textContent() ) ?? undefined,
+ } );
await page.locator( '#doaction' ).click();
-
await page
.locator( 'select[name="change_sale_price"]' )
.selectOption(
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/product/product-images.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/product/product-images.spec.ts
index b399cf4e529..051e89e79be 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/product/product-images.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/product/product-images.spec.ts
@@ -98,8 +98,11 @@ test.describe( 'Products > Product Images', () => {
} );
await test.step( 'Set product image', async () => {
+ // TODO: WP 7.0 compat - WP 7.0 changed the featured image metabox link
+ // to a button. Simplify when WP 7.0 is the minimum supported version.
await page
.getByRole( 'link', { name: 'Set product image' } )
+ .or( page.getByRole( 'button', { name: 'Set product image' } ) )
.click();
await addImageFromLibrary( page, 'image-01', 'Set product image' );
@@ -178,11 +181,22 @@ test.describe( 'Products > Product Images', () => {
} );
await test.step( 'Remove product image', async () => {
+ // TODO: WP 7.0 compat - WP 7.0 changed the featured image metabox link
+ // to a button. Simplify when WP 7.0 is the minimum supported version.
await page
.getByRole( 'link', { name: 'Remove product image' } )
+ .or(
+ page.getByRole( 'button', {
+ name: 'Remove product image',
+ } )
+ )
.click();
await expect(
- page.getByRole( 'link', { name: 'Set product image' } )
+ page.getByRole( 'link', { name: 'Set product image' } ).or(
+ page.getByRole( 'button', {
+ name: 'Set product image',
+ } )
+ )
).toBeVisible();
await page
diff --git a/plugins/woocommerce/tests/e2e-pw/utils/email.ts b/plugins/woocommerce/tests/e2e-pw/utils/email.ts
index 0b32303b041..4e38b2be6ea 100644
--- a/plugins/woocommerce/tests/e2e-pw/utils/email.ts
+++ b/plugins/woocommerce/tests/e2e-pw/utils/email.ts
@@ -105,13 +105,18 @@ export async function accessTheEmailEditor(
) {
await page.goto( '/wp-admin/admin.php?page=wc-settings&tab=email' );
const theRow = page.getByRole( 'row', {
- name: new RegExp( emailTitle ),
+ name: emailTitle,
} );
+ await theRow
+ .getByRole( 'button', { name: 'Actions', exact: true } )
+ .waitFor( { timeout: 20000 } );
await theRow
.getByRole( 'button', { name: 'Actions', exact: true } )
.click();
await page.getByRole( 'menuitem', { name: 'Edit', exact: true } ).click();
- await expect( page.locator( '#woocommerce-email-editor' ) ).toBeVisible();
+ await expect( page.locator( '#woocommerce-email-editor' ) ).toBeVisible( {
+ timeout: 20000,
+ } );
}
export async function ensureEmailEditorSettingsPanelIsOpened( page: Page ) {