Add constants for C & C pages in our E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/5938)
* Add constants for C & C pages in our E2E tests Inspired by WC E2E this will avoid going to admin to find out the links for these pages. * Select C & C pages by using the main navigation links * Fix function calls * Revert back to using constants for C & C block pages' URLs reverts 9587a0bd5efa5d97b484cd8d1bf927ff50f8e014 and bd7e2f996792d887756c0a0f4a10e6886574e77b
This commit is contained in:
parent
5a3c7be9a4
commit
e01592e736
|
@ -0,0 +1,13 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
const config = require( 'config' );
|
||||||
|
const baseUrl = config.get( 'url' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shop pages.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const SHOP_CART_BLOCK_PAGE = baseUrl + 'cart-block';
|
||||||
|
export const SHOP_CHECKOUT_BLOCK_PAGE = baseUrl + 'checkout-block';
|
|
@ -7,19 +7,21 @@ import { shopper as wcShopper } from '@woocommerce/e2e-utils';
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import { getBlockPagePermalink } from './get-block-page-permalink';
|
import { getBlockPagePermalink } from './get-block-page-permalink';
|
||||||
|
import { SHOP_CART_BLOCK_PAGE, SHOP_CHECKOUT_BLOCK_PAGE } from './constants';
|
||||||
|
|
||||||
export const shopper = {
|
export const shopper = {
|
||||||
...wcShopper,
|
...wcShopper,
|
||||||
|
|
||||||
goToCheckoutBlock: async () => {
|
goToCheckoutBlock: async () => {
|
||||||
const checkoutBlockPermalink = await getBlockPagePermalink(
|
await page.goto( SHOP_CHECKOUT_BLOCK_PAGE, {
|
||||||
`Checkout Block`
|
waitUntil: 'networkidle0',
|
||||||
);
|
} );
|
||||||
|
},
|
||||||
await page.goto( checkoutBlockPermalink, {
|
|
||||||
|
goToCartBlock: async () => {
|
||||||
|
await page.goto( SHOP_CART_BLOCK_PAGE, {
|
||||||
waitUntil: 'networkidle0',
|
waitUntil: 'networkidle0',
|
||||||
} );
|
} );
|
||||||
await expect( page ).toMatchElement( 'h1', { text: 'Checkout' } );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
productIsInCheckoutBlock: async ( productTitle, quantity, total ) => {
|
productIsInCheckoutBlock: async ( productTitle, quantity, total ) => {
|
||||||
|
|
Loading…
Reference in New Issue