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

Commit

Permalink
Complete the place order test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tarhi-saad committed Aug 15, 2023
1 parent b057fa7 commit ac7574c
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ const test = base.extend< { pageObject: CheckoutPage } >( {
} );

test.describe( 'Shopper → Checkout block → Place Order', () => {
test.beforeEach( async ( { frontendUtils } ) => {
test( 'Guest user can place order', async ( {
pageObject,
frontendUtils,
page,
} ) => {
// We want to logout if we are logged in.
// eslint-disable-next-line playwright/no-conditional-in-test
if ( await frontendUtils.isLoggedIn() ) {
await frontendUtils.logout();
}

await frontendUtils.emptyCart();
await frontendUtils.goToShop();
await frontendUtils.addToCart( SIMPLE_VIRTUAL_PRODUCT_NAME );
await frontendUtils.goToCheckout();
} );

test( 'Guest user can place order', async ( { pageObject, page } ) => {
await pageObject.fillInCheckoutWithTestData();
await pageObject.placeOrder();
await expect(
Expand All @@ -36,8 +43,14 @@ test.describe( 'Shopper → Checkout block → Place Order', () => {

test( 'Logged in user can place an order', async ( {
pageObject,
frontendUtils,
page,
} ) => {
await frontendUtils.login();
await frontendUtils.emptyCart();
await frontendUtils.goToShop();
await frontendUtils.addToCart( SIMPLE_VIRTUAL_PRODUCT_NAME );
await frontendUtils.goToCheckout();
await pageObject.fillInCheckoutWithTestData();
await pageObject.placeOrder();
await expect(
Expand Down

0 comments on commit ac7574c

Please sign in to comment.