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