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