‪TYPO3CMS  ‪main
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  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 
35 
40  {
41  $this->pageTree = ‪$pageTree;
42  $I->useExistingSession('admin');
43  $I->click('List');
44  $I->waitForElement(static::$treeNode);
45  $I->waitForElement(static::$dragNode);
46  $this->pageTree->openPath(['styleguide TCA demo']);
47  }
48 
53  {
54  $I->amGoingTo('create a new page below page without child pages using drag and drop');
55  $this->pageTree->dragAndDropNewPage('staticdata', static::$dragNode, static::$nodeEditInput);
56  }
57 
62  {
63  $I->amGoingTo('create a new page below page with child pages using drag and drop');
64  $this->pageTree->dragAndDropNewPage('styleguide TCA demo', static::$dragNode, static::$nodeEditInput);
65  }
66 
71  {
72  $mouse->‪dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('elements basic'));
73 
74  $I->waitForElementVisible(static::$nodeEditInput);
75  $I->seeElement(static::$nodeEditInput);
76  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ESCAPE);
77  $I->waitForElementNotVisible(static::$nodeEditInput);
78  }
79 
84  {
85  $mouse->‪dragAndDrop(static::$dragNode, $this->pageTree->getPageXPathByPageName('staticdata'));
86 
87  $I->waitForElementVisible(static::$nodeEditInput);
88  $I->seeElement(static::$nodeEditInput);
89 
90  // We can't use $I->fillField() here since this sends a clear() to the element
91  // which drops the node creation in the tree. So we do it manually with selenium.
92  ‪$nodeEditInput = static::$nodeEditInput;
93  $element = $I->executeInSelenium(static function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use (‪$nodeEditInput) {
94  return $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector(‪$nodeEditInput));
95  });
96  $element->sendKeys('');
97 
98  $I->pressKey(static::$nodeEditInput, WebDriverKeys::ENTER);
99  $I->waitForElementNotVisible(static::$nodeEditInput);
100  }
101 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Mouse
Definition: Mouse.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithoutChildren
‪dragAndDropNewPageInNodeWithoutChildren(ApplicationTester $I)
Definition: PageCreationWithDragAndDropCest.php:52
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\dragAndDropNewPageAndLeavePageTitleEmpty
‪dragAndDropNewPageAndLeavePageTitleEmpty(ApplicationTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:83
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree
Definition: PageCreationWithDragAndDropCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\dragAndDropNewPageInNodeWithChildren
‪dragAndDropNewPageInNodeWithChildren(ApplicationTester $I)
Definition: PageCreationWithDragAndDropCest.php:61
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: PageCreationWithDragAndDropCest.php:39
‪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\PageCreationWithDragAndDropCest\$treeNode
‪static string $treeNode
Definition: PageCreationWithDragAndDropCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\$dragNode
‪static string $dragNode
Definition: PageCreationWithDragAndDropCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest
Definition: PageCreationWithDragAndDropCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\$pageTree
‪PageTree $pageTree
Definition: PageCreationWithDragAndDropCest.php:34
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\dragAndDropNewPageAndQuitPageCreation
‪dragAndDropNewPageAndQuitPageCreation(ApplicationTester $I, Mouse $mouse)
Definition: PageCreationWithDragAndDropCest.php:70
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\PageCreationWithDragAndDropCest\$nodeEditInput
‪static string $nodeEditInput
Definition: PageCreationWithDragAndDropCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26