설치 테스트 추가

This commit is contained in:
bnu 2015-04-16 15:12:08 +09:00
parent 0d24de74d3
commit b07cd5f596
11 changed files with 2157 additions and 8 deletions

View file

@ -11,8 +11,9 @@ settings:
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
dsn: 'mysql:host=127.0.0.1;dbname=xe_test'
user: 'root'
password: 'root'
populate: false
cleanup: false
error_level: "E_STRICTE_ALL & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED & ~E_NOTICE"

View file

@ -0,0 +1,10 @@
<?php
namespace Codeception\Module;
class installHelper extends \Codeception\Module
{
public function _initialize()
{
\Codeception\Util\FileSystem::deleteDir('files');
}
}

View file

@ -1,4 +1,4 @@
<?php //[STAMP] f2f4d74938e4d0b68a0cc45ddc4df42b
<?php //[STAMP] d5fadbc13a70ab41c2ed527ec2b36d20
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build

View file

@ -1,4 +1,4 @@
<?php //[STAMP] d7bbcd1f0dd429da5e6566970c6feb56
<?php //[STAMP] bdc43d9c472c8c86c136dc49b64a1a3a
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build

17
tests/install.suite.yml Normal file
View file

@ -0,0 +1,17 @@
class_name: InstallTester
modules:
enabled:
- PhpBrowser
- installHelper
config:
PhpBrowser:
url: 'http://localhost:8000/'
env:
travis:
modules:
config:
Db:
dsn: 'mysql:host=127.0.0.1;dbname=xe_test'
user: 'travis'
password: 'travis'
cleanup: true

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
<?php
// Here you can initialize variables that will be available to your tests
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__.DIRECTORY_SEPARATOR.'_steps');
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__.DIRECTORY_SEPARATOR.'_pages');

View file

