3 namespace Drupal\Tests\{{ machine_name }}\FunctionalJavascript;
5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
8 * Tests the JavaScript functionality of the {{ name }} module.
10 * @group {{ machine_name }}
12 class {{ class }} extends WebDriverTestBase {
17 public static $modules = ['{{ machine_name }}'];
22 protected function setUp() {
24 // Set up the test here.
30 public function testSomething() {
31 // Let's test password strength widget.
32 \Drupal::configFactory()->getEditable('user.settings')
33 ->set('verify_mail', FALSE)
36 $this->drupalGet('user/register');
38 $page = $this->getSession()->getPage();
40 $password_field = $page->findField('Password');
41 $password_strength = $page->find('css', '.js-password-strength__text');
43 $this->assertEquals('', $password_strength->getText());
45 $password_field->setValue('abc');
46 $this->assertEquals('Weak', $password_strength->getText());
48 $password_field->setValue('abcABC123!');
49 $this->assertEquals('Fair', $password_strength->getText());
51 $password_field->setValue('abcABC123!sss');
52 $this->assertEquals('Strong', $password_strength->getText());