Add store owner login in the cart page test

This commit is contained in:
Julia Amosova 2019-12-02 17:54:45 +00:00
parent 3ffaaea6f5
commit f4afae89c6
3 changed files with 19 additions and 19 deletions

View File

@ -29,7 +29,7 @@ describe( 'Store owner can login and make sure WooCommerce is activated', () =>
}
await page.click( `tr[data-slug="${ slug }"] .activate a` );
await page.waitForSelector( `tr[data-slug="${ slug }"] .deactivate a` );
});
} );
} );
@ -68,13 +68,13 @@ describe( 'Store owner can go through store Setup Wizard', () => {
// Verify that checkbox next to "Enable usage tracking and help improve WooCommerce" is not selected
await verifyCheckboxIsUnset('#wc_tracker_checkbox_dialog');
await Promise.all([
await Promise.all( [
// Click on "Continue" button to move to the next step
page.$eval( '#wc_tracker_submit', elem => elem.click() ),
// Wait for the Payment section to load
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
]);
]) ;
} );
it( 'Can fill out Payment details', async () => {
@ -108,7 +108,7 @@ describe( 'Store owner can go through store Setup Wizard', () => {
let event = new Event( 'change', { bubbles: true } );
event.simulated=true;
element.dispatchEvent( event );
});
} );
// Select product weight and product dimensions options
await expect( page ).toSelect( 'select[name="weight_unit"]', 'Pounds' );
@ -152,7 +152,7 @@ describe( 'Store owner can go through store Setup Wizard', () => {
describe( 'Store owner can finish initial store setup', () => {
it('Can enable tax rates and calculations', async () => {
it( 'Can enable tax rates and calculations', async () => {
// Go to general settings page
await StoreOwnerFlow.openSettings( 'general' );
@ -169,9 +169,9 @@ describe( 'Store owner can finish initial store setup', () => {
expect( page ).toMatchElement( '#message', { text: 'Your settings have been saved.' } ),
verifyCheckboxIsSet( '#woocommerce_calc_taxes' ),
] );
});
} );
it('Can configure permalink settings', async () => {
it( 'Can configure permalink settings', async () => {
// Go to Permalink Settings page
await StoreOwnerFlow.openPermalinkSettings();
@ -192,6 +192,6 @@ describe( 'Store owner can finish initial store setup', () => {
verifyValueOfInputField( '#permalink_structure', '/%postname%/' ),
verifyValueOfInputField( '#woocommerce_permalink_structure', '/product/' ),
] );
});
} );
} );

View File

@ -2,11 +2,6 @@
* @format
*/
/**
* External dependencies
*/
import { activatePlugin } from '@wordpress/e2e-test-utils';
/**
* Internal dependencies
*/
@ -16,7 +11,7 @@ import { uiUnblocked } from '../../utils';
describe( 'Cart page', () => {
beforeAll( async () => {
await activatePlugin( 'woocommerce' );
await StoreOwnerFlow.login();
await createSimpleProduct();
await StoreOwnerFlow.logout();
} );
@ -26,7 +21,7 @@ describe( 'Cart page', () => {
await expect( page ).toMatchElement( '.cart-empty', { text: 'Your cart is currently empty.' } );
} );
it( 'should adds the product to the cart when "Add to cart" is clicked', async () => {
it( 'should add the product to the cart when "Add to cart" is clicked', async () => {
await CustomerFlow.goToShop();
await CustomerFlow.addToCartFromShopPage( 'Simple product' );
@ -34,7 +29,7 @@ describe( 'Cart page', () => {
await CustomerFlow.productIsInCart( 'Simple product' );
} );
it( 'should increases item qty when "Add to cart" of the same product is clicked', async () => {
it( 'should increase item qty when "Add to cart" of the same product is clicked', async () => {
await CustomerFlow.goToShop();
await CustomerFlow.addToCartFromShopPage( 'Simple product' );
@ -42,7 +37,7 @@ describe( 'Cart page', () => {
await CustomerFlow.productIsInCart( 'Simple product', 2 );
} );
it( 'should updates qty when updated via qty input', async () => {
it( 'should update qty when updated via qty input', async () => {
await CustomerFlow.goToCart();
await CustomerFlow.setCartQuantity( 'Simple product', 4 );
await expect( page ).toClick( 'button', { text: 'Update cart' } );

View File

@ -2,6 +2,11 @@
* @format
*/
/**
* External dependencies
*/
import { pressKeyWithModifier } from '@wordpress/e2e-test-utils';
/**
* Internal dependencies
*/
@ -20,9 +25,9 @@ const WP_ADMIN_NEW_PRODUCT = baseUrl + 'wp-admin/post-new.php?post_type=product'
const WP_ADMIN_WC_SETTINGS = baseUrl + 'wp-admin/admin.php?page=wc-settings&tab=';
const WP_ADMIN_PERMALINK_SETTINGS = baseUrl + 'wp-admin/options-permalink.php';
const SHOP_PAGE = baseUrl + '/shop/';
const SHOP_PAGE = baseUrl + 'shop';
const SHOP_PRODUCT = baseUrl + '?p=';
const SHOP_CART_PAGE = baseUrl + 'cart/';
const SHOP_CART_PAGE = baseUrl + 'cart';
const getProductColumnExpression = ( productTitle ) => (
'td[@class="product-name" and ' +