2013-06-23 08:26:22 +08:00
|
|
|
<?php
|
2013-12-17 07:27:33 +08:00
|
|
|
|
2014-08-24 18:14:35 +08:00
|
|
|
use tests\codeception\_pages\LoginPage;
|
2013-12-02 19:25:21 +08:00
|
|
|
|
2014-08-16 22:15:41 +08:00
|
|
|
$I = new AcceptanceTester($scenario);
|
2013-06-23 08:26:22 +08:00
|
|
|
$I->wantTo('ensure that login works');
|
2013-12-02 19:25:21 +08:00
|
|
|
|
2013-12-18 12:43:43 +08:00
|
|
|
$loginPage = LoginPage::openBy($I);
|
|
|
|
|
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('', '');
|
2014-12-27 04:18:52 +08:00
|
|
|
if (method_exists($I, 'wait')) {
|
|
|
|
$I->wait(3); // only for selenium
|
|
|
|
}
|
2013-12-02 19:25:21 +08:00
|
|
|
$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');
|
2014-04-04 18:16:17 +08:00
|
|
|
if (method_exists($I, 'wait')) {
|
|
|
|
$I->wait(3); // only for selenium
|
|
|
|
}
|
2013-12-02 19:25:21 +08:00
|
|
|
$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');
|
2013-12-17 07:46:46 +08:00
|
|
|
if (method_exists($I, 'wait')) {
|
2014-03-16 12:46:16 +08:00
|
|
|
$I->wait(3); // only for selenium
|
2013-12-17 07:46:46 +08:00
|
|
|
}
|
2013-12-02 19:25:21 +08:00
|
|
|
$I->expectTo('see user info');
|
2013-06-23 08:26:22 +08:00
|
|
|
$I->see('Logout (admin)');
|