‪TYPO3CMS  11.5
PageCreationWithDragAndDropCest.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 
20 use Facebook\WebDriver\WebDriverKeys;
24 
29 {
30  protected static string ‪$treeNode = '#typo3-pagetree-tree .nodes .node';
31  protected static string ‪$dragNode = '#typo3-pagetree-toolbar .svg-toolbar__drag-node';
32  protected static string ‪$nodeEditInput = '.node-edit';
33 
35 
44  {
45  $this->pageTree = ‪$pageTree;
46  $I->useExistingSession('admin');
47  $I->click('List');
48  $I->waitForElement(static::$treeNode);
49  $I->waitForElement(static::$dragNode);
50  $this->pageTree->openPath(['styleguide TCA demo']);
51  // Wait until DOM actually rendered everything
52  $I->waitForElement('#typo3-pagetree-tree .nodes .node');
53  }
54 
61  {
62  $I->amGoingTo('create a new page below page without child pages using drag and drop');
63  $this->pageTree->dragAndDropNewPage('staticdata', static::$dragNode, static::$nodeEditInput);
64  }
65 
73  {
74  $I->amGoingTo('create a new page below page with child pages using drag and drop');
75  $this->pageTree->dragAndDropNewPage('styleguide TCA demo', static::$dragNode, static::$nodeEditInput);
76  }
77 
86  {
87  $mouse->‪dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('elements basic'));
88 
89  $I->waitForElementVisible(static::$nodeEditInput);
90  $I->seeElement(static::$nodeEditInput);
91  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ESCAPE);
92  $I->waitForElementNotVisible(static::$nodeEditInput);
93  }
94 
103  {
104  $mouse->‪dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('staticdata'));
105 
106  $I->waitForElementVisible(static::$nodeEditInput);
107  $I->seeElement(static::$nodeEditInput);
108 
109  // We can't use $I->fillField() here since this sends a clear() to the element
110  // which drops the node creation in the tree. So we do it manually with selenium.
111  ‪$nodeEditInput = static::$nodeEditInput;
112  $element = $I->executeInSelenium(static function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use (‪$nodeEditInput) {
113  return $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(‪$nodeEditInput));
114  });
115  $element->sendKeys('');
116 
117  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ENTER);
118  $I->waitForElementNotVisible(static::$nodeEditInput);
119  }
120 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop
Definition: PageCreationWithDragAndDropCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Mouse
Definition: Mouse.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageAndQuitPageCreation
‪dragAndDropNewPageAndQuitPageCreation(ApplicationTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:85
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$nodeEditInput
‪static string $nodeEditInput
Definition: PageCreationWithDragAndDropCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Mouse\dragAndDrop
‪dragAndDrop(string $source, string $target)
Definition: Mouse.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$dragNode
‪static string $dragNode
Definition: PageCreationWithDragAndDropCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: PageCreationWithDragAndDropCest.php:43
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageAndLeavePageTitleEmpty
‪dragAndDropNewPageAndLeavePageTitleEmpty(ApplicationTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:102
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithoutChildren
‪dragAndDropNewPageInNodeWithoutChildren(ApplicationTester $I)
Definition: PageCreationWithDragAndDropCest.php:60
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithChildren
‪dragAndDropNewPageInNodeWithChildren(ApplicationTester $I)
Definition: PageCreationWithDragAndDropCest.php:72
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$pageTree
‪PageTree $pageTree
Definition: PageCreationWithDragAndDropCest.php:34
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest
Definition: PageCreationWithDragAndDropCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\DragAndDrop\PageCreationWithDragAndDropCest\$treeNode
‪static string $treeNode
Definition: PageCreationWithDragAndDropCest.php:30