@ -0,0 +1,41 @@
<?php
class installPage
{
// include url of current page
public static $URL = '';
/**
* Declare UI map for this page here. CSS or XPath allowed.
* public static $usernameField = '#username';
* public static $formSubmitButton = "#mainForm input[type=submit]";
*/
/**
* Basic route example for your current URL
* You can append any additional parameter to URL
* and use it in tests like: EditPage::route('/123-post');
*/
public static function route($param)
{
return static::$URL.$param;
}
/**
* @var InstallTester;
*/
protected $installTester;
public function __construct(InstallTester $I)
{
$this->installTester = $I;
}
/**
* @return installPage
*/
public static function of(InstallTester $I)
{
return new static($I);
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace InstallTester;
class AdminSteps extends \InstallTester
{
public function login()
{
$I = $this;
}
public function adminLogin()
{
$I = $this;
}
public function logout()
{
$I = $this;
}
}

View file

@ -0,0 +1,105 @@
<?php
use \Codeception\Configuration;
$I = new InstallTester($scenario);
$config = (!$this->env) ? Configuration::config() : Configuration::suiteEnvironments('install')[$this->env];
$db_config = $config['modules']['config']['Db'];
$dsn = $db_config['dsn'];
$dsn = split('[;:]', $dsn);
$db_type = array_shift($dsn);
$dbinfo = [
'type' => $db_type,
'user' => $db_config['user'],
'password' => $db_config['password'],
'dbname' => 'xe_install',
'port' => ((isset($db_config['port']) && $db_config['port'])?: 3306),
];
foreach($dsn as $piece) {
list($key, $val) = explode('=', $piece);
$dbinfo[$key] = $val;
}
// Step 1
$I->wantTo('Install XE Core');
$I->amOnPage('/index.php?l=ko');
$I->setCookie('l', 'ko');
$I->seeElement('//div[@id="progress"]/ul/li[1][@class="active"]');
$I->seeElement('#content .language');
$I->seeElement('//ul[@class="language"]/li[2]/strong');
$I->click('#task-choose-language');
// Step 2 : License Agreement
$I->seeInCurrentUrl('act=dispInstallLicenseAgreement');
$I->seeElement('//div[@id="progress"]/ul/li[2][@class="active"]');
$I->see('사용권 동의', '#content');
$I->submitForm('.x_form-horizontal', ['act' => 'procInstallLicenseAggrement', 'license_agreement' => 'Y']);
// Step 3 : checkenv
$I->seeInCurrentUrl('act=dispInstallCheckEnv');
$I->seeElement('//div[@id="progress"]/ul/li[3][@class="active"]');
$I->seeElement('#content .x_icon-ok-sign');
$I->click('#task-checklist-confirm');
// Step 5 : SelectDB
$I->seeInCurrentUrl('act=dispInstallSelectDB');
$I->seeElement('//div[@id="progress"]/ul/li[5][@class="active"]');
$I->submitForm('#content form', ['db_type' => 'mysqli', 'act' => 'dispInstallDBForm']);
// Step 6 : db info
// $I->seeInCurrentUrl('act=dispInstallDBForm');
$I->seeElement('//div[@id="progress"]/ul/li[6][@class="active"]');
$I->submitForm('#content form', [
'act' => 'procMysqlDBSetting',
'db_type' => 'mysqli',
'db_userid' => $dbinfo['user'],
'db_password' => $dbinfo['password'],
'db_database' => $dbinfo['dbname'],
'db_hostname' => $dbinfo['host'],
'db_port' => $dbinfo['port'],
'db_table_prefix' => 'xe'
]);
// Step 7 : dispInstallConfigForm
$I->seeInCurrentUrl('act=dispInstallConfigForm');
$I->seeElement('//div[@id="progress"]/ul/li[7][@class="active"]');
$I->seeElement('select[name=time_zone]');
$I->submitForm('#content form', ['act' => 'procConfigSetting', 'time_zone' => '+0900']);
// Step 8 : dispInstallManagerForm
$I->seeInCurrentUrl('act=dispInstallManagerForm');
$I->seeElement('//div[@id="progress"]/ul/li[8][@class="active"]');
$I->fillField('#aMail', 'admin@admin.net');
$I->submitForm('#content form', [
'act' => 'procInstall',
'db_type' => 'mysqli',
'email_address' => 'admin@admin.net',
'password' => 'admin',
'password2' => 'admin',
'nick_name' => 'admin',
'user_id' => 'admin'
]);
// Step 9
$I->wantTo('completed');
$I->dontSeeElement('//div[@id="progress"]/ul/li');
$I->amOnPage('/index.php?act=dispMemberLoginForm');
$I->fillField('user_id', 'admin@admin.net');
$I->submitForm('.login-body form', [
'act' => 'procMemberLogin',
'user_id' => 'admin@admin.net',
'password' => 'admin',
'success_return_url' => '/index.php?module=admin'
]);
$I->seeInCurrentUrl('module=admin');
$I->seeElement('#gnbNav');
$I->seeElement('#content .x_page-header');
$I->see('설치 환경 수집 동의', 'h2');

View file

@ -1,4 +1,4 @@
<?php //[STAMP] cb6a361b59627f91b689bd53cd926484
<?php //[STAMP] 12ed79a2e487867b140068ed6d5a381b
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
@ -19,7 +19,9 @@ use Codeception\Module\UnitHelper;
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void haveFriend($name)
* @method void haveFriend($name, $actorClass = null)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
@ -56,6 +58,38 @@ class UnitTester extends \Codeception\Actor
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that two variables are same
*
* @param $expected
* @param $actual
* @param string $message
*
* @return mixed
* @see \Codeception\Module\Asserts::assertSame()
*/
public function assertSame($expected, $actual, $message = null) {
return $this->scenario->runStep(new \Codeception\Step\Action('assertSame', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that two variables are not same
*
* @param $expected
* @param $actual
* @param string $message
* @see \Codeception\Module\Asserts::assertNotSame()
*/
public function assertNotSame($expected, $actual, $message = null) {
return $this->scenario->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*