This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert checkout place order E2E tests to Playwright
- Loading branch information
1 parent
911056a
commit 9243cbd
Showing
3 changed files
with
48 additions
and
25 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
tests/e2e/tests/checkout/checkout-block-place-order.block_theme.side_effects.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,47 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { test as base, expect } from '@woocommerce/e2e-playwright-utils'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { CheckoutPage } from './checkout.page'; | ||
import { SIMPLE_VIRTUAL_PRODUCT_NAME } from './constants'; | ||
|
||
const test = base.extend< { pageObject: CheckoutPage } >( { | ||
pageObject: async ( { page }, use ) => { | ||
const pageObject = new CheckoutPage( { | ||
page, | ||
} ); | ||
await use( pageObject ); | ||
}, | ||
} ); | ||
|
||
test.describe( 'Shopper → Checkout block → Place Order', () => { | ||
test.beforeEach( async ( { frontendUtils } ) => { | ||
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( | ||
page.getByText( 'Your order has been received.' ) | ||
).toBeVisible(); | ||
} ); | ||
|
||
test( 'Logged in user can place an order', async ( { | ||
pageObject, | ||
page, | ||
} ) => { | ||
await pageObject.fillInCheckoutWithTestData(); | ||
await pageObject.placeOrder(); | ||
await expect( | ||
page.getByText( 'Your order has been 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const SIMPLE_VIRTUAL_PRODUCT_NAME = 'Album'; |