diff --git a/typo3/sysext/core/Build/Configuration/Acceptance/Support/AcceptanceTester.php b/typo3/sysext/core/Build/Configuration/Acceptance/Support/AcceptanceTester.php index bfa59cbb658eb1c7ef60f3d01acdcc7b45090c0f..83390a4ccedfb393b99a3b304d1fd9f7fd2ce545 100644 --- a/typo3/sysext/core/Build/Configuration/Acceptance/Support/AcceptanceTester.php +++ b/typo3/sysext/core/Build/Configuration/Acceptance/Support/AcceptanceTester.php @@ -20,7 +20,38 @@ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; - /** - * Define custom actions here - */ + /** + * The session cookie that is used if the session is injected. + * This session must exist in the database fixture to get a logged in state. + * + * @var string + */ + protected $sessionCookie = ''; + + /** + * Use the existing database session from the fixture by setting the backend user cookie + */ + public function useExistingSession() + { + $I = $this; + $I->amOnPage('/typo3/index.php'); + + // @todo: There is a bug in PhantomJS where adding a cookie fails. + // This bug will be fixed in the next PhantomJS version but i also found + // this workaround. First reset / delete the cookie and than set it and catch + // the webdriver exception as the cookie has been set successful. + try { + $I->resetCookie('be_typo_user'); + $I->setCookie('be_typo_user', $this->sessionCookie); + } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) { + } + try { + $I->resetCookie('be_lastLoginProvider'); + $I->setCookie('be_lastLoginProvider', '1433416747'); + } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) { + } + + // reload the page to have a logged in backend + $I->amOnPage('/typo3/index.php'); + } } diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/CheckExtensionmanagerListCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/CheckExtensionmanagerListCest.php deleted file mode 100644 index 31bc10a28d07385c1216a00d6313be56a7f7fc57..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/CheckExtensionmanagerListCest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Extensionmanager; - -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin; - -/** - * Extensionmanager list view - */ -class CheckExtensionmanagerListCest -{ - public function _before(Admin $I) - { - $I->useExistingSession(); - } - - /** - * Check extension styleguide is there - * - * @param Admin $I - */ - public function checkExtensionSyleguideIsListed(Admin $I) - { - $I->wantTo('check extension styleguide is there'); - $I->click('Extensions'); - - // Load frame set extensionmanager - $I->waitForElement('#typo3-contentContainerWrapper'); - - $I->switchToIFrame('content'); - - $extKey = 'Styleguide'; - // Fill extension search field - $I->fillField('Tx_Extensionmanager_extensionkey', $extKey); - - // Wait for search result - $I->waitForElement('#typo3-extension-list_wrapper'); - - // Look for extension key - $I->waitForText($extKey); - } -} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/InstalledExtensionsCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/InstalledExtensionsCest.php new file mode 100644 index 0000000000000000000000000000000000000000..92d92dfae5f189fca2fa426aede61f033afa048e --- /dev/null +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Extensionmanager/InstalledExtensionsCest.php @@ -0,0 +1,120 @@ +<?php +namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Extensionmanager; + +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +use Facebook\WebDriver\Remote\DriverCommand; +use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin; + +/** + * Tests for the "Install list view" of the extension manager + */ +class InstalledExtensionsCest +{ + /** + * @param Admin $I + */ + public function _before(Admin $I) + { + $I->useExistingSession(); + + // clear the localstorage to fix problems in phantomJs where the search + // sometimes is preserved over multiple sessions + $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) { + $webDriver->executeScript('localStorage.clear();'); + }); + + $I->click('Extensions', '#typo3-module-menu'); + $I->switchToIFrame('content'); + $I->waitForElementVisible('#typo3-extension-list'); + } + + /** + * @param Admin $I + */ + public function checkSearchFiltersList(Admin $I) + { + $I->canSeeNumberOfElements('#typo3-extension-list tbody tr[role="row"]', [10, 100]); + + // Fill extension search field + $I->fillField('Tx_Extensionmanager_extensionkey', 'cshmanual'); + + // see 2 rows. 1 for the header and one for the result + $I->canSeeNumberOfElements('#typo3-extension-list tbody tr[role="row"]', 1); + + // Look for extension key + $I->canSee('cshmanual', '#typo3-extension-list tbody tr[role="row"] td'); + + // unset the filter + $I->waitForElementVisible('#Tx_Extensionmanager_extensionkey ~button.close', 1); + $I->click('#Tx_Extensionmanager_extensionkey ~button.close'); + + $I->canSeeNumberOfElements('#typo3-extension-list tbody tr[role="row"]', [10, 100]); + } + + /** + * @param Admin $I + */ + public function checkIfUploadFormAppears(Admin $I) + { + $I->cantSeeElement('.module-body .uploadForm'); + $I->click('a[title="Upload Extension .t3x/.zip"]', '.module-docheader'); + $I->seeElement('.module-body .uploadForm'); + } + + /** + * @param Admin $I + * @return Admin + */ + public function checkIfInstallingAnExtensionWithBackendModuleAddsTheModuleToTheModuleMenu(Admin $I) { + $I->switchToIFrame(); + $I->canSeeElement('.typo3-module-menu-item'); + $I->cantSeeElement('#system_BeuserTxBeuser'); + + $I->switchToIFrame('content'); + $I->fillField('Tx_Extensionmanager_extensionkey', 'beuser'); + $I->waitForElementVisible('//*[@id="typo3-extension-list"]/tbody/tr[@id="beuser"]'); + $I->click('a[data-original-title="Activate"]', '//*[@id="typo3-extension-list"]/tbody/tr[@id="beuser"]'); + + $I->waitForElementVisible('#Tx_Extensionmanager_extensionkey ~button.close', 1); + $I->click('#Tx_Extensionmanager_extensionkey ~button.close'); + + $I->switchToIFrame(); + $I->canSeeElement('#system_BeuserTxBeuser'); + + + return $I; + } + + /** + * @depends checkIfInstallingAnExtensionWithBackendModuleAddsTheModuleToTheModuleMenu + * @param Admin $I + */ + public function checkIfUninstallingAnExtensionWithBackendModuleRemovesTheModuleFromTheModuleMenu(Admin $I) + { + $I->switchToIFrame(); + $I->canSeeElement('#system_BeuserTxBeuser'); + + $I->switchToIFrame('content'); + $I->fillField('Tx_Extensionmanager_extensionkey', 'beuser'); + $I->waitForElementVisible('//*[@id="typo3-extension-list"]/tbody/tr[@id="beuser"]'); + $I->click('a[data-original-title="Deactivate"]', '//*[@id="typo3-extension-list"]/tbody/tr[@id="beuser"]'); + + $I->waitForElementVisible('#Tx_Extensionmanager_extensionkey ~button.close', 1); + $I->click('#Tx_Extensionmanager_extensionkey ~button.close'); + + $I->switchToIFrame(); + $I->cantSeeElement('#system_BeuserTxBeuser'); + } +} diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php index 99c0cd7e096bf56254e7c5588f938eee7d98e3dc..b11595d2757680b7f74e2acc0ba247492d65ef31 100644 --- a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php +++ b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php @@ -20,34 +20,10 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend; class Admin extends \AcceptanceTester { /** - * @var string Assigned session cookie + * The session cookie that is used if the session is injected. + * This session must exist in the database fixture to get a logged in state. + * + * @var string */ protected $sessionCookie = '886526ce72b86870739cc41991144ec1'; - - /** - * Use the existing database session from the fixture by setting the backend user cookie - */ - public function useExistingSession() - { - $I = $this; - $I->amOnPage('/typo3/index.php'); - - // @todo: There is a bug in PhantomJS where adding a cookie fails. - // This bug will be fixed in the next PhantomJS version but i also found - // this workaround. First reset / delete the cookie and than set it and catch - // the webdriver exception as the cookie has been set successful. - try { - $I->resetCookie('be_typo_user'); - $I->setCookie('be_typo_user', $this->sessionCookie); - } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) { - } - try { - $I->resetCookie('be_lastLoginProvider'); - $I->setCookie('be_lastLoginProvider', '1433416747'); - } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) { - } - - // reload the page to have a logged in backend - $I->amOnPage('/typo3/index.php'); - } } diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php index 6cb487dd8a5d84bea051a32ff8de8a666fc1033e..6b76254333c1be475aa09109508a41174b4ddc09 100644 --- a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php +++ b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php @@ -20,20 +20,10 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend; class Editor extends \AcceptanceTester { /** - * @var string Assigned session cookie + * The session cookie that is used if the session is injected. + * This session must exist in the database fixture to get a logged in state. + * + * @var string */ protected $sessionCookie = 'ff83dfd81e20b34c27d3e97771a4525a'; - - /** - * Use the existing database session from the fixture by setting the backend user cookie - */ - public function useExistingSession() - { - $I = $this; - $I->amOnPage('/typo3/index.php'); - $I->setCookie('be_typo_user', $this->sessionCookie, array('path' => '/typo3temp/var/tests/acceptance/')); - $I->setCookie('be_lastLoginProvider', '1433416747', array('path' => '/typo3temp/var/tests/acceptance/')); - // reload the page to have a logged in backend - $I->amOnPage('/typo3/index.php'); - } }