LoginCept.php 756 Bytes
Newer Older
1
<?php
2

3
use tests\codeception\_pages\LoginPage;
Mark committed
4

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

7
$I = new FunctionalTester($scenario);
8
$I->wantTo('ensure that login works');
Mark committed
9

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

12 13
$I->see('Login', 'h1');

Mark committed
14 15 16 17 18
$I->amGoingTo('try to login with empty credentials');
$loginPage->login('', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Password cannot be blank.');
19

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

Mark committed
25 26 27
$I->amGoingTo('try to login with correct credentials');
$loginPage->login('admin', 'admin');
$I->expectTo('see user info');
28
$I->see('Logout (admin)');