Commit df831d351e3 for woocommerce
commit df831d351e3b6a222c2abab62ec1e2d3e4d9dbb2
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Tue Jul 7 15:45:10 2026 +0300
e2e tests: Fix product-delete list-table quick-delete (#66360)
diff --git a/plugins/woocommerce/changelog/testops-179-fix-product-delete-quick-delete-flake b/plugins/woocommerce/changelog/testops-179-fix-product-delete-quick-delete-flake
new file mode 100644
index 00000000000..579e66206a1
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-179-fix-product-delete-quick-delete-flake
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Fix flaky product-delete list-table quick-delete E2E test by scrolling the product row into view before clicking the hover-revealed Trash / Delete Permanently row action.
diff --git a/plugins/woocommerce/tests/e2e/tests/product/product-delete.spec.ts b/plugins/woocommerce/tests/e2e/tests/product/product-delete.spec.ts
index 9fceb27f186..ec27325b84c 100644
--- a/plugins/woocommerce/tests/e2e/tests/product/product-delete.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/product/product-delete.spec.ts
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
+import type { Page } from '@playwright/test';
import { WC_API_PATH } from '@woocommerce/e2e-utils-playwright';
/**
@@ -10,6 +11,29 @@ import { expect, test as baseTest } from '../../fixtures/fixtures';
import { getFakeProduct } from '../../utils/data';
import { ADMIN_STATE_PATH } from '../../playwright.config';
+/**
+ * Clicks the hover-revealed Trash / Delete Permanently row action for a product
+ * in the WP list table.
+ *
+ * The matched product row can render near the bottom of the list table, where
+ * the revealed action link ends up below the fold or obscured by the table
+ * footer, so a plain click is intercepted and times out. Scrolling the row into
+ * view before hovering keeps the action inside the viewport and clickable.
+ */
+async function deleteProductViaRowAction( page: Page, productId: number ) {
+ const row = page.locator( `#post-${ productId }` );
+
+ // Bring the row (and its always-present row-actions) fully into view before
+ // hovering, so the Trash link isn't outside the viewport or under the footer.
+ await row.scrollIntoViewIfNeeded();
+
+ // Mouse over the product row to reveal the quick actions.
+ await row.hover();
+
+ // Trigger the delete row action.
+ await row.locator( '.submitdelete' ).click();
+}
+
const test = baseTest.extend( {
storageState: ADMIN_STATE_PATH,
product: async ( { restApi }, use ) => {
@@ -81,11 +105,7 @@ test( 'can quick delete a product from product list', async ( {
} );
await test.step( 'Move product to trash', async () => {
- // mouse over the product row to display the quick actions
- await page.locator( `#post-${ product.id }` ).hover();
-
- // move product to trash
- await page.locator( `#post-${ product.id } .submitdelete` ).click();
+ await deleteProductViaRowAction( page, product.id );
} );
await test.step( 'Verify product was trashed', async () => {
@@ -127,11 +147,7 @@ test( 'can permanently delete a product from trash list', async ( {
} );
await test.step( 'Permanently delete the product', async () => {
- // mouse over the product row to display the quick actions
- await page.locator( `#post-${ product.id }` ).hover();
-
- // delete the product
- await page.locator( `#post-${ product.id } .submitdelete` ).click();
+ await deleteProductViaRowAction( page, product.id );
} );
await test.step( 'Verify product was permanently deleted', async () => {