Added shopper.logout() in afterAll block

This commit is contained in:
jamelreid 2021-12-06 12:57:16 -05:00
parent 76548b872c
commit 63489fd85f
1 changed files with 9 additions and 2 deletions

View File

@ -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'}),
] );
});
});
};