‪TYPO3CMS  ‪main
RecyclerModuleCest.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 
23 
25 {
28 
29  private static string ‪$rootPageTitle = 'styleguide TCA demo';
30  private static string ‪$treeNode = '#typo3-pagetree-tree .nodes-list [role="treeitem"]';
31  private static string ‪$dragNode = '#typo3-pagetree-toolbar .tree-toolbar__drag-node';
32  private static string ‪$nodeEditInput = '.node-edit';
33  private static string ‪$sysNoteSubject = 'Dummy Recycler Content';
34  private static string ‪$pageTitle = 'Dummy 1-styleguide TCA demo-new';
35 
37  {
38  $this->pageTree = ‪$pageTree;
39  $this->modalDialog = ‪$modalDialog;
40 
41  $I->useExistingSession('admin');
42  $I->click('List');
43  $I->waitForElement(self::$treeNode, 5);
44  $I->waitForElement(self::$dragNode, 5);
45  $this->pageTree->openPath([self::$rootPageTitle]);
46 
47  // Wait until DOM actually rendered everything
48  $I->waitForElement(self::$treeNode, 5);
49 
50  $I->switchToContentFrame();
51  $I->waitForElement('[title="Create new record"]');
52  $I->click('a[title="Create new record"]');
53  $I->click('//a[text()[normalize-space(.) = "Page (inside)"]]');
54  $I->fillField('//input[contains(@data-formengine-input-name, "data[pages]") and contains(@data-formengine-input-name, "[title]")]', self::$pageTitle);
55  $I->click('button[name="_savedok"]');
56 
57  $I->switchToIframe();
58  $newPage = $this->pageTree->getPageXPathByPageName(self::$pageTitle);
59  $I->waitForElement($newPage, 2);
60  $I->click($newPage);
61  $I->switchToContentFrame();
62  $I->waitForElement('[title="Create new record"]');
63  $I->click('a[title="Create new record"]');
64  $I->click('//a[text()[normalize-space(.) = "Internal note"]]');
65  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_note]") and contains(@data-formengine-input-name, "[subject]")]', self::$sysNoteSubject);
66  $I->click('button[name="_savedok"]');
67  $I->click('a[title="Close"]');
68  }
69 
71  {
72  $this->‪deletePage($I);
73  $this->‪goToRecyclerModule($I);
74 
75  // Select depth infinite
76  $I->wait(1);
77  $I->selectOption('select[name="depth"]', 999);
78 
79  $I->amGoingTo('See if the deleted page and its content appear in the recycler');
80  $I->waitForText(self::$pageTitle);
81  $I->waitForText(self::$sysNoteSubject);
82 
83  $I->amGoingTo('Recover the page and its contents');
84  $I->click('tr[data-recordtitle="' . self::$pageTitle . '"] .t3js-multi-record-selection-check');
85  $I->click('button[data-multi-record-selection-action="massundo"]');
86  $this->modalDialog->canSeeDialog();
87  $I->click('#undo-recursive');
88  $this->modalDialog->clickButtonInDialog('Recover');
89 
90  $I->amGoingTo('See if page and content got restored');
91  $I->switchToMainFrame();
92  $I->click('List');
93  $newPage = $this->pageTree->getPageXPathByPageName(self::$pageTitle);
94  $I->click($newPage);
95  $I->switchToContentFrame();
96  $I->wait(1);
97  $I->waitForText(self::$sysNoteSubject, 10, 'a[aria-label="Edit record"]');
98  }
99 
100  private function ‪deletePage(‪ApplicationTester $I): void
101  {
102  $I->switchToMainFrame();
103  $I->click('List');
104  $page = $this->pageTree->getPageXPathByPageName(self::$pageTitle);
105  $I->click($page);
106 
107  // Close all notifications to avoid click interceptions
108  $I->click('#alert-container .close');
109 
110  $I->switchToContentFrame();
111  $I->click('a[title="Edit page properties"]');
112  $I->click('a[title="Delete"]');
113  $this->modalDialog->clickButtonInDialog('Delete record (!)');
114  }
115 
116  private function ‪goToRecyclerModule(‪ApplicationTester $I): void
117  {
118  $I->switchToMainFrame();
119  $I->click('Recycler');
120  $I->waitForElement(self::$treeNode, 5);
121  $page = $this->pageTree->getPageXPathByPageName(self::$rootPageTitle);
122  $I->click($page);
123  $I->switchToContentFrame();
124  }
125 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$rootPageTitle
‪static string $rootPageTitle
Definition: RecyclerModuleCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\deletePage
‪deletePage(ApplicationTester $I)
Definition: RecyclerModuleCest.php:100
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\deleteAndRecoverRecords
‪deleteAndRecoverRecords(ApplicationTester $I)
Definition: RecyclerModuleCest.php:70
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler
Definition: RecyclerModuleCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$nodeEditInput
‪static string $nodeEditInput
Definition: RecyclerModuleCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$pageTitle
‪static string $pageTitle
Definition: RecyclerModuleCest.php:34
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$sysNoteSubject
‪static string $sysNoteSubject
Definition: RecyclerModuleCest.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$treeNode
‪static string $treeNode
Definition: RecyclerModuleCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$modalDialog
‪ModalDialog $modalDialog
Definition: RecyclerModuleCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$pageTree
‪PageTree $pageTree
Definition: RecyclerModuleCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\goToRecyclerModule
‪goToRecyclerModule(ApplicationTester $I)
Definition: RecyclerModuleCest.php:116
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\$dragNode
‪static string $dragNode
Definition: RecyclerModuleCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest
Definition: RecyclerModuleCest.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Recycler\RecyclerModuleCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree, ModalDialog $modalDialog)
Definition: RecyclerModuleCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:24