3 * Selenium TestCase for change password related tests
5 declare(strict_types
=1);
7 namespace PhpMyAdmin\Tests\Selenium
;
9 use PHPUnit\Framework\AssertionFailedError
;
10 use function array_push
;
14 * PrivilegesTest class
18 class ChangePasswordTest
extends TestBase
21 * Array of AssertionFailedError->toString
25 private $verificationErrors;
28 * Tests the changing of the password
34 public function testChangePassword()
38 $e = $this->waitForElement('id', 'change_password_anchor');
43 $this->waitForElement('xpath', "//span[contains(., 'Change password')]");
45 $ele = $this->waitForElement('name', 'pma_pw');
46 $this->assertEquals('', $ele->getAttribute('value'));
47 } catch (AssertionFailedError
$e) {
48 array_push($this->verificationErrors
, $e->toString());
51 $ele = $this->waitForElement('name', 'pma_pw2');
52 $this->assertEquals('', $ele->getAttribute('value'));
53 } catch (AssertionFailedError
$e) {
54 array_push($this->verificationErrors
, $e->toString());
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']);
75 $this->byId('nopass_1')->click();
78 $this->byXpath("//button[contains(., 'Go')]")->click();
79 $ele = $this->waitForElement('cssSelector', '.alert-success');
81 'The profile has been updated.',