Close #41 remove deprecated package yii2-codeception. Update tests.

This commit is contained in:
Antonio Ramirez
2017-08-06 15:29:36 +02:00
parent 026a6e9825
commit fcdb228c41
18 changed files with 250 additions and 478 deletions

View File

@ -3,38 +3,50 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that login works');
$I->haveFixtures(['user' => UserFixture::className()]);
$page = LoginPage::openBy($I);
$I->amOnRoute('/user/security/login');
$I->amGoingTo('try to login with empty credentials');
$page->login('', '');
$I->fillField('#loginform-login', '');
$I->fillField('#loginform-password', '');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('Login cannot be blank.');
$I->see('Password cannot be blank.');
$I->amGoingTo('try to login with unconfirmed account');
$user = $I->grabFixture('user', 'unconfirmed');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('You need to confirm your email address');
$I->amGoingTo('try to login with blocked account');
$user = $I->grabFixture('user', 'blocked');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->expectTo('see blocking information');
$I->see('Your account has been blocked');
$I->amGoingTo('try to login with wrong credentials');
$user = $I->grabFixture('user', 'user');
$page->login($user->email, 'wrong');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'wrong');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('Invalid login or password');
$I->amGoingTo('try to login with correct credentials');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->dontSee('Login');
$I->see('Logout');