diff --git a/packages/js/e2e-core-tests/specs/merchant/wp-admin-settings-shipping-zones.test.js b/packages/js/e2e-core-tests/specs/merchant/wp-admin-settings-shipping-zones.test.js index bbd0ee0f366..ec59ac1df15 100644 --- a/packages/js/e2e-core-tests/specs/merchant/wp-admin-settings-shipping-zones.test.js +++ b/packages/js/e2e-core-tests/specs/merchant/wp-admin-settings-shipping-zones.test.js @@ -40,7 +40,7 @@ const runAddNewShippingZoneTest = () => { }); afterAll( async () => { - shopper.logout(); + await shopper.logout(); } ); it('add shipping zone for San Francisco with free Local pickup', async () => { diff --git a/packages/js/e2e-core-tests/specs/shopper/front-end-checkout-login-account.test.js b/packages/js/e2e-core-tests/specs/shopper/front-end-checkout-login-account.test.js index 608bb75e355..b81d115cd36 100644 --- a/packages/js/e2e-core-tests/specs/shopper/front-end-checkout-login-account.test.js +++ b/packages/js/e2e-core-tests/specs/shopper/front-end-checkout-login-account.test.js @@ -42,6 +42,10 @@ const runCheckoutLoginAccountTest = () => { await shopper.goToCheckout(); }); + afterAll( async () => { + await shopper.logout(); + } ); + it('can login to an existing account during checkout', async () => { // Click to login during checkout await page.waitForSelector('.woocommerce-form-login-toggle'); @@ -65,8 +69,11 @@ const runCheckoutLoginAccountTest = () => { // Verify the user is logged in on my account page await shopper.gotoMyAccount(); - await expect(page.url()).toMatch('my-account/'); - await expect(page).toMatchElement('h1', {text: 'My account'}); + + await Promise.all( [ + await expect(page.url()).toMatch('my-account/'), + await expect(page).toMatchElement('h1', {text: 'My account'}), + ] ); }); }); }; diff --git a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-create-account.test.js b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-create-account.test.js index b4f09282808..77bc4ec92fa 100644 --- a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-create-account.test.js +++ b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-create-account.test.js @@ -26,7 +26,7 @@ const runMyAccountCreateAccountTest = () => { }); afterAll( async () => { - shopper.logout(); + await shopper.logout(); } ); it('can create a new account via my account', async () => { diff --git a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-pay-order.test.js b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-pay-order.test.js index 6416ba43951..4b6e9ca6609 100644 --- a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-pay-order.test.js +++ b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account-pay-order.test.js @@ -35,7 +35,7 @@ const runMyAccountPayOrderTest = () => { }); afterAll( async () => { - shopper.logout(); + await shopper.logout(); } ); it('allows customer to pay for their order in My Account', async () => { diff --git a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account.test.js b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account.test.js index 277337b3a39..3073d867976 100644 --- a/packages/js/e2e-core-tests/specs/shopper/front-end-my-account.test.js +++ b/packages/js/e2e-core-tests/specs/shopper/front-end-my-account.test.js @@ -16,7 +16,7 @@ const pages = [ const runMyAccountPageTest = () => { describe('My account page', () => { afterAll( async () => { - shopper.logout(); + await shopper.logout(); } ); it('allows customer to login', async () => { diff --git a/packages/js/e2e-core-tests/specs/shopper/front-end-order-email-receiving.test.js b/packages/js/e2e-core-tests/specs/shopper/front-end-order-email-receiving.test.js index f451a640d3b..45961523c36 100644 --- a/packages/js/e2e-core-tests/specs/shopper/front-end-order-email-receiving.test.js +++ b/packages/js/e2e-core-tests/specs/shopper/front-end-order-email-receiving.test.js @@ -37,7 +37,7 @@ const runOrderEmailReceivingTest = () => { }); afterAll( async () => { - shopper.logout(); + await shopper.logout(); } ); it('should receive order email after purchasing an item', async () => { diff --git a/packages/js/e2e-environment/CHANGELOG.md b/packages/js/e2e-environment/CHANGELOG.md index 091ce2028fc..781c66330cb 100644 --- a/packages/js/e2e-environment/CHANGELOG.md +++ b/packages/js/e2e-environment/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +## Added + +- Added `await` for every call to `shopper.logout` + ## Fixed - Updated the browserViewport in `jest.setup.js` to match the `defaultViewport` dimensions defined in `jest-puppeteer.config.js` diff --git a/packages/js/e2e-utils/CHANGELOG.md b/packages/js/e2e-utils/CHANGELOG.md index 2306f34425d..c40bb45e486 100644 --- a/packages/js/e2e-utils/CHANGELOG.md +++ b/packages/js/e2e-utils/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +## Changes + +- Removed `page.waitForNavigation()` from `shopper.logout()` + ## Added - `utils.waitForTimeout( delay )` pause processing for `delay` milliseconds diff --git a/packages/js/e2e-utils/src/flows/shopper.js b/packages/js/e2e-utils/src/flows/shopper.js index d172eb32d08..3f9e2cb43ff 100644 --- a/packages/js/e2e-utils/src/flows/shopper.js +++ b/packages/js/e2e-utils/src/flows/shopper.js @@ -240,7 +240,6 @@ const shopper = { await expect( page.title() ).resolves.toMatch( 'My account' ); await page.click( '.woocommerce-MyAccount-navigation-link--customer-logout a' ); - await page.waitForNavigation( { waitUntil: 'networkidle0' } ); }, };