E2e: fix order emails (#39013)

* Use latest version of WP Mail Logging

* Use batch delete operation to gracefully handle uncreated test orders

* Use stricter locator

* Add changelog
This commit is contained in:
rodelgc 2023-07-06 07:42:42 +08:00 committed by GitHub
parent ed1ace1646
commit 504b3be343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 15 deletions

View File

@ -24,7 +24,7 @@
".",
"https://downloads.wordpress.org/plugin/akismet.zip",
"https://github.com/WP-API/Basic-Auth/archive/master.zip",
"https://downloads.wordpress.org/plugin/wp-mail-logging.1.11.2.zip"
"https://downloads.wordpress.org/plugin/wp-mail-logging.zip"
],
"themes": [
"https://downloads.wordpress.org/theme/twentynineteen.zip"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update locators in `order-emails` spec, and use the latest version of WP Mail Logging.

View File

@ -54,8 +54,8 @@ test.describe( 'Merchant > Order Action emails received', () => {
consumerSecret: process.env.CONSUMER_SECRET,
version: 'wc/v3',
} );
await api.delete( `orders/${ orderId }`, { force: true } );
await api.delete( `orders/${ newOrderId }`, { force: true } );
await api.post( `orders/batch`, { delete: [ orderId, newOrderId ] } );
} );
test( 'can receive new order email', async ( { page, baseURL } ) => {
@ -104,12 +104,16 @@ test.describe( 'Merchant > Order Action emails received', () => {
customerBilling.email
) }`
);
await expect( page.locator( 'td.column-receiver' ) ).toContainText(
admin.email
);
await expect( page.locator( 'td.column-subject' ) ).toContainText(
`[${ storeName }]: New order #${ orderId }`
);
// Expect row containing the admin email and the correct subject to be listed.
await expect(
page
.getByRole( 'row' )
.filter( { hasText: admin.email } )
.filter( {
hasText: `[${ storeName }]: New order #${ orderId }`,
} )
).toBeVisible();
} );
test( 'can email invoice/order details to customer', async ( { page } ) => {
@ -127,11 +131,15 @@ test.describe( 'Merchant > Order Action emails received', () => {
customerBilling.email
) }`
);
await expect( page.locator( 'td.column-receiver' ) ).toContainText(
customerBilling.email
);
await expect( page.locator( 'td.column-subject' ) ).toContainText(
`Invoice for order #${ orderId } on ${ storeName }`
);
// Expect row containing the billing email and the correct subject to be listed.
await expect(
page
.getByRole( 'row' )
.filter( { hasText: customerBilling.email } )
.filter( {
hasText: `Invoice for order #${ orderId } on ${ storeName }`,
} )
).toBeVisible();
} );
} );