@wordpress/e2e-test-utils
Version:
End-To-End (E2E) test utils for WordPress.
29 lines (27 loc) • 858 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.logout = logout;
var _createUrl = require("./create-url");
var _isCurrentUrl = require("./is-current-url");
/**
* Internal dependencies
*/
/**
* Performs log out.
*
*/
async function logout() {
// If it is logged and in a page different than the dashboard,
// move to the dashboard. Some pages may be in full-screen mode,
// so they won't have the log-out button available.
if (!(0, _isCurrentUrl.isCurrentURL)('wp-login.php') && !(0, _isCurrentUrl.isCurrentURL)('wp-admin')) {
await page.goto((0, _createUrl.createURL)('wp-admin'));
}
await Promise.all([page.hover('#wp-admin-bar-my-account'), page.waitForSelector('#wp-admin-bar-logout', {
visible: true
})]);
await page.click('#wp-admin-bar-logout');
}
//# sourceMappingURL=logout.js.map