public function loginAsTeacher()
 {
     $I = $this;
     $I->wantTo('Login as a Teacher');
     $loginPage = LoginPage::openBy($I);
     $loginPage->login('erau', 'password_0');
 }
<?php

use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\common\_pages\LoginPage;
use tests\codeception\frontend\_pages\UserPage;
use tests\codeception\frontend\_pages\UserEditPage;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('Login view and update my profile');
$loginPage = LoginPage::openBy($I);
$I->amGoingTo('Login with correct credentials');
$loginPage->login('erau', 'password_0');
$I->amGoingTo('ensure user profile page works');
$userPage = UserPage::openBy($I);
$I->expectTo('see user personal data');
$I->see('*****@*****.**');
$I->seeLink('Edit my profile');
$I->amGoingTo('Open Edit my profile page');
$userEditPage = UserEditPage::openBy($I);
$I->see('Edit my profile', 'h1');
$I->amGoingTo('update my profile with correct data');
$userEditPage->submit(['phone_mobile' => '+49 30 6840 978 167']);
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$I->see('You profile has been updated.');
$I->see('+49 30 6840 978 167');
Beispiel #3
0
 /**
  * We want to be sure that not active user can not login.
  * If he try to login, he should get error flash message.
  *
  * @param \Codeception\AcceptanceTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testLoginNotActiveUser($I, $scenario)
 {
     // get setting value for 'Login With Email'
     $lwe = \Yii::$app->params['LoginWithEmail'];
     $field = $lwe ? '*****@*****.**' : 'tester';
     $error = $lwe ? 'email' : 'username';
     $I->wantTo("ensure that not active user can't login");
     $loginPage = LoginPage::openBy($I);
     //-- try to login user that has not activated his account yet --//
     $I->amGoingTo('try to log in not activated user');
     $loginPage->login($field, 'test123');
     $I->expectTo('see error message');
     $I->see('Incorrect ' . $error . ' or password.', '.help-block');
     $I->seeLink('Login');
 }
 /**
  * We want to be sure that not active user can not login.
  * If he try to login, he should get error flash message.
  * 
  * @param \Codeception\AcceptanceTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testLoginInactiveUser($I, $scenario)
 {
     // get setting value for 'Login With Email'
     $lwe = \Yii::$app->params['lwe'];
     $field = $lwe ? '*****@*****.**' : 'tester';
     $I->wantTo("ensure that not active user can't login");
     $loginPage = LoginPage::openBy($I);
     //-- try to login user that has not activated his account yet --//
     $I->amGoingTo('try to log in not activated user');
     $loginPage->login($field, 'test123');
     $I->expectTo('see error flash message');
     $I->see('You have to activate your account first.');
     $I->seeLink('Login');
 }