[BUGFIX] Fix output of DebugUtility
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Step / Backend / Kasper.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 class Kasper extends \AcceptanceTester
18 {
19 /**
20 * Login as user "admin" with password "password".
21 * This user was added as fixture during test bootstrap.
22 *
23 * @return void
24 */
25 public function loginAsAdmin()
26 {
27 $I = $this;
28 $I->login('admin', 'password');
29 }
30
31 /**
32 * Login as user "editor" with password "passowrd".
33 * This user was added as fixture during test bootsrap.
34 *
35 * @return void
36 */
37 public function loginAsEditor()
38 {
39 $I = $this;
40 $I->login('editor', 'password');
41 }
42
43 /**
44 * Logout user by clicking logout button in toolbar
45 *
46 * @return void
47 */
48 public function logout()
49 {
50 $I = $this;
51 $I->amGoingTo('step backend login');
52 $I->amGoingTo('logout');
53 // ensure that we are on the main frame
54 $I->switchToIFrame();
55 $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a');
56 $I->click('Logout');
57 $I->waitForElement('#t3-username');
58 }
59
60 /**
61 * Helper method for user login.
62 *
63 * @param string $username
64 * @param string $password
65 */
66 protected function login(string $username, string $password)
67 {
68 $I = $this;
69 $I->amGoingTo('Step\Backend\Login username: ' . $username);
70 $I->amOnPage('/typo3/index.php');
71 $I->waitForElement('#t3-username');
72 $I->fillField('#t3-username', $username);
73 $I->fillField('#t3-password', $password);
74 $I->click('#t3-login-submit-section > button');
75 // wait for the next to element to indicate if the backend was loaded successful
76 $I->waitForElement('.nav', 30);
77 $I->waitForElement('#typo3-contentContainer iframe', 30);
78 $I->seeCookie('be_lastLoginProvider');
79 $I->seeCookie('be_typo_user');
80 }
81 }