
| Current Path : /var/www/html/ift/web/core/tests/Drupal/Nightwatch/Commands/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/ift/web/core/tests/Drupal/Nightwatch/Commands/drupalLogin.js |
/**
* Logs into Drupal as the given user.
*
* @param {string} name
* The user name.
* @param {string} password
* The user password.
* @return {object}
* The drupalUserIsLoggedIn command.
*/
exports.command = function drupalLogin({ name, password }) {
this.drupalUserIsLoggedIn(sessionExists => {
// Log the current user out if necessary.
if (sessionExists) {
this.drupalLogout();
}
// Log in with the given credentials.
this.drupalRelativeURL('/user/login')
.setValue('input[name="name"]', name)
.setValue('input[name="pass"]', password)
.submitForm('#user-login-form');
// Assert that a user is logged in.
this.drupalUserIsLoggedIn(sessionExists => {
this.assert.equal(
sessionExists,
true,
`The user "${name}" was logged in.`,
);
});
});
return this;
};