mirror of
https://github.com/e107inc/e107.git
synced 2025-09-01 02:21:58 +02:00
Preparation for merge with e107 repository
Moved all test files to e107_tests subdirectory
This commit is contained in:
194
e107_tests/tests/acceptance/0000_InstallCest.php
Normal file
194
e107_tests/tests/acceptance/0000_InstallCest.php
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
|
||||
class InstallCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
$I->unlinkE107ConfigFromTestEnvironment();
|
||||
$this->dropAllDbTables($I);
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function installWelcomePageContainsExpectedContent(AcceptanceTester $I)
|
||||
{
|
||||
$I->amOnPage('/install.php');
|
||||
$I->see("e107 Installation :: Step 1");
|
||||
$I->see("Language Selection");
|
||||
}
|
||||
|
||||
public function installDefault(AcceptanceTester $I)
|
||||
{
|
||||
$I->wantTo("Install e107 with default settings");
|
||||
$this->installe107($I);
|
||||
$this->checkAdminButtonWelcomeMessage($I);
|
||||
$this->testNoUpdatesRequired($I);
|
||||
$this->checkTinyMceIsInstalled($I);
|
||||
|
||||
}
|
||||
|
||||
public function installBootstrap3(AcceptanceTester $I)
|
||||
{
|
||||
$I->wantTo("Install e107 with bootstrap3");
|
||||
$this->installe107($I, array('sitetheme'=>'bootstrap3'));
|
||||
$this->checkAdminButtonWelcomeMessage($I);
|
||||
$this->testNoUpdatesRequired($I);
|
||||
$this->checkTinyMceIsInstalled($I);
|
||||
|
||||
// Check install.xml Custom Fields in Page table.
|
||||
$I->amOnPage('/page.php?id=4');
|
||||
$I->see("22 Aug 2018");
|
||||
$I->see("United States");
|
||||
$I->see("Blue");
|
||||
|
||||
}
|
||||
|
||||
public function installLandingZero(AcceptanceTester $I)
|
||||
{
|
||||
$I->wantTo("Install e107 with landingzero");
|
||||
$this->installe107($I, array('sitetheme'=>'landingzero'));
|
||||
$this->checkAdminButtonWelcomeMessage($I);
|
||||
$this->testNoUpdatesRequired($I);
|
||||
$this->checkTinyMceIsInstalled($I);
|
||||
|
||||
}
|
||||
|
||||
private function installe107(AcceptanceTester $I, $params = array())
|
||||
{
|
||||
// Step 1
|
||||
|
||||
$I->amOnPage('/install.php');
|
||||
$I->selectOption("language", 'English');
|
||||
$I->click('start');
|
||||
|
||||
// Step 2
|
||||
|
||||
$I->see("MySQL Server Details", 'h3');
|
||||
|
||||
$db = $I->getDbModule();
|
||||
|
||||
$I->fillField('server', $db->_getDbHostname());
|
||||
$I->fillField('name', $db->_getDbUsername());
|
||||
$I->fillField('password', $db->_getDbPassword());
|
||||
$I->fillField('db', $db->_getDbName());
|
||||
|
||||
$I->uncheckOption('createdb');
|
||||
$I->click('submit');
|
||||
|
||||
// Step 3
|
||||
|
||||
$I->see("MySQL Connection Verification", 'h3');
|
||||
$I->see("Connection to the MySQL server established and verified");
|
||||
$I->see("Found existing database");
|
||||
|
||||
$I->click('submit');
|
||||
|
||||
// Step 4
|
||||
|
||||
$I->see("PHP and MySQL Versions Check / File Permissions Check");
|
||||
|
||||
try
|
||||
{
|
||||
$I->see('You might have an existing installation'); //XXX Triggered if e107_config.php is not empty
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$I->dontSee('You might have an existing installation');
|
||||
}
|
||||
|
||||
$I->click('continue_install');
|
||||
|
||||
// Step 5
|
||||
|
||||
$I->see("Administration", 'h3');
|
||||
|
||||
$I->fillField('u_name', 'admin');
|
||||
$I->fillField('d_name', 'admin');
|
||||
$I->fillField('pass1', 'admin');
|
||||
$I->fillField('pass2', 'admin');
|
||||
$I->fillField('email', 'admin@admin.com');
|
||||
|
||||
$I->click('submit');
|
||||
|
||||
// Step 6
|
||||
|
||||
$I->see("Website Preferences", 'h3');
|
||||
$I->fillField('sitename', 'Test Site');
|
||||
|
||||
if(!empty($params['sitetheme']))
|
||||
{
|
||||
$I->selectOption('sitetheme', $params['sitetheme']);
|
||||
}
|
||||
|
||||
$I->click('submit');
|
||||
|
||||
// Step 7
|
||||
|
||||
$I->see("Install Confirmation", 'h3');
|
||||
|
||||
$I->click('submit');
|
||||
|
||||
// Step 8
|
||||
|
||||
$I->see("Installation Complete", 'h3');
|
||||
|
||||
|
||||
$I->amOnPage('/index.php');
|
||||
|
||||
if(!empty($params['sitetheme']))
|
||||
{
|
||||
$I->seeInSource('e107_themes/'.$params['sitetheme']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function loginToAdmin(AcceptanceTester $I)
|
||||
{
|
||||
$I->amOnPage('/e107_admin/admin.php');
|
||||
$I->fillField('authname', 'admin');
|
||||
$I->fillField('authpass', 'admin');
|
||||
$I->click('authsubmit');
|
||||
$I->dontSeeInSource('Unauthorized access!');
|
||||
}
|
||||
|
||||
private function testNoUpdatesRequired(AcceptanceTester $I)
|
||||
{
|
||||
// first Login
|
||||
$this->loginToAdmin($I);
|
||||
|
||||
$I->amOnPage('/e107_admin/e107_update.php?[debug=basic+]');
|
||||
$I->wantTo("Check there are no updates required after install");
|
||||
|
||||
$I->dontSee("Update", 'button span');
|
||||
}
|
||||
|
||||
|
||||
private function checkTinyMceIsInstalled(AcceptanceTester $I)
|
||||
{
|
||||
$I->amOnPage('/e107_admin/admin.php');
|
||||
$I->seeInSource('TinyMce4');
|
||||
$I->amOnPage('/e107_plugins/tinymce4/admin_config.php');
|
||||
$I->see("Paste as text by default");
|
||||
}
|
||||
|
||||
|
||||
private function checkAdminButtonWelcomeMessage(AcceptanceTester $I)
|
||||
{
|
||||
$I->seeInSource('btn-large " href="e107_admin/admin.php">Go to Admin area</a>');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AcceptanceTester $I
|
||||
*/
|
||||
private function dropAllDbTables(AcceptanceTester $I)
|
||||
{
|
||||
$db = $I->getDbModule();
|
||||
$db->_cleanup();
|
||||
}
|
||||
|
||||
}
|
123
e107_tests/tests/acceptance/0001_AdminLoginCest.php
Normal file
123
e107_tests/tests/acceptance/0001_AdminLoginCest.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AdminLoginCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testAdminLogin(AcceptanceTester $I)
|
||||
{
|
||||
|
||||
$I->wantTo("Test the admin area login process");
|
||||
|
||||
$this->e107Login($I);
|
||||
|
||||
$I->dontSeeInSource('Unauthorized access!');
|
||||
|
||||
$I->see("Latest");
|
||||
|
||||
$I->see("Status");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function e107Login(AcceptanceTester $I)
|
||||
{
|
||||
$I->amOnPage('/e107_admin/admin.php');
|
||||
$I->see("Admin Area");
|
||||
$I->see("login");
|
||||
|
||||
$I->fillField('authname', 'admin');
|
||||
$I->fillField('authpass', 'admin');
|
||||
|
||||
$I->click('authsubmit');
|
||||
|
||||
$I->see("Admin's Control Panel");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testAdminURLS(AcceptanceTester $I)
|
||||
{
|
||||
|
||||
$this->e107Login($I);
|
||||
|
||||
$urls = array(
|
||||
'admin.php?[debug=basic+]',
|
||||
'cache.php',
|
||||
'emoticon.php',
|
||||
'frontpage.php',
|
||||
'frontpage.php?mode=create',
|
||||
'language.php',
|
||||
'language.php?mode=main&action=db',
|
||||
'language.php?mode=main&action=tools',
|
||||
'language.php?mode=main&action=deprecated',
|
||||
'meta.php',
|
||||
'prefs.php',
|
||||
'search.php',
|
||||
'search.php?settings',
|
||||
'links.php',
|
||||
'links.php?mode=main&action=create',
|
||||
'links.php?mode=main&action=prefs',
|
||||
'links.php?mode=main&action=tools',
|
||||
'eurl.php',
|
||||
'eurl.php?mode=main&action=alias',
|
||||
'eurl.php?mode=main&action=simple',
|
||||
'eurl.php?mode=main&action=settings',
|
||||
'updateadmin.php',
|
||||
'administrator.php',
|
||||
'banlist.php',
|
||||
'banlist.php?mode=main&action=create',
|
||||
'banlist.php?mode=white&action=list',
|
||||
'banlist.php?mode=white&action=create',
|
||||
'banlist.php?mode=failed&action=list',
|
||||
'banlist.php?mode=main&action=transfer',
|
||||
'banlist.php?mode=main&action=times',
|
||||
'banlist.php?mode=main&action=options',
|
||||
'users_extended.php',
|
||||
'users_extended.php?mode=main&action=add',
|
||||
'users_extended.php?mode=main&action=create',
|
||||
'users_extended.php?mode=cat&action=list',
|
||||
'users_extended.php?mode=cat&action=create',
|
||||
'mailout.php',
|
||||
'mailout.php?mode=main&action=create',
|
||||
'mailout.php?mode=recipients&action=list',
|
||||
'mailout.php?mode=pending&action=list',
|
||||
'mailout.php?mode=held&action=list',
|
||||
'mailout.php?mode=sent&action=list',
|
||||
'mailout.php?mode=prefs&action=prefs',
|
||||
'mailout.php?mode=maint&action=maint',
|
||||
'mailout.php?mode=main&action=templates',
|
||||
'userclass2.php',
|
||||
'userclass2.php?mode=main&action=create',
|
||||
'userclass2.php?mode=main&action=initial',
|
||||
'userclass2.php?mode=main&action=options',
|
||||
'users.php',
|
||||
'users.php?mode=main&action=add',
|
||||
'users.php?mode=main&action=prefs',
|
||||
'users.php?mode=ranks&action=list',
|
||||
'users.php?mode=main&action=maintenance'
|
||||
);
|
||||
|
||||
foreach($urls as $url)
|
||||
{
|
||||
$I->amOnPage('/e107_admin/'.$url);
|
||||
|
||||
$I->dontSee("syntax error");
|
||||
$I->dontSee("Fatal error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
57
e107_tests/tests/acceptance/0002_UserSignupCest.php
Normal file
57
e107_tests/tests/acceptance/0002_UserSignupCest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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->selectOption('coppa',1);
|
||||
$I->click('newver');
|
||||
|
||||
|
||||
$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!');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// "Admin Approval Pending"
|
||||
//TODO signup under difference conditions (different prefs).. ie. admin approval required etc.
|
||||
|
||||
}
|
26
e107_tests/tests/acceptance/0010_ThumbCest.php
Normal file
26
e107_tests/tests/acceptance/0010_ThumbCest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ThumbCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testThumbOutput(AcceptanceTester $I)
|
||||
{
|
||||
|
||||
$I->amOnPage('/thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=220&h=190');
|
||||
|
||||
$I->seeResponseCodeIs(200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
29
e107_tests/tests/acceptance/0011_CaptchaCest.php
Normal file
29
e107_tests/tests/acceptance/0011_CaptchaCest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
|
||||
class CaptchaCest
|
||||
{
|
||||
public function _before(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
public function _after(AcceptanceTester $I)
|
||||
{
|
||||
}
|
||||
|
||||
// tests
|
||||
public function testSecImgOutput(AcceptanceTester $I)
|
||||
{
|
||||
$recnum = 1534090983051500000;
|
||||
|
||||
$_SESSION['secure_img'][$recnum] = 'ABCDEFG';
|
||||
|
||||
$I->amOnPage('/e107_images/secimg.php?id='.$recnum.'&clr=cccccc');
|
||||
|
||||
$I->seeResponseCodeIs(200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
1
e107_tests/tests/acceptance/_bootstrap.php
Normal file
1
e107_tests/tests/acceptance/_bootstrap.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
Reference in New Issue
Block a user