yii2-netdisk/tests/codeception/acceptance/LoginCept.php
Alexander Makarov c55a791237 Codeception test adjustments for basic and advanced applications
- Moved everything test-related into `tests` directory. Codeception tests are in `codeception`.
- Removed database module since we're using fixtures and migrations.
- Moved console entry points and bootstrap into `tests/codeception/bin`.
- Adjusted travis build scripts.
- Adjusted documentation to be consistent and reflect changes made.
2014-08-15 19:09:52 +04:00

33 lines
843 B
PHP

<?php
use codeception\_pages\LoginPage;
$I = new WebGuy($scenario);
$I->wantTo('ensure that login works');
$loginPage = LoginPage::openBy($I);
$I->see('Login', 'h1');
$I->amGoingTo('try to login with empty credentials');
$loginPage->login('', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Password cannot be blank.');
$I->amGoingTo('try to login with wrong credentials');
$loginPage->login('admin', 'wrong');
if (method_exists($I, 'wait')) {
$I->wait(3); // only for selenium
}
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.');
$I->amGoingTo('try to login with correct credentials');
$loginPage->login('admin', 'admin');
if (method_exists($I, 'wait')) {
$I->wait(3); // only for selenium
}
$I->expectTo('see user info');
$I->see('Logout (admin)');