41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
|
/**
|
||
|
* Internal dependencies
|
||
|
*/
|
||
|
import { shopper } from '../../../utils';
|
||
|
import { SIMPLE_PRODUCT_NAME } from '../../../utils/constants';
|
||
|
|
||
|
const block = {
|
||
|
name: 'Cart',
|
||
|
};
|
||
|
|
||
|
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
|
||
|
// eslint-disable-next-line jest/no-focused-tests
|
||
|
test.only( `skipping ${ block.name } tests`, () => {} );
|
||
|
|
||
|
describe( 'Shopper → Cart → Can proceed to checkout', () => {
|
||
|
beforeAll( async () => {
|
||
|
await shopper.block.emptyCart();
|
||
|
} );
|
||
|
|
||
|
afterAll( async () => {
|
||
|
await shopper.block.emptyCart();
|
||
|
} );
|
||
|
|
||
|
it( 'allows customer to proceed to checkout', async () => {
|
||
|
await shopper.goToShop();
|
||
|
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
||
|
await shopper.block.goToCart();
|
||
|
|
||
|
// Click on "Proceed to Checkout" button
|
||
|
await Promise.all( [
|
||
|
expect( page ).toClick( 'a.wc-block-cart__submit-button', {
|
||
|
text: 'Proceed to Checkout',
|
||
|
} ),
|
||
|
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
||
|
] );
|
||
|
|
||
|
// Verify that you see the Checkout Block page
|
||
|
await expect( page ).toMatchElement( 'h1', { text: 'Checkout' } );
|
||
|
} );
|
||
|
} );
|