‪TYPO3CMS  9.5
AddPageInPageModuleCest.php
Go to the documentation of this file.
1 <?php
2 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 
18 use PHPUnit\Framework\SkippedTestError;
20 
25 {
29  public function ‪_before(‪BackendTester $I)
30  {
31  $I->useExistingSession('admin');
32  }
33 
41  {
42  // @todo: Fix in high load scenarios or throw away
43  $this->‪skipUnstable();
44 
45  // Select page module
46  $I->wantToTest('Add a page with page module');
47  $I->click('Page');
48 
49  // New page from root page
50  $typo3NavigationContainer = '.scaffold-content-navigation-component';
51  $I->waitForElement($typo3NavigationContainer);
52  $rootNode = 'a.x-tree-node-anchor > span';
53  $rootNodeIcon = '.node.identifier-0_0 .node-icon';
54  $rootNodeContextMenuMore = '#contentMenu0 a.list-group-item-submenu';
55  //create new wizard
56  $contextMenuNew = '#contentMenu1 .list-group-item[data-callback-action=newPageWizard]';
57 
58  $I->waitForElement($rootNode);
59  $I->click($rootNodeIcon);
60  $I->waitForElementVisible($rootNodeContextMenuMore);
61 
62  $I->wait(1);
63  $I->click($rootNodeContextMenuMore);
64  $I->waitForElementVisible($contextMenuNew, 30);
65  $I->click($contextMenuNew);
66 
67  $I->switchToContentFrame();
68 
69  // New page select position wizard
70  $I->click('i[title="Insert the new page here"]');
71 
72  // FormEngine new page record
73  $saveButton = 'body > div > div.module-docheader.t3js-module-docheader > div.module-docheader-bar.module-docheader-bar-buttons.t3js-module-docheader-bar.t3js-module-docheader-bar-buttons > div.module-docheader-bar-column-left > div > div > button:nth-child(1)';
74  $I->waitForElement($saveButton);
75 
76  // Check empty
77  $I->amGoingTo('check empty error');
78  $I->wait(2);
79  $editControllerDiv = '#EditDocumentController > div';
80  $generalTab = $editControllerDiv . ' > div:nth-child(1) > ul > li';
81  $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use (
82  $generalTab
83  ) {
84  return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute('class');
85  });
86  $I->assertContains('has-validation-error', $classString);
87 
88  // Add page
89  $pageTitleFieldset = $editControllerDiv . ' > div:nth-of-type(1) > div > div.tab-pane:nth-child(1) > fieldset:nth-child(2)';
90  $I->seeElement($pageTitleFieldset . ' > div > div.t3js-formengine-validation-marker.has-error');
91 
92  $pageTitleInput = $pageTitleFieldset . ' > div > div:nth-child(1) > div > div.form-control-wrap > div.form-wizards-wrap > div.form-wizards-element > div > input';
93  $I->fillField($pageTitleInput, 'Testpage');
94  $I->click($saveButton);
95  $I->waitForElement($pageTitleInput);
96  $I->assertEquals('Testpage', $I->grabValueFrom($pageTitleInput), 'Value in input field.');
97  $I->dontSeeElement($pageTitleFieldset . ' > div > div.t3js-formengine-validation-marker.has-error');
98  $I->switchToMainFrame();
99 
100  // Check tree
101  $I->waitForElement($typo3NavigationContainer);
102  $pageInTree = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > a > span';
103  $I->assertEquals('Testpage', $I->grabTextFrom($pageInTree), 'Value in tree.');
104 
105  // And delete page from tree
106  $pageInTreeIcon = '#typo3-pagetree-tree .icon-apps-pagetree-page-default';
107  $delete = '#contentMenu0 .list-group-item[data-callback-action=deleteRecord]';
108  $I->click($pageInTreeIcon);
109  $I->waitForElement($delete);
110  $I->click($delete);
111  $yesButtonInPopup = '.modal-dialog button[name=delete]';
112  $I->waitForElement($yesButtonInPopup);
113  $I->click($yesButtonInPopup);
114  $I->wait(2);
115  $I->cantSee('Testpage');
116  }
117 
121  protected function ‪skipUnstable()
122  {
123  throw new SkippedTestError('Test unstable, skipped for now.');
124  }
125 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Page\AddPageInPageModuleCest\addAndDeletePage
‪addAndDeletePage(BackendTester $I)
Definition: AddPageInPageModuleCest.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Page
Definition: AddPageInPageModuleCest.php:3
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Page\AddPageInPageModuleCest\skipUnstable
‪skipUnstable()
Definition: AddPageInPageModuleCest.php:121
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Page\AddPageInPageModuleCest\_before
‪_before(BackendTester $I)
Definition: AddPageInPageModuleCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Page\AddPageInPageModuleCest
Definition: AddPageInPageModuleCest.php:25