‪TYPO3CMS  10.4
PageTreeFilterCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 /*
8  * This file is part of the TYPO3 CMS project.
9  *
10  * It is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License, either version 2
12  * of the License, or any later version.
13  *
14  * For the full copyright and license information, please read the
15  * LICENSE.txt file that was distributed with this source code.
16  *
17  * The TYPO3 project - inspiring people to share!
18  */
19 
23 
25 {
26  protected ‪$filterInputFieldClearButton = '#typo3-pagetree #svg-toolbar span[data-identifier=actions-close]';
27  protected ‪$filterButton = '#typo3-pagetree #svg-toolbar button[data-tree-icon=actions-filter]';
28  protected ‪$filterInputField = '#typo3-pagetree #svg-toolbar .search-input';
29  protected ‪$pageTreeReloadButton = '#typo3-pagetree #svg-toolbar button[data-tree-icon=actions-refresh]';
30  protected ‪$inPageTree = '#typo3-pagetree-treeContainer .nodes';
31 
32  public function ‪_before(‪BackendTester $I, ‪PageTree $pageTree)
33  {
34  $I->useExistingSession('admin');
35  $I->click('List');
36 
37  $pageTree->openPath(['styleguide TCA demo']);
38  $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
39  }
40 
47  {
48  $I->click($this->filterButton);
49  $I->cantSeeElement($this->filterInputFieldClearButton);
50 
51  $I->fillField($this->filterInputField, 'Group');
53 
54  $I->amGoingTo('prove filter reset button is visible upon input');
55  $I->canSeeElement($this->filterInputFieldClearButton);
56 
57  // [#91884] no Enter key press on purpose. The search should start by itself without additional Enter key press
58  // and this assertion makes sure the filter worked
59  $I->cantSee('inline expandsingle', $this->inPageTree);
60 
61  $I->canSee('elements group', $this->inPageTree);
62  $I->canSee('inline mngroup', $this->inPageTree);
63 
64  // [#91883] this happens, when translated pages are also part of the result set
65  $I->amGoingTo('prove translated pages are not shown in the filtered page tree');
66  $I->cantSee('inline mngroup - language 3', $this->inPageTree);
67 
68  $I->click($this->pageTreeReloadButton);
70 
71  // [#91885] filter must still apply after page tree reload
72  $I->amGoingTo('prove the filter applies after page tree reload');
73  $I->cantSee('flex', $this->inPageTree);
74  $I->seeInField($this->filterInputField, 'Group');
75  }
76 
81  {
82  $I->click($this->filterButton);
83  $I->fillField($this->filterInputField, 'Group');
85 
86  $I->canSee('elements group', $this->inPageTree);
87  $I->canSee('inline mngroup', $this->inPageTree);
88  $I->cantSee('inline expandsingle', $this->inPageTree);
89 
90  $I->click($this->filterInputFieldClearButton);
92 
93  $I->canSee('elements group', $this->inPageTree);
94  $I->canSee('inline mngroup', $this->inPageTree);
95  $I->canSee('inline expandsingle', $this->inPageTree);
96  }
97 
105  {
106  $I->click($this->filterButton);
107  $I->fillField($this->filterInputField, 'Group');
109 
110  $I->canSee('elements group', $this->inPageTree);
111  $I->canSee('inline mngroup', $this->inPageTree);
112 
113  $I->clickWithRightButton('//*[text()=\'inline mn\']');
114 
115  $I->canSeeElement('#contentMenu0');
116  $I->click('Delete', '#contentMenu0');
117 
118  // don't use $modalDialog->clickButtonInDialog due to too low timeout
119  $modalDialog->canSeeDialog();
120  $I->click('button[name="delete"]', ModalDialog::$openedModalButtonContainerSelector);
121  $I->waitForElementNotVisible(ModalDialog::$openedModalSelector, 30);
123 
124  $I->canSee('elements group', $this->inPageTree);
125  $I->cantSee('inline mngroup', $this->inPageTree);
126  $I->cantSee('inline expandsingle', $this->inPageTree);
127  }
128 
132  protected function ‪clearPageTreeFilters(
134  ): void {
135  $I->click($this->filterInputFieldClearButton);
136  $I->click($this->pageTreeReloadButton);
137  $I->cantSeeElement($this->filterInputFieldClearButton);
138  }
139 
143  protected function ‪waitForAjaxRequestToFinish(‪BackendTester $I): void
144  {
145  $I->waitForJS('return $.active == 0;', 10);
146  // sometimes rendering is still slower that ajax being finished.
147  $I->wait(0.5);
148  }
149 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\$pageTreeReloadButton
‪$pageTreeReloadButton
Definition: PageTreeFilterCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\$inPageTree
‪$inPageTree
Definition: PageTreeFilterCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\deletingPageWithFilterAppliedRespectsFilterUponPageTreeReload
‪deletingPageWithFilterAppliedRespectsFilterUponPageTreeReload(BackendTester $I, ModalDialog $modalDialog)
Definition: PageTreeFilterCest.php:104
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\$filterInputFieldClearButton
‪$filterInputFieldClearButton
Definition: PageTreeFilterCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\$filterButton
‪$filterButton
Definition: PageTreeFilterCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\clearPageTreeFilters
‪clearPageTreeFilters(BackendTester $I)
Definition: PageTreeFilterCest.php:132
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\filterTreeForPage
‪filterTreeForPage(BackendTester $I)
Definition: PageTreeFilterCest.php:46
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\_before
‪_before(BackendTester $I, PageTree $pageTree)
Definition: PageTreeFilterCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest
Definition: PageTreeFilterCest.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\waitForAjaxRequestToFinish
‪waitForAjaxRequestToFinish(BackendTester $I)
Definition: PageTreeFilterCest.php:143
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\clearFilterReloadsPageTreeWithoutFilterApplied
‪clearFilterReloadsPageTreeWithoutFilterApplied(BackendTester $I)
Definition: PageTreeFilterCest.php:80
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\PageTreeFilterCest\$filterInputField
‪$filterInputField
Definition: PageTreeFilterCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27