function UserLoginTest::testAutocompleteHtmlAttributes

Same name and namespace in other branches
  1. 10 core/modules/user/tests/src/Functional/UserLoginTest.php \Drupal\Tests\user\Functional\UserLoginTest::testAutocompleteHtmlAttributes()

Tests that user login form has the autocomplete attributes.

File

core/modules/user/tests/src/Functional/UserLoginTest.php, line 351

Class

UserLoginTest
Ensure that login works as expected.

Namespace

Drupal\Tests\user\Functional

Code

public function testAutocompleteHtmlAttributes() : void {
    $this->drupalGet('user/login');
    $name_field = $this->getSession()
        ->getPage()
        ->findField('name');
    $pass_field = $this->getSession()
        ->getPage()
        ->findField('pass');
    $this->assertEquals('username', $name_field->getAttribute('autocomplete'));
    $this->assertEquals('current-password', $pass_field->getAttribute('autocomplete'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.