mirror of
https://github.com/e107inc/e107.git
synced 2025-04-15 18:14:07 +02:00
Admin login and signup simulation tests added.
This commit is contained in:
parent
6cc7c97bfa
commit
3ddf17de3f
@ -11,6 +11,7 @@ abstract class E107Base extends Base
|
||||
|
||||
public function _beforeSuite($settings = array())
|
||||
{
|
||||
$this->backupLocalE107Config();
|
||||
$this->cleanVCS();
|
||||
parent::_beforeSuite($settings);
|
||||
$this->writeLocalE107Config();
|
||||
@ -21,6 +22,7 @@ abstract class E107Base extends Base
|
||||
parent::_afterSuite();
|
||||
$this->revokeLocalE107Config();
|
||||
$this->cleanVCS();
|
||||
$this->restoreLocalE107Config();
|
||||
}
|
||||
|
||||
protected function writeLocalE107Config()
|
||||
@ -67,4 +69,21 @@ abstract class E107Base extends Base
|
||||
//var_dump($stderr);
|
||||
proc_close($resource);
|
||||
}
|
||||
|
||||
protected function backupLocalE107Config()
|
||||
{
|
||||
if(file_exists(self::APP_PATH_E107_CONFIG))
|
||||
{
|
||||
rename(self::APP_PATH_E107_CONFIG, APP_PATH.'/e107_config.bak');
|
||||
}
|
||||
}
|
||||
|
||||
protected function restoreLocalE107Config()
|
||||
{
|
||||
if(file_exists(APP_PATH."/e107_config.bak"))
|
||||
{
|
||||
rename(APP_PATH.'/e107_config.bak', self::APP_PATH_E107_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
40
tests/acceptance/0001_AdminLoginCest.php
Normal file
40
tests/acceptance/0001_AdminLoginCest.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AdminLoginCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testAdminLogin(AcceptanceTester $I)
|
||||
{
|
||||
$I->amOnPage('/e107_admin/admin.php');
|
||||
$I->wantTo("Test the admin area login process");
|
||||
$I->see("Admin Area");
|
||||
$I->see("login");
|
||||
|
||||
$I->fillField('authname', 'admin');
|
||||
$I->fillField('authpass', 'admin');
|
||||
|
||||
$I->click('authsubmit');
|
||||
|
||||
$I->see("Admin's Control Panel");
|
||||
|
||||
$I->dontSeeInSource('Unauthorized access!');
|
||||
|
||||
$I->see("Latest");
|
||||
|
||||
$I->see("Status");
|
||||
|
||||
// $I->dontSeeInSource('fa fa-database');
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
47
tests/acceptance/0002_UserSignupCest.php
Normal file
47
tests/acceptance/0002_UserSignupCest.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
|
||||
class UserSignupCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testUserSignupSimulation(AcceptanceTester $I)
|
||||
{
|
||||
// first login as admin ( to simulate without emails going out).
|
||||
$I->amOnPage('/login.php');
|
||||
$I->fillField('username', 'admin');
|
||||
$I->fillField('userpass', 'admin');
|
||||
|
||||
$I->click('userlogin');
|
||||
|
||||
$I->see("You are seeing this message because you are currently logged in as the Main Admin");
|
||||
|
||||
|
||||
// Go to signup page.
|
||||
$I->amOnPage('/signup.php');
|
||||
$I->wantTo("Test user signup process");
|
||||
$I->see("You are currently logged in as Main Admin");
|
||||
$I->checkOption('simulation');
|
||||
|
||||
// Fill the form
|
||||
$I->fillField('loginname', 'user1');
|
||||
$I->fillField('email', 'user1@domain.com');
|
||||
$I->fillField('password1', 'Password1234');
|
||||
$I->fillField('password2', 'Password1234');
|
||||
|
||||
$I->click('register');
|
||||
|
||||
$I->dontSee('Unauthorized access!');
|
||||
|
||||
}
|
||||
|
||||
//TODO signup under difference conditions (different prefs).. ie. admin approval required etc.
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user