Remove the MaxFileSize HTML generator
[phpmyadmin.git] / test / selenium / ChangePasswordTest.php
blobda5b2b9882f2563e5cfc68a9704fec7674052eac
1 <?php
2 /**
3 * Selenium TestCase for change password related tests
4 */
5 declare(strict_types=1);
7 namespace PhpMyAdmin\Tests\Selenium;
9 use PHPUnit\Framework\AssertionFailedError;
10 use function array_push;
11 use function trim;
13 /**
14 * PrivilegesTest class
16 * @group selenium
18 class ChangePasswordTest extends TestBase
20 /**
21 * Array of AssertionFailedError->toString
23 * @var string[]
25 private $verificationErrors;
27 /**
28 * Tests the changing of the password
30 * @return void
32 * @group large
34 public function testChangePassword()
36 $this->login();
38 $e = $this->waitForElement('id', 'change_password_anchor');
39 $e->click();
41 $this->waitAjax();
43 $this->waitForElement('xpath', "//span[contains(., 'Change password')]");
44 try {
45 $ele = $this->waitForElement('name', 'pma_pw');
46 $this->assertEquals('', $ele->getAttribute('value'));
47 } catch (AssertionFailedError $e) {
48 array_push($this->verificationErrors, $e->toString());
50 try {
51 $ele = $this->waitForElement('name', 'pma_pw2');
52 $this->assertEquals('', $ele->getAttribute('value'));
53 } catch (AssertionFailedError $e) {
54 array_push($this->verificationErrors, $e->toString());
56 try {
57 $ele = $this->waitForElement('name', 'generated_pw');
58 $this->assertEquals('', $ele->getAttribute('value'));
59 } catch (AssertionFailedError $e) {
60 array_push($this->verificationErrors, $e->toString());
62 $this->byId('button_generate_password')->click();
63 $this->assertNotEquals('', $this->byName('pma_pw')->getAttribute('value'));
64 $this->assertNotEquals('', $this->byName('pma_pw2')->getAttribute('value'));
65 $this->assertNotEquals('', $this->byName('generated_pw')->getAttribute('value'));
67 if ($GLOBALS['TESTSUITE_PASSWORD'] != '') {
68 $this->byName('pma_pw')->clear();
69 $this->byName('pma_pw2')->clear();
71 $this->byName('pma_pw')->click()->sendKeys($GLOBALS['TESTSUITE_PASSWORD']);
73 $this->byName('pma_pw2')->click()->sendKeys($GLOBALS['TESTSUITE_PASSWORD']);
74 } else {
75 $this->byId('nopass_1')->click();
78 $this->byXpath("//button[contains(., 'Go')]")->click();
79 $ele = $this->waitForElement('cssSelector', '.alert-success');
80 $this->assertEquals(
81 'The profile has been updated.',
82 trim($ele->getText())