TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AddPageInPageModuleCest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
24  public function _before(Admin $I)
25  {
26  $I->useExistingSession();
27  // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
28  $I->switchToIFrame('list_frame');
29  $I->waitForText('Web Content Management System');
30  $I->switchToIFrame();
31  }
32 
39  public function addAndDeletePage(Admin $I)
40  {
41  // Select page module
42  $I->wantToTest('Add a page with page module');
43  $I->click('Page');
44 
45  // New page from root page
46  $typo3NavigationContainer = '.scaffold-content-navigation-component';
47  $I->waitForElement($typo3NavigationContainer);
48  $rootNode = 'a.x-tree-node-anchor > span';
49  $rootNodeIcon = '#extdd-1 > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-root';
50  $contextMenuNew = '#typo3-pagetree-contextmenu > ul > li.x-menu-list-item:nth-of-type(2) > a > span.x-menu-item-text';
51  $I->waitForElement($rootNode);
52  $I->click($rootNodeIcon);
53  $I->waitForElement($contextMenuNew);
54  $I->click($contextMenuNew);
55 
56  // Switch to content frame
57  $I->switchToIFrame('list_frame');
58 
59  // New page select position wizard
60  $I->click('i[title="Insert the new page here"]');
61 
62  // FormEngine new page record
63  $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)';
64  $I->waitForElement($saveButton);
65 
66  // Check empty
67  $I->amGoingTo('check empty error');
68  $I->wait(2);
69  $editControllerDiv = '#EditDocumentController > div';
70  $generalTab = $editControllerDiv . ' > div:nth-child(1) > ul > li';
71  $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use (
72  $generalTab
73  ) {
74  return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute('class');
75  });
76  $I->assertContains('has-validation-error', $classString);
77 
78  // Add page
79  $pageTitle = $editControllerDiv . ' > div:nth-child(1) > div > div.tab-pane:nth-child(1) > fieldset:nth-child(2) > div > div:nth-child(1) > div > div.form-control-wrap > div > input';
80  $I->fillField($pageTitle, 'Testpage');
81  $I->click($saveButton);
82  $I->waitForElement($pageTitle);
83  $I->assertEquals('Testpage', $I->grabValueFrom($pageTitle), 'Value in input field.');
84  $I->switchToIFrame();
85 
86  // Check tree
87  $I->waitForElement($typo3NavigationContainer);
88  $pageInTree = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > a > span';
89  $I->assertEquals('Testpage', $I->grabTextFrom($pageInTree), 'Value in tree.');
90 
91  // And delete page from tree
92  $pageInTreeIcon = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-page-default';
93  $pageActions = '#typo3-pagetree-contextmenu > ul > li:nth-child(8) > a > span.x-menu-item-text';
94  $delete = '#typo3-pagetree-contextmenu-sub1 > ul > li:nth-child(6) > a > span.x-menu-item-text';
95  $I->click($pageInTreeIcon);
96  $I->waitForElement('#typo3-pagetree-contextmenu');
97  $I->waitForElement($pageActions);
98  $I->moveMouseOver($pageActions);
99  $I->waitForElement('#typo3-pagetree-contextmenu-sub1');
100  $I->click($delete);
101  $yesButtonPopup = '#main > div.x-window.x-window-plain.x-window-dlg > div.x-window-bwrap > div.x-window-bl > div > div > div > div.x-panel-fbar.x-small-editor.x-toolbar-layout-ct > table > tbody > tr > td.x-toolbar-left > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(2) > td.x-btn-mc > em > button';
102  $I->waitForElement($yesButtonPopup);
103  $I->click($yesButtonPopup);
104  $I->wait(2);
105  $I->cantSee('Testpage');
106  }
107 }