Commit f26180756ea for woocommerce
commit f26180756eafede2bc98a93ad4301117f678589e
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Mon Jun 29 18:20:41 2026 +0300
e2e tests: fix unstable customer-list and create-order tests (#66093)
diff --git a/plugins/woocommerce/changelog/fix-e2e-core-parallel-customer-order-flakiness b/plugins/woocommerce/changelog/fix-e2e-core-parallel-customer-order-flakiness
new file mode 100644
index 00000000000..e472ce89553
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-e2e-core-parallel-customer-order-flakiness
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Stabilize two e2e specs in the core-parallel pool against concurrent-worker pollution: customer-list (pin the customers report page size on the URL so the list assertions and CSV download stay deterministic regardless of how many customers other workers create) and create-order (wait for the line item to render before saving so the order is never persisted with a 0-quantity line).
diff --git a/plugins/woocommerce/tests/e2e/tests/customer/customer-list.spec.ts b/plugins/woocommerce/tests/e2e/tests/customer/customer-list.spec.ts
index 0b1d46f3451..8a87cbc6b85 100644
--- a/plugins/woocommerce/tests/e2e/tests/customer/customer-list.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/customer/customer-list.spec.ts
@@ -110,8 +110,13 @@ test.describe( 'Merchant > Customer List', () => {
const responsePromise = page.waitForResponse(
'**/wp-json/wc-analytics/reports/customers?orderby**'
);
+ // Pin the page size to 100 so every customer this test created shows
+ // on a single page regardless of how many customers other parallel
+ // workers have created. This keeps the list assertions and the CSV
+ // download (which only streams in-browser when all rows are loaded,
+ // otherwise the report is emailed) deterministic.
await page.goto(
- 'wp-admin/admin.php?page=wc-admin&path=%2Fcustomers'
+ 'wp-admin/admin.php?page=wc-admin&path=%2Fcustomers&per_page=100'
);
await responsePromise;
} );
@@ -237,8 +242,9 @@ test.describe( 'Merchant > Customer List', () => {
// around a midnight boundary. Assert the filename structure with a
// YYYY-MM-DD date rather than pinning an exact local date, which is
// what this step actually verifies (the orderby/order/path encoding).
+ // The page size we pinned on the report URL is encoded too.
const filenamePattern =
- /^customers_\d{4}-\d{2}-\d{2}_orderby-date-last-active_order-desc_page-wc-admin_path--customers\.csv$/;
+ /^customers_\d{4}-\d{2}-\d{2}_orderby-date-last-active_order-desc_page-wc-admin_path--customers_per-page-100\.csv$/;
expect( download.suggestedFilename() ).toMatch( filenamePattern );
} );
diff --git a/plugins/woocommerce/tests/e2e/tests/order/create-order.spec.ts b/plugins/woocommerce/tests/e2e/tests/order/create-order.spec.ts
index 077735ce2f8..130fbf22dca 100644
--- a/plugins/woocommerce/tests/e2e/tests/order/create-order.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/order/create-order.spec.ts
@@ -58,12 +58,26 @@ async function addProductToOrder( page: Page, product, quantity: number ) {
await page.getByText( 'Search for a product…' ).click();
await page.locator( 'span > .select2-search__field' ).fill( product.name );
await page.getByRole( 'option', { name: product.name } ).first().click();
- await page
+
+ const quantityField = page
.locator( 'tr' )
.filter( { hasText: product.name } )
- .getByPlaceholder( '1' )
- .fill( quantity.toString() );
+ .getByPlaceholder( '1' );
+ await quantityField.fill( quantity.toString() );
+ // Confirm the quantity stuck before committing, so the line item is never
+ // added with a stale/empty value.
+ await expect( quantityField ).toHaveValue( quantity.toString() );
+
await page.locator( '#btn-ok' ).click();
+
+ // Adding the product fires an AJAX request that inserts the line item and
+ // recalculates the order totals. Wait for the item row to render before
+ // returning; otherwise a subsequent "Create"/save can persist the order
+ // before the line item is fully applied, saving a 0-quantity / $0 line
+ // (observed intermittently under parallel load).
+ await expect(
+ page.locator( 'td.name > a' ).filter( { hasText: product.name } )
+ ).toBeVisible();
}
const test = baseTest.extend( {