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

Commit

Permalink
Fix checkout coupon tests in checkout
Browse files Browse the repository at this point in the history
They have been written for logged in user
  • Loading branch information
ralucaStan committed Apr 12, 2022
1 parent ab09021 commit 56a92e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/e2e/specs/shopper/cart-checkout/checkout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,15 @@ describe( 'Shopper → Checkout', () => {
describe( 'Coupons', () => {
beforeAll( async () => {
coupon = await createCoupon( { usageLimit: 1 } );
await merchant.login();
} );

afterAll( async () => {
await withRestApi.deleteCoupon( coupon.id );
await merchant.logout();
} );

it( 'User can apply single-use coupon once', async () => {
it( 'Logged in user can apply single-use coupon and place order', async () => {
await shopper.goToShop();
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
await shopper.block.goToCheckout();
Expand All @@ -272,7 +274,6 @@ describe( 'Shopper → Checkout', () => {
text: coupon.code,
}
);

await shopper.block.placeOrder();
await expect( page ).toMatch( 'Your order has been received.' );

Expand All @@ -286,7 +287,7 @@ describe( 'Shopper → Checkout', () => {
);
} );

it( 'User cannot apply single-use coupon twice', async () => {
it( 'Logged in user cannot apply single-use coupon twice', async () => {
await shopper.goToShop();
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
await shopper.block.goToCheckout();
Expand Down

0 comments on commit 56a92e6

Please sign in to comment.