2 declare(strict_types = 1);
18 use PHPUnit\Framework\SkippedTestError;
31 $I->useExistingSession(
'admin');
46 $I->wantToTest(
'Add a page with page module');
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';
56 $contextMenuNew =
'#contentMenu1 .list-group-item[data-callback-action=newPageWizard]';
58 $I->waitForElement($rootNode);
59 $I->click($rootNodeIcon);
60 $I->waitForElementVisible($rootNodeContextMenuMore);
63 $I->click($rootNodeContextMenuMore);
64 $I->waitForElementVisible($contextMenuNew, 30);
65 $I->click($contextMenuNew);
67 $I->switchToContentFrame();
70 $I->click(
'i[title="Insert the new page here"]');
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);
77 $I->amGoingTo(
'check empty error');
79 $editControllerDiv =
'#EditDocumentController > div';
80 $generalTab = $editControllerDiv .
' > div:nth-child(1) > ul > li';
81 $classString = $I->executeInSelenium(
function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use (
84 return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute(
'class');
86 $I->assertContains(
'has-validation-error', $classString);
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');
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();
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.');
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);
111 $yesButtonInPopup =
'.modal-dialog button[name=delete]';
112 $I->waitForElement($yesButtonInPopup);
113 $I->click($yesButtonInPopup);
115 $I->cantSee(
'Testpage');
123 throw new SkippedTestError(
'Test unstable, skipped for now.');