2019-09-20 14:28:14 +00:00
|
|
|
/**
|
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { switchUserToTest } from '@wordpress/e2e-test-utils';
|
2019-11-21 16:52:29 +00:00
|
|
|
import { CustomerFlow } from "../../utils/flows";
|
2019-09-20 14:28:14 +00:00
|
|
|
|
|
|
|
describe( 'My account page', () => {
|
|
|
|
it( 'allows customer to login', async () => {
|
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' } );
|
|
|
|
} );
|
|
|
|
} );
|