LoginCept.php 863 Bytes
Newer Older
Mark committed
1
<?php
2 3
use codeception_frontend\TestGuy;
use codeception\common\_pages\LoginPage;
Mark committed
4 5 6 7 8 9 10 11 12

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

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

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