diff --git a/plugins/woocommerce/changelog/e2e-add-order-notes b/plugins/woocommerce/changelog/e2e-add-order-notes new file mode 100644 index 00000000000..f9ce55740a9 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-add-order-notes @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Add e2e test for order notes diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/order-edit.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/order-edit.spec.js index ed6c13e500b..444ed14c393 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/order-edit.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/order-edit.spec.js @@ -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;