Add test to add and remove order notes. (#40317)

* Add test to add and remove order notes.

* Changelog

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
Jonathan Lane 2023-10-18 08:37:02 -07:00 committed by GitHub
parent 51c9b9051e
commit 8e5223b383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Add e2e test for order notes

View File

@ -120,6 +120,40 @@ test.describe( 'Edit order', () => {
);
} );
test( 'can add and delete order notes', async ( { page } ) => {
// open order we created
await page.goto( `wp-admin/post.php?post=${ orderId }&action=edit` );
await page.on( 'dialog', dialog => dialog.accept() );
// add an order note
await page.getByLabel( 'Add note' ).fill( 'This order is a test order. It is only a test. This note is a private note.' );
await page.getByRole( 'button', { name: 'Add', exact: true } ).click();
// verify the note saved
await expect( page.getByText( 'This order is a test order. It is only a test. This note is a private note.' ) ).toBeVisible();
// delete the note
await page.getByRole( 'button', { name: 'Delete note' } ).first().click();
// verify the note is gone
await expect( page.getByText( 'This order is a test order. It is only a test. This note is a private note.' ) ).not.toBeVisible();
// add note to customer
// add an order note
await page.getByLabel( 'Add note' ).fill( 'This order is a test order. It is only a test. This note is a note to the customer.' );
await page.getByLabel('Note type').selectOption( 'Note to customer' );
await page.getByRole( 'button', { name: 'Add', exact: true } ).click();
// verify the note saved
await expect( page.getByText( 'This order is a test order. It is only a test. This note is a note to the customer.' ) ).toBeVisible();
// delete the note
await page.getByRole( 'button', { name: 'Delete note' } ).first().click();
// verify the note is gone
await expect( page.getByText( 'This order is a test order. It is only a test. This note is a private note.' ) ).not.toBeVisible();
} );
test( 'can load billing details', async ( { page, baseURL } ) => {
let customerId = 0;