From 9563f8f797af107eb5f290b361e745a844efd1bc Mon Sep 17 00:00:00 2001 From: Deltik Date: Tue, 20 Feb 2018 13:23:39 -0600 Subject: [PATCH] Fixed bug: _reconfigure()'d modules forgot config Apparently, reconfiguring only applies to one test. This commit makes all tests' modules reconfigured. Introduced command to clean local app repo InstallCest actually installs e107 now --- tests/_support/Helper/Base.php | 5 ++ tests/_support/Helper/E107Base.php | 10 ++++ tests/acceptance/InstallCest.php | 90 ++++++++++-------------------- 3 files changed, 45 insertions(+), 60 deletions(-) diff --git a/tests/_support/Helper/Base.php b/tests/_support/Helper/Base.php index 2c6bc03fd..1e2970201 100644 --- a/tests/_support/Helper/Base.php +++ b/tests/_support/Helper/Base.php @@ -38,6 +38,11 @@ abstract class Base extends \Codeception\Module } protected function _callbackDeployerStarted() + { + return $this->_before(); + } + + public function _before(\Codeception\TestCase $test = null) { foreach ($this->deployer_components as $component) { diff --git a/tests/_support/Helper/E107Base.php b/tests/_support/Helper/E107Base.php index e68185433..9cf2deb49 100644 --- a/tests/_support/Helper/E107Base.php +++ b/tests/_support/Helper/E107Base.php @@ -12,6 +12,7 @@ abstract class E107Base extends Base public function _beforeSuite($settings = array()) { parent::_beforeSuite($settings); + $this->cleanVCS(); $this->writeLocalE107Config(); } @@ -19,6 +20,7 @@ abstract class E107Base extends Base { parent::_afterSuite(); $this->revokeLocalE107Config(); + $this->cleanVCS(); } protected function writeLocalE107Config() @@ -45,4 +47,12 @@ abstract class E107Base extends Base { unlink(self::APP_PATH_E107_CONFIG); } + + protected function cleanVCS() + { + $pwd = getcwd(); + chdir(APP_PATH); + exec('git clean -fdx'); + chdir($pwd); + } } diff --git a/tests/acceptance/InstallCest.php b/tests/acceptance/InstallCest.php index 74727b336..5032345e4 100644 --- a/tests/acceptance/InstallCest.php +++ b/tests/acceptance/InstallCest.php @@ -19,21 +19,21 @@ class InstallCest $I->see("Language Selection"); } - public function installStep1ToStep2(AcceptanceTester $I) + public function installRun(AcceptanceTester $I) { + $I->wantTo("Install e107"); + + // Step 1 + $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 2 of the Installation"); $I->selectOption("language", 'English'); $I->click('start'); - $I->see("MySQL Server Details", 'h3'); - } - public function installStep2ToStep3(AcceptanceTester $I) - { - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 3 of the Installation"); + // Step 2 + + $I->see("MySQL Server Details", 'h3'); + $db = $I->getHelperDb(); - $this->installStep1ToStep2($I); $I->fillField('server', $db->_getDbHostname()); $I->fillField('name', $db->_getDbUsername()); @@ -43,49 +43,32 @@ class InstallCest $I->uncheckOption('createdb'); $I->click('submit'); + // Step 3 + $I->see("MySQL Connection Verification", 'h3'); - - // .... - } - - public function installStep3ToStep4(AcceptanceTester $I) - { - - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 4 of the Installation"); - - $this->installStep2ToStep3($I); - - // $I->see("Connection to the MySQL server established and verified"); + $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"); - } - - public function installStep4ToStep5(AcceptanceTester $I) // TODO Fails due to e107_config.php being present. - { - - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 5 of the Installation"); - - $this->installStep3ToStep4($I); - - $I->canSee('You might have an existing installation'); //XXX Triggered if e107_config.php is not empty + 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'); - } - - public function installStep5ToStep6(AcceptanceTester $I) - { - - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 6 of the Installation"); - $this->installStep4ToStep5($I); $I->fillField('u_name', 'admin'); $I->fillField('d_name', 'admin'); @@ -95,34 +78,21 @@ class InstallCest $I->click('submit'); + // Step 6 + $I->see("Website Preferences", 'h3'); - } - - public function installStep6ToStep7(AcceptanceTester $I) - { - - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 7 of the Installation"); - $this->installStep5ToStep6($I); - $I->fillField('sitename', 'Test Site'); $I->click('submit'); - $I->see("Install Confirmation", 'h3'); - } - - public function installStep7ToStep8(AcceptanceTester $I) - { - - $I->amOnPage('/install.php'); - $I->wantTo("Verify Proceed to Step 8 of the Installation"); - $this->installStep6ToStep7($I); + // Step 7 $I->see("Install Confirmation", 'h3'); $I->click('submit'); - $I->see("Install Confirmation", 'h3'); + // Step 8 + + $I->see("Installation Complete", 'h3'); } }