Skip to content

Commit a752185

Browse files
authored
Merge branch 'develop' into session-test
2 parents 9d5469e + 544cfdd commit a752185

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/JoomlaBrowser.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,4 +1226,52 @@ public function createCategory($title, $extension = '')
12261226
$this->see('Category saved', '#system-message-container');
12271227
$this->checkForPhpNoticesOrWarnings();
12281228
}
1229+
1230+
/**
1231+
* Create a user in the administrator site
1232+
*
1233+
* @param string $name Name
1234+
* @param string $username User name (login)
1235+
* @param string $password Password
1236+
* @param string $email Email
1237+
* @param string $userGroup Group id to attach to the user
1238+
*
1239+
* @return void
1240+
*
1241+
* @since 3.8.11
1242+
* @throws \Exception
1243+
*/
1244+
public function createUser($name, $username, $password, $email, $userGroup = 'Super Users')
1245+
{
1246+
$this->debug('User creation');
1247+
$this->doAdministratorLogin();
1248+
1249+
$this->amOnPage('administrator/index.php?option=com_users');
1250+
1251+
$this->waitForElement(array('class' => 'page-title'));
1252+
$this->checkForPhpNoticesOrWarnings();
1253+
1254+
$this->debug('Click new user button');
1255+
$this->click($this->locator->adminToolbarButtonNew);
1256+
1257+
$this->checkForPhpNoticesOrWarnings();
1258+
$this->debug('I fill up the new user information');
1259+
$this->fillField(array('id' => 'jform_name'), $name);
1260+
$this->fillField(array('id' => 'jform_username'), $username);
1261+
$this->fillField(array('id' => 'jform_password'), $password);
1262+
$this->fillField(array('id' => 'jform_password2'), $password);
1263+
$this->fillField(array('id' => 'jform_email'), $email);
1264+
1265+
$this->debug('I open the Assigned User Groups Tab and assign the user group');
1266+
$this->click(array('link' => 'Assigned User Groups'));
1267+
$this->click(array('xpath' => "//label[contains(text()[normalize-space()], '$userGroup')]"));
1268+
1269+
$this->debug('Click new user apply button');
1270+
$this->click($this->locator->adminToolbarButtonApply);
1271+
1272+
$this->debug('see a success message after saving the user');
1273+
1274+
$this->see('User saved', '#system-message-container');
1275+
$this->checkForPhpNoticesOrWarnings();
1276+
}
12291277
}

0 commit comments

Comments
 (0)