2013-06-23 08:26:22 +08:00
|
|
|
<?php
|
2013-12-02 19:25:21 +08:00
|
|
|
use tests\_pages\LoginPage;
|
|
|
|
|
2013-06-23 08:26:22 +08:00
|
|
|
$I = new WebGuy($scenario);
|
|
|
|
$I->wantTo('ensure that login works');
|
2013-12-02 19:25:21 +08:00
|
|
|
$loginPage = LoginPage::of($I);
|
|
|
|
|
|
|
|
$I->amOnPage(LoginPage::$URL);
|
2013-06-23 08:26:22 +08:00
|
|
|
$I->see('Login', 'h1');
|
|
|
|
|
2013-12-02 19:25:21 +08:00
|
|
|
$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.');
|
2013-06-23 08:26:22 +08:00
|
|
|
|
2013-12-02 19:25:21 +08:00
|
|
|
$I->amGoingTo('try to login with wrong credentials');
|
|
|
|
$loginPage->login('admin', 'wrong');
|
|
|
|
$I->expectTo('see validations errors');
|
|
|
|
$I->see('Incorrect username or password.');
|
2013-06-23 08:26:22 +08:00
|
|
|
|
2013-12-02 19:25:21 +08:00
|
|
|
$I->amGoingTo('try to login with correct credentials');
|
|
|
|
$loginPage->login('admin', 'admin');
|
|
|
|
$I->wait(3);
|
|
|
|
$I->expectTo('see user info');
|
2013-06-23 08:26:22 +08:00
|
|
|
$I->see('Logout (admin)');
|