‪TYPO3CMS  10.4
PageCreationWithDragAndDropCest.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 
20 use Facebook\WebDriver\WebDriverKeys;
24 
29 {
33  protected static ‪$treeNode = '#typo3-pagetree-tree .nodes .node';
34 
38  protected static ‪$dragNode = '#svg-toolbar .svg-toolbar__drag-node';
39 
43  protected static ‪$nodeEditInput = '.node-edit';
44 
48  protected ‪$pageTree;
49 
57  public function ‪_before(‪BackendTester $I, ‪PageTree ‪$pageTree): void
58  {
59  $this->pageTree = ‪$pageTree;
60  $I->useExistingSession('admin');
61  $I->click('List');
62  $this->pageTree->openPath(['styleguide TCA demo']);
63  $I->waitForElement(static::$treeNode, 5);
64  $I->waitForElement(static::$dragNode, 5);
65  }
66 
73  {
74  $I->amGoingTo('create a new page below page without child pages using drag and drop');
75  $this->pageTree->dragAndDropNewPage('staticdata', static::$dragNode, static::$nodeEditInput);
76  }
77 
85  {
86  $I->amGoingTo('create a new page below page with child pages using drag and drop');
87  $this->pageTree->dragAndDropNewPage('styleguide TCA demo', static::$dragNode, static::$nodeEditInput);
88  }
89 
97  public function ‪dragAndDropNewPageAndQuitPageCreation(BackendTester $I, Mouse $mouse): void
98  {
99  $mouse->dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('elements basic'));
100 
101  $I->seeElement(static::$nodeEditInput);
102  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ESCAPE);
103  $I->waitForElementNotVisible(static::$nodeEditInput, 5);
104  }
105 
113  public function ‪dragAndDropNewPageAndLeavePageTitleEmpty(BackendTester $I, Mouse $mouse): void
114  {
115  $mouse->dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('staticdata'));
116 
117  $I->seeElement(static::$nodeEditInput);
118  $I->fillField(static::$nodeEditInput, '');
119  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ENTER);
120  $I->waitForElementNotVisible(static::$nodeEditInput, 5);
121  }
122 
131  protected function ‪dragAndDropNewPage(BackendTester $I, Mouse $mouse, int $targetPageId): void
132  {
133  $target = $this->‪getPageIdentifier($targetPageId);
134  $pageTitle = sprintf('Dummy 1-%d-new', $targetPageId);
135 
136  $mouse->dragAndDrop(static::$dragNode, $target);
137 
138  $I->seeElement(static::$nodeEditInput);
139  $I->fillField(static::$nodeEditInput, $pageTitle);
140  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ENTER);
141  $I->waitForElementNotVisible(static::$nodeEditInput);
142  $I->see($pageTitle);
143  }
144 
151  protected function ‪getPageIdentifier(int $pageId): string
152  {
153  return '#identifier-0_' . $pageId;
154  }
155 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageAndLeavePageTitleEmpty
‪dragAndDropNewPageAndLeavePageTitleEmpty(BackendTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:109
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest
Definition: PageCreationWithDragAndDropCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Mouse
Definition: Mouse.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$dragNode
‪static string $dragNode
Definition: PageCreationWithDragAndDropCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$treeNode
‪static string $treeNode
Definition: PageCreationWithDragAndDropCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\getPageIdentifier
‪string getPageIdentifier(int $pageId)
Definition: PageCreationWithDragAndDropCest.php:147
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPage
‪dragAndDropNewPage(BackendTester $I, Mouse $mouse, int $targetPageId)
Definition: PageCreationWithDragAndDropCest.php:127
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop
Definition: PageCreationWithDragAndDropCest.php:5
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageAndQuitPageCreation
‪dragAndDropNewPageAndQuitPageCreation(BackendTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:93
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Mouse\dragAndDrop
‪dragAndDrop(string $source, string $target)
Definition: Mouse.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$nodeEditInput
‪static string $nodeEditInput
Definition: PageCreationWithDragAndDropCest.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithChildren
‪dragAndDropNewPageInNodeWithChildren(BackendTester $I)
Definition: PageCreationWithDragAndDropCest.php:80
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\_before
‪_before(BackendTester $I, PageTree $pageTree)
Definition: PageCreationWithDragAndDropCest.php:53
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$pageTree
‪PageTree $pageTree
Definition: PageCreationWithDragAndDropCest.php:44
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithoutChildren
‪dragAndDropNewPageInNodeWithoutChildren(BackendTester $I)
Definition: PageCreationWithDragAndDropCest.php:68