public function GenpassTest::testGenpassConfigsAndCreateUsersByAdmin in Generate Password 8
Test Generate Password configs and create users by admin.
File
- tests/
src/ FunctionalJavascript/ GenpassTest.php, line 63  
Class
- GenpassTest
 - Tests Generate Password .
 
Namespace
Drupal\Tests\genpass\FunctionalJavascriptCode
public function testGenpassConfigsAndCreateUsersByAdmin() {
  // Configure Account settings with Generate Password options.
  $this
    ->drupalGet('admin/config/people/accounts');
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Account settings'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Password handling'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Generated password length'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Password generation algorithm'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Generated password display'));
  $this
    ->getSession()
    ->getPage()
    ->selectFieldOption('genpass_mode', '2');
  $this
    ->getSession()
    ->getPage()
    ->pressButton($this
    ->t('Save configuration'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('The configuration options have been saved.'));
  // Create the test_authenticated user.
  $this
    ->drupalGet('admin/people/create');
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Add user'));
  $this
    ->getSession()
    ->getPage()
    ->fillField('mail', 'authenticated.test@drupal.org');
  $this
    ->getSession()
    ->getPage()
    ->fillField('Username', 'test_authenticated');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Create new account');
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Since you did not provide a password, it was generated automatically for this account.'));
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Created a new user account for test_authenticated. No email has been sent.'));
}