1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Admin login and signup simulation tests added.

This commit is contained in:
Cameron
2018-03-08 17:49:37 -08:00
parent 6cc7c97bfa
commit 3ddf17de3f
4 changed files with 106 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ abstract class E107Base extends Base
public function _beforeSuite($settings = array()) public function _beforeSuite($settings = array())
{ {
$this->backupLocalE107Config();
$this->cleanVCS(); $this->cleanVCS();
parent::_beforeSuite($settings); parent::_beforeSuite($settings);
$this->writeLocalE107Config(); $this->writeLocalE107Config();
@@ -21,6 +22,7 @@ abstract class E107Base extends Base
parent::_afterSuite(); parent::_afterSuite();
$this->revokeLocalE107Config(); $this->revokeLocalE107Config();
$this->cleanVCS(); $this->cleanVCS();
$this->restoreLocalE107Config();
} }
protected function writeLocalE107Config() protected function writeLocalE107Config()
@@ -67,4 +69,21 @@ abstract class E107Base extends Base
//var_dump($stderr); //var_dump($stderr);
proc_close($resource); 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);
}
}
} }

View 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');
}
}

View 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.
}