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,29 +3,38 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\CreatePage;
use tests\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that user creation works');
$I->haveFixtures(['user' => UserFixture::className()]);
$loginPage = LoginPage::openBy($I);
$user = $I->grabFixture('user', 'user');
$loginPage->login($user->email, 'qwerty');
$page = CreatePage::openBy($I);
$I->amLoggedInAs($user);
$I->amOnRoute('/user/admin/create');
$I->amGoingTo('try to create user with empty fields');
$page->create('', '', '');
$I->fillField('#user-username', '');
$I->fillField('#user-email', '');
$I->fillField('#user-password', '');
$I->click('Save');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Email cannot be blank.');
$page->create('foobar', 'foobar@example.com', 'foobar');
$I->fillField('#user-username', 'foobar');
$I->fillField('#user-email', 'foobar@example.com');
$I->fillField('#user-password', 'foobar');
$I->click('Save');
$I->see('User has been created');
Yii::$app->user->logout();
LoginPage::openBy($I)->login('foobar@example.com', 'foobar');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'foobar@example.com');
$I->fillField('#loginform-password', 'foobar');
$I->click('Sign in');
$I->see('Logout');