‪TYPO3CMS  11.5
PageModuleCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
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 
19 
22 
28 {
29  public function ‪_before(‪ApplicationTester $I): void
30  {
31  $I->useExistingSession('admin');
32  }
33 
35  {
36  // Select the root page
37  $I->switchToMainFrame();
38  $I->click('Page');
39  $I->waitForElement('#typo3-pagetree-tree .nodes .node');
40  // click on PID=0
41  $I->clickWithLeftButton('#identifier-0_0 text.node-name');
42  $I->switchToContentFrame();
43  $I->canSee('Web>Page module', 'h4');
44  }
45 
46  public function ‪editPageTitle(‪ApplicationTester $I, ‪PageTree $pageTree): void
47  {
48  $currentPageTitle = 'styleguide TCA demo';
49  $newPageTitle = 'styleguide TCA demo page';
50 
51  $I->switchToMainFrame();
52  $I->click('Page');
53  $I->waitForElement('#typo3-pagetree-tree .nodes .node');
54  $pageTree->‪openPath([$currentPageTitle]);
55  $I->switchToContentFrame();
56 
57  // Rename the page
58  $this->‪renamePage($I, $currentPageTitle, $newPageTitle);
59 
60  // Now recover the old page title
61  $this->‪renamePage($I, $newPageTitle, $currentPageTitle);
62  }
63 
64  private function ‪renamePage(‪ApplicationTester $I, string $oldTitle, string $newTitle): void
65  {
66  $editLinkSelector = 'button[data-action="edit"]';
67  $inputFieldSelector = 'input[class*="t3js-title-edit-input"]';
68 
69  $I->waitForText($oldTitle, 10, 'h1');
70  $I->moveMouseOver('.t3js-title-inlineedit');
71 
72  $I->comment('Activate inline edit of page title');
73  $I->waitForElement($editLinkSelector);
74  $I->click($editLinkSelector);
75  $I->waitForElement($inputFieldSelector);
76 
77  $I->comment('Set new value and save');
78  $I->fillField($inputFieldSelector, $newTitle);
79  $I->click('button[data-action="submit"]');
80 
81  $I->comment('See the new page title');
82  $I->waitForElementNotVisible($inputFieldSelector);
83  $I->waitForText($newTitle, 5, 'h1');
84  }
85 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page\PageModuleCest
Definition: PageModuleCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree\openPath
‪openPath(array $path)
Definition: PageTree.php:76
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page\PageModuleCest\renamePage
‪renamePage(ApplicationTester $I, string $oldTitle, string $newTitle)
Definition: PageModuleCest.php:64
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page
Definition: AddPageInPageModuleCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page\PageModuleCest\checkThatPageModuleHasAHeadline
‪checkThatPageModuleHasAHeadline(ApplicationTester $I)
Definition: PageModuleCest.php:34
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page\PageModuleCest\_before
‪_before(ApplicationTester $I)
Definition: PageModuleCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Page\PageModuleCest\editPageTitle
‪editPageTitle(ApplicationTester $I, PageTree $pageTree)
Definition: PageModuleCest.php:46
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:31