LoginCept.php 936 Bytes
Newer Older
Mark committed
1
<?php
2 3
use tests\codeception\frontend\FunctionalTester;
use tests\codeception\common\_pages\LoginPage;
Mark committed
4

5 6
/* @var $scenario Codeception\Scenario */

7
$I = new FunctionalTester($scenario);
Mark committed
8 9 10 11 12 13 14
$I->wantTo('ensure login page works');

$loginPage = LoginPage::openBy($I);

$I->amGoingTo('submit login form with no data');
$loginPage->login('', '');
$I->expectTo('see validations errors');
Johnny Theill committed
15 16
$I->see('Username cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');
Mark committed
17 18 19 20 21

$I->amGoingTo('try to login with wrong credentials');
$I->expectTo('see validations errors');
$loginPage->login('admin', 'wrong');
$I->expectTo('see validations errors');
Johnny Theill committed
22
$I->see('Incorrect username or password.', '.help-block');
Mark committed
23 24 25 26

$I->amGoingTo('try to login with correct credentials');
$loginPage->login('erau', 'password_0');
$I->expectTo('see that user is logged');
Johnny Theill committed
27 28 29
$I->seeLink('Logout (erau)');
$I->dontSeeLink('Login');
$I->dontSeeLink('Signup');