LoginCept.php 893 Bytes
Newer Older
Mark committed
1 2
<?php

3 4
use tests\codeception\backend\FunctionalTester;
use tests\codeception\common\_pages\LoginPage;
Mark committed
5

6
$I = new FunctionalTester($scenario);
Mark committed
7 8 9 10 11 12 13
$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
14 15
$I->see('Username cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');
Mark committed
16 17 18 19 20

$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
21
$I->see('Incorrect username or password.', '.help-block');
Mark committed
22 23 24 25

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