Merge pull request #31998 from woocommerce/e2e/improve-logout

Refactor merchant logout
This commit is contained in:
Tam Mullen 2022-03-07 19:52:42 +00:00 committed by GitHub
commit aa8b7a4a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 10 deletions

View File

@ -72,17 +72,15 @@ const merchant = {
},
logout: async () => {
// Log out link in admin bar is not visible so can't be clicked directly.
const logoutLinks = await page.$$eval(
'#wp-admin-bar-logout a',
( am ) => am.filter( ( e ) => e.href ).map( ( e ) => e.href )
);
await page.goto( WP_ADMIN_LOGIN + '?action=logout', {
waitUntil: 'networkidle0',
} );
if ( logoutLinks && logoutLinks[0] ) {
await page.goto(logoutLinks[0], {
waitUntil: 'networkidle0',
});
}
// Confirm logout using XPath, which works on all languages.
const elements = await page.$x('//a[contains(@href,\'action=logout\')]')
await elements[0].click()
await page.waitForNavigation( { waitUntil: 'networkidle0' } );
},
openAllOrdersView: async () => {