[BUGFIX] Do not create default export of AjaxDataHandler class
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Page / PageModuleCest.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
19 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
20
21 /**
22 * This testcase is used to check if the expected information is found when
23 * the page module was opened.
24 */
25 class PageModuleCest
26 {
27 /**
28 * @param BackendTester $I
29 */
30 public function _before(BackendTester $I)
31 {
32 $I->useExistingSession('admin');
33 }
34
35 /**
36 * @param BackendTester $I
37 */
38 public function checkThatPageModuleHasAHeadline(BackendTester $I)
39 {
40 $I->click('Page');
41 $I->switchToContentFrame();
42 $I->canSee('Web>Page module', 'h4');
43 }
44
45 /**
46 * @param BackendTester $I
47 * @param PageTree $pageTree
48 */
49 public function editPageTitle(BackendTester $I, PageTree $pageTree): void
50 {
51 $currentPageTitle = 'styleguide TCA demo';
52 $newPageTitle = 'styleguide TCA demo page';
53
54 $I->click('Page');
55 $pageTree->openPath([$currentPageTitle]);
56 $I->switchToContentFrame();
57
58 // Rename the page
59 $this->renamePage($I, $currentPageTitle, $newPageTitle);
60
61 // Now recover the old page title
62 $this->renamePage($I, $newPageTitle, $currentPageTitle);
63 }
64
65 /**
66 * @param BackendTester $I
67 * @param string $oldTitle
68 * @param string $newTitle
69 */
70 private function renamePage(BackendTester $I, string $oldTitle, string $newTitle)
71 {
72 $editLinkSelector = 'a[data-action="edit"]';
73 $inputFieldSelector = 'input[class*="t3js-title-edit-input"]';
74
75 $I->canSee($oldTitle, 'h1');
76 $I->moveMouseOver('.t3js-title-inlineedit');
77
78 $I->comment('Activate inline edit of page title');
79 $I->seeElement($editLinkSelector);
80 $I->click($editLinkSelector);
81 $I->seeElement($inputFieldSelector);
82
83 $I->comment('Set new value and save');
84 $I->fillField($inputFieldSelector, $newTitle);
85 $I->click('button[data-action="submit"]');
86
87 $I->comment('See the new page title');
88 $I->waitForElementNotVisible($inputFieldSelector);
89 $I->canSee($newTitle, 'h1');
90 }
91 }