phpmyadmin/tests/end-to-end/LoginTest.php
Maurício Meneghini Fauth 9a0d34b01d
Rename tests/selenium to tests/end-to-end
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2024-02-23 13:29:07 -03:00

48 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Selenium;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Group;
#[CoversNothing]
class LoginTest extends TestBase
{
/**
* Create a test database for this test class
*/
protected static bool $createDatabase = false;
protected function setUp(): void
{
parent::setUp();
$this->logOutIfLoggedIn();
}
/**
* Test for successful login
*/
#[Group('large')]
public function testSuccessfulLogin(): void
{
$this->login();
$this->waitForElement('xpath', '//*[@id="server-breadcrumb"]');
self::assertTrue($this->isSuccessLogin());
$this->logOutIfLoggedIn();
}
/**
* Test for unsuccessful login
*/
#[Group('large')]
public function testLoginWithWrongPassword(): void
{
$this->login('Admin', 'Admin');
$this->waitForElement('xpath', '//*[@class="alert alert-danger" and contains(.,\'Access denied for\')]');
self::assertTrue($this->isUnsuccessLogin());
}
}