6d9f8e0b64e9ee3184bb3eaca0002ad90ec2ca56
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Formhandler / CategoryTreeCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
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
17 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
18
19 /**
20 * Category tree tests
21 */
22 class CategoryTreeCest
23 {
24 /**
25 * @param Admin $I
26 */
27 public function _before(Admin $I)
28 {
29 $I->useExistingSession();
30 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
31 $I->switchToIFrame('list_frame');
32 $I->waitForElementNotVisible('div#nprogess', 30);
33 $I->waitForText('Web Content Management System');
34 $I->switchToIFrame();
35 }
36
37 /**
38 * @param Admin $I
39 */
40 public function checkIfCategoryListIsAvailable(Admin $I)
41 {
42 // A sub-element of web module is show
43 $I->waitForElementVisible('#web .modulemenu-group-container .modulemenu-item');
44 $I->click('#web_list');
45 $I->switchToIFrame('list_frame');
46 $I->waitForElement('#recordlist-sys_category');
47 $I->seeNumberOfElements('#recordlist-sys_category table > tbody > tr', [5, 100]);
48 }
49
50 /**
51 * @param Admin $I
52 */
53 public function editCategoryItem(Admin $I)
54 {
55 // A sub-element of web module is show
56 $I->waitForElementVisible('#web .modulemenu-group-container .modulemenu-item');
57 $I->click('#web_list');
58 $I->switchToIFrame('list_frame');
59 // Collapse all tables and expand category again - ensures category fits into window
60 $I->executeJS('$(\'.icon-actions-view-list-collapse\').click();');
61 $I->wait(1);
62 $I->executeJS('$(\'a[data-table="sys_category"] .icon-actions-view-list-expand\').click();');
63 $I->waitForElementVisible('#recordlist-sys_category tr[data-uid="7"] a[data-original-title="Edit record"]');
64 // Select category with id 7
65 $I->click('#recordlist-sys_category tr[data-uid="7"] a[data-original-title="Edit record"]');
66 $I->waitForText('Category', 20);
67 // Change title and level to root
68 $I->fillField('input[data-formengine-input-name="data[sys_category][7][title]"]', 'level-1-4');
69 $I->click('.identifier-0_7 text.node-name');
70 $I->click('.identifier-0_3 text.node-name');
71 $I->click('button[name="_savedok"]');
72 // Wait for tree and check if isset level-1-4
73 $I->waitForElement('.svg-tree-wrapper svg');
74 $I->waitForText('Category');
75 $I->see('level-1-4');
76 }
77 }