2 * Logs into Drupal as the given user.
4 * @param {object} settings
6 * @param {string} settings.name
8 * @param {string} settings.password
10 * @param {array} [settings.permissions=[]]
11 * The list of permissions granted for the user.
12 * @param {function} callback
13 * A callback which will be called, when the creating the use is finished.
15 * The drupalCreateUser command.
17 exports.command = function drupalCreateUser(
18 { name, password, permissions = [] },
24 this.perform((client, done) => {
26 client.drupalCreateRole({ permissions, name: null }, newRole => {
33 }).drupalLoginAsAdmin(() => {
34 this.drupalRelativeURL('/admin/people/create')
35 .setValue('input[name="name"]', name)
36 .setValue('input[name="pass[pass1]"]', password)
37 .setValue('input[name="pass[pass2]"]', password)
38 .perform((client, done) => {
40 client.click(`input[name="roles[${role}]`, () => {
47 .submitForm('#user-register-form')
50 'Created a new user account',
51 `User "${name}" was created succesfully.`,
55 if (typeof callback === 'function') {