Merge pull request #26529 from woocommerce/fix/e2e-403-errors

use nonced logout link for store owner logout
This commit is contained in:
Christopher Allford 2020-05-21 10:44:10 -07:00 committed by GitHub
commit 2953df2c5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -241,16 +241,15 @@ const StoreOwnerFlow = {
},
logout: async () => {
await page.goto(baseUrl + 'wp-login.php?action=logout', {
// 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( logoutLinks[ 0 ], {
waitUntil: 'networkidle0',
});
await expect(page).toMatch('You are attempting to log out');
await Promise.all([
page.waitForNavigation({ waitUntil: 'networkidle0' }),
page.click('a'),
]);
} );
},
openAllOrdersView: async () => {