yii2-netdisk/tests/functional/LoginFormCest.php
2016-07-16 04:13:51 +03:00

41 lines
1.1 KiB
PHP

<?php
class LoginFormCest
{
public function _before(\FunctionalTester $I)
{
$I->amOnPage(['site/login']);
}
public function openLoginPage(\FunctionalTester $I)
{
$I->see('Login', 'h1');
}
public function loginWithEmptyCredentials(\FunctionalTester $I)
{
$I->submitForm('#login-form', []);
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Password cannot be blank.');
}
public function loginWithWringCredentials(\FunctionalTester $I)
{
$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'wrong',
]);
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.');
}
public function loginSuccessfully(\FunctionalTester $I)
{
$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'admin',
]);
$I->see('Logout (admin)');
$I->dontSeeElement('form#login-form');
}
}