Commit b707bb65740 for woocommerce
commit b707bb657407f6756b60925704458f64154d53fc
Author: Luigi Teschio <gigitux@gmail.com>
Date: Wed Oct 21 17:13:45 2026 +0200
Fix checkout template editor E2E flow for WordPress 7.2 (#70093)
* Fix checkout template editor E2E flow for WordPress 7.2
* Add changelog entry for checkout template editor tests
* Match the existing E2E lint suppression comment
* Document the WordPress 7.2 template editor selector change
diff --git a/plugins/woocommerce/changelog/dev-checkout-template-editor-wordpress-72 b/plugins/woocommerce/changelog/dev-checkout-template-editor-wordpress-72
new file mode 100644
index 00000000000..969a9e94b8b
--- /dev/null
+++ b/plugins/woocommerce/changelog/dev-checkout-template-editor-wordpress-72
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Update product editor E2E selectors for WordPress 7.2; no production change.
diff --git a/plugins/woocommerce/tests/e2e/tests/blocks/templates/checkout-template.block_theme.spec.ts b/plugins/woocommerce/tests/e2e/tests/blocks/templates/checkout-template.block_theme.spec.ts
index a3bb0602db0..154505a23cc 100644
--- a/plugins/woocommerce/tests/e2e/tests/blocks/templates/checkout-template.block_theme.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/blocks/templates/checkout-template.block_theme.spec.ts
@@ -27,6 +27,7 @@ test.describe( 'Test the checkout template', () => {
admin,
editor,
page,
+ wpCoreVersion,
} ) => {
await admin.visitSiteEditor( {
postType: 'page',
@@ -44,8 +45,32 @@ test.describe( 'Test the checkout template', () => {
).toBeVisible();
await editor.openDocumentSettingsSidebar();
- await page.getByLabel( 'Template options' ).click();
- await page.getByRole( 'menuitem', { name: 'Edit template' } ).click();
+ // On 7.2 and above, the selectors for editing the template have changed: https://make.wordpress.org/core/2026/09/17/call-for-testing-dataform-editor-inspector/
+ // eslint-disable-next-line playwright/no-conditional-in-test
+ if ( wpCoreVersion >= 7.2 ) {
+ await page
+ .getByRole( 'button', {
+ name: 'Template: Page: Checkout',
+ exact: true,
+ } )
+ .click();
+ await page
+ .getByRole( 'button', { name: 'Edit', exact: true } )
+ .click();
+ } else {
+ await page.getByLabel( 'Template options' ).click();
+ await page
+ .getByRole( 'menuitem', { name: 'Edit template' } )
+ .click();
+ }
+
+ await expect
+ .poll( () =>
+ page.evaluate( () =>
+ window.wp.data.select( 'core/editor' ).getCurrentPostId()
+ )
+ )
+ .toBe( templatePath );
await expect(
editor.canvas.getByRole( 'button', {