diff --git a/plugins/woocommerce/changelog/e2e-select-payment-method b/plugins/woocommerce/changelog/e2e-select-payment-method new file mode 100644 index 00000000000..707dc1092c9 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-select-payment-method @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Explicitly select the payment method on the customer payment page e2e test diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/customer-payment-page.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/customer-payment-page.spec.js index db105a99a48..652d819edd2 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/customer-payment-page.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/customer-payment-page.spec.js @@ -100,25 +100,33 @@ test.describe( test( 'can pay for the order through the customer payment page', async ( { page, } ) => { - // key required, so can't go directly to the customer payment page - await page.goto( - `wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }` - ); - await page.locator( 'label[for=order_status] > a' ).click(); - - // pay for the order - await page.locator( 'button#place_order' ).click(); - - // Verify we landed on the order received page - await expect( - page.getByText( 'Your order has been received' ) - ).toBeVisible(); - await expect( - page.getByText( `Order #: ${ orderId }` ) - ).toBeVisible(); - await expect( - await page.getByText( `Total: $${ productPrice }` ).count() - ).toBeGreaterThan( 0 ); + await test.step( 'Load the customer payment page', async () => { + // key required, so can't go directly to the customer payment page + await page.goto( + `wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }` + ); + await page.locator( 'label[for=order_status] > a' ).click(); + } ); + await test.step( 'Select payment method and pay for the order', async () => { + // explicitly select the payment method + await page.getByText( 'Direct bank transfer' ).click(); + // pay for the order + await page + .getByRole( 'button', { name: 'Pay for order' } ) + .click(); + } ); + await test.step( 'Verify the order received page', async () => { + // Verify we landed on the order received page + await expect( + page.getByText( 'Your order has been received' ) + ).toBeVisible(); + await expect( + page.getByText( `Order #: ${ orderId }` ) + ).toBeVisible(); + await expect( + await page.getByText( `Total: $${ productPrice }` ).count() + ).toBeGreaterThan( 0 ); + } ); } ); } );