Commit 5f0bccad332 for woocommerce
commit 5f0bccad3324a58eb0f8e3145d71f3babdf89000
Author: Alex López <45979455+alopezari@users.noreply.github.com>
Date: Mon Aug 10 09:38:24 2026 +0200
Scope product data tab locators to prevent E2E strict mode violations (#67106)
Scope product data tab locators to the product data metabox
The Shipping and General tab locators in product-create-simple.spec.ts
searched the whole page by accessible name. Since getByRole matches names
by substring, any plugin registering an admin menu link containing
"Shipping" or "General" resolved to a second element and failed the test
with a strict mode violation.
Scoping both locators to #woocommerce-product-data restricts the search to
the product data metabox, matching what the Attributes tab locator already
does.
Closes #67102
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
diff --git a/plugins/woocommerce/changelog/67102-e2e-product-data-tab-locators b/plugins/woocommerce/changelog/67102-e2e-product-data-tab-locators
new file mode 100644
index 00000000000..6cb63dea3e8
--- /dev/null
+++ b/plugins/woocommerce/changelog/67102-e2e-product-data-tab-locators
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Scope product data tab locators in product-create-simple.spec.ts to the product data metabox.
diff --git a/plugins/woocommerce/tests/e2e/tests/product/product-create-simple.spec.ts b/plugins/woocommerce/tests/e2e/tests/product/product-create-simple.spec.ts
index 40bda3f3a45..b255a13fb0b 100644
--- a/plugins/woocommerce/tests/e2e/tests/product/product-create-simple.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/product/product-create-simple.spec.ts
@@ -209,6 +209,7 @@ for ( const productType of Object.keys( productData ) ) {
if ( productData[ productType ].shipping ) {
await test.step( 'add shipping details', async () => {
await page
+ .locator( '#woocommerce-product-data' )
.getByRole( 'link', { name: 'Shipping' } )
.click();
await expect(
@@ -250,7 +251,10 @@ for ( const productType of Object.keys( productData ) ) {
).toBeChecked();
// Add a download link
- await page.getByRole( 'link', { name: 'General' } ).click();
+ await page
+ .locator( '#woocommerce-product-data' )
+ .getByRole( 'link', { name: 'General' } )
+ .click();
await page
.getByRole( 'link', { name: 'Add File' } )
.click();