Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add Guest user test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tarhi-saad committed Sep 17, 2023
1 parent b68bd68 commit 941a2c7
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/e2e/tests/checkout/order-confirmation.block_theme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,58 @@ test.describe( 'Shopper → Order Confirmation', () => {
await newContext.close();
await browser.close();
} );

test( 'Place order as guest user', async ( {
frontendUtils,
pageObject,
page,
} ) => {
await frontendUtils.logout();
await frontendUtils.emptyCart();
await frontendUtils.goToShop();
await frontendUtils.addToCart( SIMPLE_PHYSICAL_PRODUCT_NAME );
await frontendUtils.goToCheckout();
await expect(
await pageObject.selectAndVerifyShippingOption(
FREE_SHIPPING_NAME,
FREE_SHIPPING_PRICE
)
).toBe( true );
await pageObject.fillInCheckoutWithTestData( testData );
await pageObject.placeOrder();

// confirm details are limited
await expect(
page.getByText( 'Thank you. Your order has been received.' )
).toBeVisible();
await expect(
page.getByRole( 'listitem' ).filter( { hasText: 'Email' } )
).toBeHidden();
await expect(
page.getByRole( 'listitem' ).filter( { hasText: 'Payment method' } )
).toBeHidden();
await expect(
page.locator(
'[data-block-name="woocommerce/order-confirmation-billing-address"]'
)
).toBeHidden();
await expect(
page.locator(
'[data-block-name="woocommerce/order-confirmation-totals"]'
)
).toBeVisible();
await expect(
page.locator(
'[data-block-name="woocommerce/order-confirmation-summary"]'
)
).toBeVisible();

const { postcode, city, state, country } = testData;

await expect(
page.getByText(
`Shipping to ${ postcode }, ${ city }, ${ state }, ${ country }`
)
).toBeVisible();
} );
} );

0 comments on commit 941a2c7

Please sign in to comment.