2019-09-20 14:28:14 +00:00
|
|
|
/**
|
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-11-28 16:33:43 +00:00
|
|
|
* Internal dependencies
|
2019-09-20 14:28:14 +00:00
|
|
|
*/
|
2019-12-02 16:05:22 +00:00
|
|
|
import { CustomerFlow, StoreOwnerFlow } from '../../utils/flows';
|
2019-09-20 14:28:14 +00:00
|
|
|
|
|
|
|
describe( 'My account page', () => {
|
|
|
|
it( 'allows customer to login', async () => {
|
2019-12-02 16:05:22 +00:00
|
|
|
await StoreOwnerFlow.logout();
|
2019-11-28 16:33:43 +00:00
|
|
|
await CustomerFlow.login();
|
2019-10-20 21:46:35 +00:00
|
|
|
await expect( page ).toMatch( 'Hello' );
|
2019-09-20 14:28:14 +00:00
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Dashboard' } );
|
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Orders' } );
|
2019-10-20 21:46:35 +00:00
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Downloads' } );
|
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Addresses' } );
|
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Account details' } );
|
|
|
|
await expect( page ).toMatchElement( '.woocommerce-MyAccount-navigation-link', { text: 'Logout' } );
|
2019-09-20 14:28:14 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'allows customer to see orders', async () => {
|
2019-11-21 16:52:29 +00:00
|
|
|
await CustomerFlow.goToOrders();
|
2019-11-28 14:25:28 +00:00
|
|
|
await expect( page.url() ).toMatch( 'my-account/orders' );
|
2019-09-20 14:28:14 +00:00
|
|
|
await expect( page ).toMatchElement( 'h1', { text: 'Orders' } );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'allows customer to see downloads', async () => {
|
2019-11-21 16:52:29 +00:00
|
|
|
await CustomerFlow.goToDownloads();
|
2019-11-28 14:25:28 +00:00
|
|
|
expect( page.url() ).toMatch( 'my-account/downloads' );
|
2019-09-20 14:28:14 +00:00
|
|
|
await expect( page ).toMatchElement( 'h1', { text: 'Downloads' } );
|
|
|
|
} );
|
|
|
|
|
2019-11-06 16:32:11 +00:00
|
|
|
it( 'allows customer to see addresses', async () => {
|
2019-11-21 16:52:29 +00:00
|
|
|
await CustomerFlow.goToAddresses();
|
2019-11-28 14:25:28 +00:00
|
|
|
expect( page.url() ).toMatch( 'my-account/edit-address' );
|
2019-09-20 14:28:14 +00:00
|
|
|
await expect( page ).toMatchElement( 'h1', { text: 'Addresses' } );
|
|
|
|
} );
|
|
|
|
|
2019-11-06 16:32:11 +00:00
|
|
|
it( 'allows customer to see account details', async () => {
|
2019-11-21 16:52:29 +00:00
|
|
|
await CustomerFlow.goToAccountDetails();
|
2019-11-28 14:25:28 +00:00
|
|
|
expect( page.url() ).toMatch( 'my-account/edit-account' );
|
2019-09-20 14:28:14 +00:00
|
|
|
await expect( page ).toMatchElement( 'h1', { text: 'Account details' } );
|
|
|
|
} );
|
|
|
|
} );
|