Commit d9624c3aca0 for woocommerce
commit d9624c3aca00c846222cf257ead31215d1a32054
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Mon Aug 3 16:19:46 2026 +0300
e2e tests: Fix swallowed REST API errors in the order emails spec (#67338)
diff --git a/plugins/woocommerce/changelog/testops-256-order-emails-error-propagation b/plugins/woocommerce/changelog/testops-256-order-emails-error-propagation
new file mode 100644
index 00000000000..e6fe695e19f
--- /dev/null
+++ b/plugins/woocommerce/changelog/testops-256-order-emails-error-propagation
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Propagate REST API errors in the order emails e2e spec instead of swallowing them; test-only, no changes to shipped code.
diff --git a/plugins/woocommerce/tests/e2e/tests/email/order-emails.spec.ts b/plugins/woocommerce/tests/e2e/tests/email/order-emails.spec.ts
index 1008097d2d5..9f0cacdac63 100644
--- a/plugins/woocommerce/tests/e2e/tests/email/order-emails.spec.ts
+++ b/plugins/woocommerce/tests/e2e/tests/email/order-emails.spec.ts
@@ -17,19 +17,10 @@ import { setFeatureEmailImprovementsFlag } from './helpers/set-email-improvement
const test = baseTest.extend( {
storageState: ADMIN_STATE_PATH,
order: async ( { restApi }, use ) => {
- let order;
-
- await restApi
- .post( `${ WC_API_PATH }/orders`, {
- status: 'processing',
- billing: { email: faker.internet.exampleEmail() },
- } )
- .then( ( response ) => {
- order = response.data;
- } )
- .catch( ( error ) => {
- console.error( error );
- } );
+ const { data: order } = await restApi.post( `${ WC_API_PATH }/orders`, {
+ status: 'processing',
+ billing: { email: faker.internet.exampleEmail() },
+ } );
await use( order );
@@ -79,31 +70,19 @@ test.beforeEach( async ( { baseURL } ) => {
subject.replace( 'ORDER_ID', `${ order.id }` )
);
- await restApi
- .put( `${ WC_API_PATH }/orders/${ order.id }`, {
- status,
- } )
- .catch( ( error ) => {
- console.error( error );
- } );
-
- let orderStatus;
- await restApi
- .get( `${ WC_API_PATH }/orders/${ order.id }` )
- .then( ( response ) => {
- orderStatus = response.data.status;
- } );
+ const { data: updatedOrder } = await restApi.put(
+ `${ WC_API_PATH }/orders/${ order.id }`,
+ { status }
+ );
- await expect( orderStatus ).toEqual( status );
+ expect( updatedOrder.status ).toEqual( status );
- let emailRow;
- await test.step( 'check the email exists', async () => {
- emailRow = await expectEmail(
+ const emailRow = await test.step( 'check the email exists', () =>
+ expectEmail(
page,
role === 'customer' ? order.billing.email : admin.email,
subjectRegex
- );
- } );
+ ) );
await test.step( 'check the email content', async () => {
await emailRow.getByRole( 'button', { name: 'View log' } ).click();