@wordpress/e2e-test-utils
Version:
End-To-End (E2E) test utils for WordPress.
20 lines (19 loc) • 601 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCurrentUser = getCurrentUser;
/**
* Get the username of the user that's currently logged into WordPress (if any).
*
* @return {?string} username The user that's currently logged into WordPress (if any).
*/
async function getCurrentUser() {
const cookies = await page.cookies();
const cookie = cookies.find(c => !!c?.name?.startsWith('wordpress_logged_in_'));
if (!cookie?.value) {
return;
}
return decodeURIComponent(cookie.value).split('|')[0];
}
//# sourceMappingURL=get-current-user.js.map