From 937ec06900de2144a4d29021074a64484aa2f962 Mon Sep 17 00:00:00 2001 From: Julia Amosova Date: Wed, 6 Nov 2019 16:32:11 +0000 Subject: [PATCH] Refactor clicking on different menu tabs of My Account page --- .../specs/front-end/my-account.test.js | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/e2e-tests/specs/front-end/my-account.test.js b/tests/e2e-tests/specs/front-end/my-account.test.js index 48809b2c8e4..fb3058f07fe 100644 --- a/tests/e2e-tests/specs/front-end/my-account.test.js +++ b/tests/e2e-tests/specs/front-end/my-account.test.js @@ -23,40 +23,32 @@ describe( 'My account page', () => { } ); it( 'allows customer to see orders', async () => { - await Promise.all( [ - page.waitForNavigation( { waitUntil: 'networkidle0' } ), - expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Orders' } ), - ] ); + expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Orders' } ); + await page.waitForNavigation( { waitUntil: 'networkidle0' } ); expect( page.url() ).toMatch( '/my-account/orders' ); await expect( page ).toMatchElement( 'h1', { text: 'Orders' } ); } ); it( 'allows customer to see downloads', async () => { - await Promise.all( [ - page.waitForNavigation( { waitUntil: 'networkidle0' } ), - expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Downloads' } ), - ] ); + expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Downloads' } ) + await page.waitForNavigation( { waitUntil: 'networkidle0' } ); expect( page.url() ).toMatch( '/my-account/downloads' ); await expect( page ).toMatchElement( 'h1', { text: 'Downloads' } ); } ); - it( 'allows customer to edit addresses', async () => { - await Promise.all( [ - page.waitForNavigation( { waitUntil: 'networkidle0' } ), - expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Addresses' } ), - ] ); + it( 'allows customer to see addresses', async () => { + expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Addresses' } ); + await page.waitForNavigation( { waitUntil: 'networkidle0' } ); expect( page.url() ).toMatch( '/my-account/edit-address' ); await expect( page ).toMatchElement( 'h1', { text: 'Addresses' } ); } ); - it( 'allows customer to edit account details', async () => { - await Promise.all( [ - page.waitForNavigation( { waitUntil: 'networkidle0' } ), - expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Account details' } ), - ] ); + it( 'allows customer to see account details', async () => { + expect( page ).toClick( '.woocommerce-MyAccount-navigation-link', { text: 'Account details' } ); + await page.waitForNavigation( { waitUntil: 'networkidle0' } ); expect( page.url() ).toMatch( '/my-account/edit-account' ); await expect( page ).toMatchElement( 'h1', { text: 'Account details' } );