From 07c6075dde5a1a0d3b09ba464d4540ba3030840c Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Fri, 15 May 2020 16:58:50 -0300 Subject: [PATCH] use nonced logout link for store owner logout --- tests/e2e/utils/flows.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/e2e/utils/flows.js b/tests/e2e/utils/flows.js index 50ea2716937..cb72820abb3 100644 --- a/tests/e2e/utils/flows.js +++ b/tests/e2e/utils/flows.js @@ -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 () => {