Commit 64878dc6ce5 for woocommerce
commit 64878dc6ce5518c7c7129f9ddecb4862de5f44b4
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Mon Jun 22 19:58:52 2026 +0300
e2e tests: fix product-reviews "can delete a product review" e2e flake (#65911)
test: fix product-reviews "can delete a product review" e2e flake
The "Undo" trash notice renders optimistically, before the trash AJAX
commits. The test asserted only that notice and then immediately clicked
the trash-status link, navigating away and aborting the in-flight trash
AJAX. Under parallel load the comment stayed approved and the Trash view
was empty, so the row was not found.
Wait for the review row to leave the approved list (toBeHidden) before
navigating, so the trash AJAX has committed.
Verified: target test passed 10/10 under --repeat-each=10 --workers=5;
full spec green at normal cadence.
Fixes TESTOPS-189
diff --git a/plugins/woocommerce/changelog/testops-189-product-reviews-delete-flake b/plugins/woocommerce/changelog/testops-189-product-reviews-delete-flake
new file mode 100644
index 00000000000..8005d2f8ef1
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-189-product-reviews-delete-flake
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Fix product-reviews "can delete a product review" E2E flake by waiting for the trash AJAX to commit before navigating to the Trash view.
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/product/product-reviews.spec.ts b/plugins/woocommerce/tests/e2e-pw/tests/product/product-reviews.spec.ts
index e6dcdb3ec51..8e837c87173 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/product/product-reviews.spec.ts
+++ b/plugins/woocommerce/tests/e2e-pw/tests/product/product-reviews.spec.ts
@@ -338,6 +338,11 @@ test.describe( 'Product Reviews', () => {
trashNoticeText2?.includes( trashMessageSmart )
).toBeTruthy();
+ // The trash notice renders optimistically, before the trash AJAX
+ // commits. Wait for the row to actually leave the approved list so
+ // navigating to the Trash view does not abort the in-flight request.
+ await expect( reviewRow ).toBeHidden();
+
await page.click( 'a[href*="comment_status=trash"]' );
await expect(