Pull merge.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / test / webdriver.twig
1 <?php
2
3 namespace Drupal\Tests\{{ machine_name }}\FunctionalJavascript;
4
5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
6
7 /**
8  * Tests the JavaScript functionality of the {{ name }} module.
9  *
10  * @group {{ machine_name }}
11  */
12 class {{ class }} extends WebDriverTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['{{ machine_name }}'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp() {
23     parent::setUp();
24     // Set up the test here.
25   }
26
27   /**
28    * Test callback.
29    */
30   public function testSomething() {
31     // Let's test password strength widget.
32     \Drupal::configFactory()->getEditable('user.settings')
33       ->set('verify_mail', FALSE)
34       ->save();
35
36     $this->drupalGet('user/register');
37
38     $page = $this->getSession()->getPage();
39
40     $password_field = $page->findField('Password');
41     $password_strength = $page->find('css', '.js-password-strength__text');
42
43     $this->assertEquals('', $password_strength->getText());
44
45     $password_field->setValue('abc');
46     $this->assertEquals('Weak', $password_strength->getText());
47
48     $password_field->setValue('abcABC123!');
49     $this->assertEquals('Fair', $password_strength->getText());
50
51     $password_field->setValue('abcABC123!sss');
52     $this->assertEquals('Strong', $password_strength->getText());
53   }
54
55 }