Skip to content

Commit

Permalink
Update checks on place order button for WC blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoumpierre committed Feb 6, 2025
1 parent e40174b commit 069eca1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ describeif( shouldRunWCBlocksTests )(
await shopper.placeOrderWCB( shopperPage, false );

if ( auth ) {
const placeOrderButton = shopperPage.locator(
'.wc-block-components-checkout-place-order-button'
);
await expect( placeOrderButton ).toBeDisabled();
await expect( placeOrderButton ).toHaveClass(
/wc-block-components-button--loading/
);
await shopper.confirmCardAuthentication( shopperPage );
}

Expand Down
11 changes: 3 additions & 8 deletions tests/e2e-pw/utils/shopper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,15 @@ export const placeOrderWCB = async (
page: Page,
confirmOrderReceived = true
) => {
const placeOrderButton = page.locator(
'.wc-block-components-checkout-place-order-button'
);
const placeOrderButton = page.getByRole( 'button', {
name: 'Place Order',
} );

await placeOrderButton.focus();
await waitForUiRefresh( page );

await placeOrderButton.click();

await expect( placeOrderButton ).toBeDisabled();
await expect( placeOrderButton ).toHaveClass(
/wc-block-components-button--loading/
);

if ( confirmOrderReceived ) {
await page.waitForURL( /\/order-received\// );
await expect(
Expand Down

0 comments on commit 069eca1

Please sign in to comment.