Пример #1
0
 public function testUnApprovedUser(FunctionalTester $I)
 {
     $I->wantTo('ensure that unapproved user cannot login');
     $loginPage = LoginPage::openBy($I);
     $loginPage->login('UnApprovedUser', '123qwe');
     $I->expectTo('see validations errors');
     $I->see('Your account is not approved yet!');
 }
Пример #2
0
<?php

// @group mandatory
use tests\codeception\_pages\LoginPage;
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that login works');
$loginPage = LoginPage::openBy($I);
$I->see('Sign in', 'h3');
$I->amGoingTo('try to login with correct credentials');
$loginPage->login('admin', 'admin');
$I->makeScreenshot('login-success');
$I->expectTo('see user info');
$I->click('.nav #link-user-menu a');
#$i->wait(1);
$I->seeElement('#link-logout');
$I->click('#link-logout');
$I->makeScreenshot('logout-success');
Пример #3
0
<?php

use tests\codeception\_pages\AboutPage;
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that preview access works');
$I->amOnPage('/');
$I->makeScreenshot('debug-preview-access-login');
$loginPage = \tests\codeception\_pages\LoginPage::openBy($I);
$I->amGoingTo('try to login as preview');
$loginPage->login('preview', 'preview1234');
$I->amOnPage('/');
$I->dontSee('.alert');
$I->makeScreenshot('success-preview-access');
Пример #4
0
<?php

// @group mandatory
use tests\codeception\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that access control UI works');
$I->amOnPage('/');
$I->dontSeeLink('/de/backend', '.nav');
$I->dontSee('', '.glyphicon.glyphicon-cog');
LoginPage::openBy($I)->login('admin', 'admin');
$I->see('', '.glyphicon.glyphicon-cog');
Пример #5
0
<?php

use dektrium\user\tests\FunctionalTester;
use tests\codeception\_pages\UpdatePage;
use tests\codeception\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that user update works');
$loginPage = LoginPage::openBy($I);
$user = $I->getFixture('user')->getModel('user');
$loginPage->login($user->email, 'qwerty');
$page = UpdatePage::openBy($I, ['id' => $user->id]);
$page->update('user', '*****@*****.**', 'new_pass');
$I->see('Account details have been updated');
Yii::$app->user->logout();
LoginPage::openBy($I)->login('*****@*****.**', 'new_pass');
$I->see('Logout');
Пример #6
0
<?php

use tests\codeception\_pages\CreatePage;
use tests\codeception\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that user creation works');
$loginPage = LoginPage::openBy($I);
$user = $I->getFixture('users')->getModel('users');
$loginPage->login($user->email, 'qwerty');
$page = CreatePage::openBy($I);
$I->amGoingTo('try to create user with empty fields');
$page->create('', '', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Email cannot be blank.');
$page->create('toster', '*****@*****.**', 'toster');
$I->see('User has been created');
$I->see('toster');
$I->see('*****@*****.**');
Yii::$app->user->logout();
LoginPage::openBy($I)->login('*****@*****.**', 'toster');
$I->see('Logout');
Пример #7
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\FunctionalTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testLoginNotActiveUser($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.', '.alert-danger');
     $I->seeLink('Login');
 }