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