diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php deleted file mode 100644 index 587d0a53c1d6a449408a2e53aac882bad6d1525b..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; - -/* - * 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\Kasper; - -/** - * Acceptance test - */ -class AdminCest -{ - - /** - * Login a admin user and logout again - * - * @param Kasper $I - */ - public function tryToTest(Kasper $I) - { - $I->wantTo('login with admin'); - $I->loginAsAdmin(); - - // user is redirected to 'about modules' after login, and must see the 'admin tools' section - $I->see('Admin tools'); - - $I->logout(); - $I->waitForElement('#t3-username'); - } -} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/BackendLoginCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/BackendLoginCest.php new file mode 100644 index 0000000000000000000000000000000000000000..61984f8be3b83c83fad44fa6071f3f99459a0f48 --- /dev/null +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Login/BackendLoginCest.php @@ -0,0 +1,163 @@ +<?php +namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; + +/* + * 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\Support\Helper\Topbar; + +/** + * Various backend login related tests + */ +class BackendLoginCest +{ + /** + * Call backend login page and verify login button changes color on mouse over, + * verifies page is available and CSS is properly loaded. + * + * @param \AcceptanceTester $I + */ + public function loginButtonMouseOver(\AcceptanceTester $I) + { + $I->wantTo('check login functions'); + $I->amOnPage('/typo3/index.php'); + $I->waitForElement('#t3-username', 10); + $I->wantTo('mouse over css change login button'); + + // Make sure mouse is not over submit button from a previous test + $I->moveMouseOver('#t3-username'); + $bs = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { + return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); + }); + + $I->moveMouseOver('#t3-login-submit'); + $I->wait(1); + $bsmo = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { + return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); + }); + $I->assertFalse($bs === $bsmo); + } + + /** + * Call backend login page and submit invalid login data. + * Verifies login is not accepted and an error message is rendered. + * + * @param \AcceptanceTester $I + */ + public function loginDeniedWithInvalidCredentials(\AcceptanceTester $I) + { + $I->wantTo('check login functions'); + $I->amOnPage('/typo3/index.php'); + $I->waitForElement('#t3-username'); + + $I->wantTo('check empty credentials'); + $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { + return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-username'))->getAttribute('required'); + }); + $I->assertEquals('true', $required, '#t3-username'); + + $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { + return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-password'))->getAttribute('required'); + }); + $I->assertEquals('true', $required, '#t3-password'); + + $I->wantTo('use bad credentials'); + $I->fillField('#t3-username', 'testify'); + $I->fillField('#t3-password', '123456'); + $I->click('#t3-login-submit-section > button'); + $I->waitForText('Verifying Login Data'); + $I->waitForElement('#t3-login-error'); + $I->see('Your login attempt did not succeed'); + } + + /** + * Login a admin user and logout again + * + * @param \AcceptanceTester $I + */ + public function loginWorksAsAdminUser(\AcceptanceTester $I) + { + $I->wantTo('login with admin'); + $this->login($I, 'admin', 'password'); + + // user is redirected to 'about modules' after login, and must see the 'admin tools' section + $I->see('Admin tools'); + + $this->logout($I); + $I->waitForElement('#t3-username'); + } + + /** + * Login as a non-admin user, check visible modules and logout again + * + * @param \AcceptanceTester $I + */ + public function loginWorksAsEditorUser(\AcceptanceTester $I) + { + $this->login($I, 'editor', 'password'); + + // user is redirected to 'about modules' after login, but must not see the 'admin tools' section + $I->cantSee('Admin tools', '#typo3-menu'); + + $topBarItemSelector = Topbar::$containerSelector . ' ' . Topbar::$dropdownToggleSelector . ' *'; + + // can see bookmarks + $I->seeElement($topBarItemSelector, ['title' => 'Bookmarks']); + + // cant see clear cache + $I->cantSeeElement($topBarItemSelector, ['title' => 'Clear cache']); + + $this->logout($I); + $I->waitForElement('#t3-username'); + } + + /** + * Helper method for user login on backend login screen + * + * @param \AcceptanceTester $I + * @param string $username + * @param string $password + * @return void + */ + protected function login(\AcceptanceTester $I, string $username, string $password) + { + $I->amGoingTo('Step\Backend\Login username: ' . $username); + $I->amOnPage('/typo3/index.php'); + $I->waitForElement('#t3-username'); + $I->fillField('#t3-username', $username); + $I->fillField('#t3-password', $password); + $I->click('#t3-login-submit-section > button'); + // wait for the next to element to indicate if the backend was loaded successful + $I->waitForElement('.nav', 30); + $I->waitForElement('#typo3-contentContainer iframe', 30); + $I->seeCookie('be_lastLoginProvider'); + $I->seeCookie('be_typo_user'); + } + + /** + * Logout user by clicking logout button in toolbar + * + * @param \AcceptanceTester $I + * @return void + */ + protected function logout(\AcceptanceTester $I) + { + $I->amGoingTo('step backend login'); + $I->amGoingTo('logout'); + // ensure that we are on the main frame + $I->switchToIFrame(); + $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a'); + $I->click('Logout'); + $I->waitForElement('#t3-username'); + } +} \ No newline at end of file diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php deleted file mode 100644 index 4afe49c4ed4639fd6a61cb343e90061ef85b0984..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; - -/* - * 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\Kasper; - -/** - * Acceptance test - */ -class BadCredentialsCest -{ - - /** - * Call backend login page and submit invalid login data. - * Verifies login is not accepted and an error message is rendered. - * - * @param Kasper $I - */ - public function tryToTest(Kasper $I) - { - $I->wantTo('check login functions'); - $I->amOnPage('/typo3/index.php'); - $I->waitForElement('#t3-username'); - - $I->wantTo('check empty credentials'); - $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-username'))->getAttribute('required'); - }); - $I->assertEquals('true', $required, '#t3-username'); - - $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-password'))->getAttribute('required'); - }); - $I->assertEquals('true', $required, '#t3-password'); - - $I->wantTo('use bad credentials'); - $I->fillField('#t3-username', 'testify'); - $I->fillField('#t3-password', '123456'); - $I->click('#t3-login-submit-section > button'); - $I->waitForText('Verifying Login Data'); - $I->waitForElement('#t3-login-error'); - $I->see('Your login attempt did not succeed'); - } -} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php deleted file mode 100644 index d5920aa92228f7eb5a5420d78e1f066c07fe546d..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; - -/* - * 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\Kasper; -use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar; - -/** - * Editor login tests - */ -class EditorCest -{ - /** - * Login as a non-admin user, check visible modules and logout again - * - * @param Kasper $I - */ - public function loginAsEditor(Kasper $I) - { - $I->loginAsEditor(); - - // user is redirected to 'about modules' after login, but must not see the 'admin tools' section - $I->cantSee('Admin tools', '#typo3-menu'); - - $topBarItemSelector = Topbar::$containerSelector . ' ' . Topbar::$dropdownToggleSelector . ' *'; - - // can see bookmarks - $I->seeElement($topBarItemSelector, ['title' => 'Bookmarks']); - - // cant see clear cache - $I->cantSeeElement($topBarItemSelector, ['title' => 'Clear cache']); - - $I->logout(); - $I->waitForElement('#t3-username'); - } -} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php deleted file mode 100644 index 1aeb17cdb48cca6a6bcab1554464fb0f25738db0..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; - -/* - * 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\Kasper; - -/** - * Acceptance test - */ -class MouseOverCest -{ - - /** - * Call backend login page and verify login button changes color on mouse over, - * verifies page is available and CSS is properly loaded. - * - * @param Kasper $I - */ - public function tryToTest(Kasper $I) - { - $I->wantTo('check login functions'); - $I->amOnPage('/typo3/index.php'); - $I->waitForElement('#t3-username', 10); - $I->wantTo('mouse over css change login button'); - - // Make sure mouse is not over submit button from a previous test - $I->moveMouseOver('#t3-username'); - $bs = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); - }); - - $I->moveMouseOver('#t3-login-submit'); - $I->wait(1); - $bsmo = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); - }); - $I->assertFalse($bs === $bsmo); - } -} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php index 924db8a27e83fc7c304357270a2a123f0931a571..1a9f5a3599f782057ee3da25fa2e562c97794b9f 100644 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php @@ -17,8 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page; use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin; /** - * This testcase is used to check if a page can be added with the page module. - * It also tests to remove the new page with the page tree context menu. + * Page and page tree related tests. */ class AddPageInPageModuleCest { @@ -32,9 +31,12 @@ class AddPageInPageModuleCest } /** + * This test case is used to check if a page can be added with the page module. + * It also tests to remove the new page with the page tree context menu. + * * @param Admin $I */ - public function tryToTest(Admin $I) + public function addAndDeletePage(Admin $I) { // Select page module $I->wantToTest('Add a page with page module'); diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/UsernameOnAvatarCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/UsernameOnAvatarCest.php index 4c913cf491f02498a6ac3f25d8f5c4226b0b2b35..b412d587d3cfe56300e7bc8cb4d1349b278904bd 100644 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/UsernameOnAvatarCest.php +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/UsernameOnAvatarCest.php @@ -17,7 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar; use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin; /** - * This test case is used to check if username is visible in the toolbar. + * Topbar username and avatar module tests. */ class UsernameOnAvatarCest { @@ -31,9 +31,11 @@ class UsernameOnAvatarCest } /** + * This test case is used to check if username is visible in the toolbar. + * * @param Admin $I */ - public function tryToTest(Admin $I) + public function usernameIsShown(Admin $I) { $I->see('admin', '#typo3-cms-backend-backend-toolbaritems-usertoolbaritem'); } diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php deleted file mode 100644 index 110aa7bd61487bbee75f91a2126787e4e0ea584c..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend; - -/* - * 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! - */ - -class Kasper extends \AcceptanceTester -{ - /** - * Login as user "admin" with password "password". - * This user was added as fixture during test bootstrap. - * - * @return void - */ - public function loginAsAdmin() - { - $I = $this; - $I->login('admin', 'password'); - } - - /** - * Login as user "editor" with password "passowrd". - * This user was added as fixture during test bootsrap. - * - * @return void - */ - public function loginAsEditor() - { - $I = $this; - $I->login('editor', 'password'); - } - - /** - * Logout user by clicking logout button in toolbar - * - * @return void - */ - public function logout() - { - $I = $this; - $I->amGoingTo('step backend login'); - $I->amGoingTo('logout'); - // ensure that we are on the main frame - $I->switchToIFrame(); - $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a'); - $I->click('Logout'); - $I->waitForElement('#t3-username'); - } - - /** - * Helper method for user login. - * - * @param string $username - * @param string $password - */ - protected function login(string $username, string $password) - { - $I = $this; - $I->amGoingTo('Step\Backend\Login username: ' . $username); - $I->amOnPage('/typo3/index.php'); - $I->waitForElement('#t3-username'); - $I->fillField('#t3-username', $username); - $I->fillField('#t3-password', $password); - $I->click('#t3-login-submit-section > button'); - // wait for the next to element to indicate if the backend was loaded successful - $I->waitForElement('.nav', 30); - $I->waitForElement('#typo3-contentContainer iframe', 30); - $I->seeCookie('be_lastLoginProvider'); - $I->seeCookie('be_typo_user'); - } -}