-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert shopper applies coupon on cart E2E tests to Playwright (#10178)
- Loading branch information
Showing
4 changed files
with
81 additions
and
82 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/dev-10062-playwright-migration-shopper-checkout-free
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: dev | ||
|
||
Convert shopper free coupon checkout E2E test to Playwright |
75 changes: 75 additions & 0 deletions
75
tests/e2e-pw/specs/shopper/shopper-checkout-cart-coupon.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import test, { expect } from '@playwright/test'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { config } from '../../config/default'; | ||
import { | ||
goToCart, | ||
goToCheckout, | ||
goToShop, | ||
} from '../../utils/shopper-navigation'; | ||
import { useShopper } from '../../utils/helpers'; | ||
import { | ||
addToCartFromShopPage, | ||
emptyCart, | ||
fillBillingAddress, | ||
fillCardDetails, | ||
placeOrder, | ||
setupCheckout, | ||
} from '../../utils/shopper'; | ||
|
||
const productName = config.products.simple.name; | ||
|
||
test.describe( | ||
'Checkout with free coupon & after modifying cart on Checkout page', | ||
() => { | ||
// All tests will use the shopper only. | ||
useShopper(); | ||
|
||
test.beforeEach( async ( { page } ) => { | ||
await goToShop( page ); | ||
await addToCartFromShopPage( page, productName ); | ||
await goToCart( page ); | ||
await page.getByPlaceholder( 'Coupon code' ).fill( 'free' ); | ||
await page.getByRole( 'button', { name: 'Apply coupon' } ).click(); | ||
} ); | ||
|
||
test.afterEach( async ( { page } ) => { | ||
await emptyCart( page ); | ||
} ); | ||
|
||
test( 'Checkout with a free coupon', async ( { page } ) => { | ||
await goToCheckout( page ); | ||
await fillBillingAddress( page, config.addresses.customer.billing ); | ||
await placeOrder( page ); | ||
await page.waitForURL( /\/order-received\//, { | ||
waitUntil: 'load', | ||
} ); | ||
await expect( | ||
page.getByRole( 'heading', { | ||
name: 'Order received', | ||
} ) | ||
).toBeVisible(); | ||
} ); | ||
|
||
test( 'Remove free coupon, then checkout', async ( { page } ) => { | ||
await goToCheckout( page ); | ||
await page.getByRole( 'link', { name: '[Remove]' } ).click(); | ||
await setupCheckout( page, config.addresses.customer.billing ); | ||
await fillCardDetails( page, config.cards.basic ); | ||
await placeOrder( page ); | ||
await page.waitForURL( /\/order-received\//, { | ||
waitUntil: 'load', | ||
} ); | ||
await expect( | ||
page.getByRole( 'heading', { | ||
name: 'Order received', | ||
} ) | ||
).toBeVisible(); | ||
} ); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
tests/e2e/specs/wcpay/shopper/shopper-checkout-free-cart.spec.js
This file was deleted.
Oops, something went wrong.