[TASK] Stabilize acceptance tests
[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 }
31
32 /**
33 * @param Admin $I
34 */
35 public function checkIfCategoryListIsAvailable(Admin $I)
36 {
37 // A sub-element of web module is show
38 $I->waitForElementVisible('#web .modulemenu-group-container .modulemenu-item');
39 $I->click('#web_list');
40 $I->switchToContentFrame();
41 $I->waitForElement('#recordlist-sys_category');
42 $I->seeNumberOfElements('#recordlist-sys_category table > tbody > tr', [5, 100]);
43 }
44
45 /**
46 * @param Admin $I
47 */
48 public function editCategoryItem(Admin $I)
49 {
50 // A sub-element of web module is show
51 $I->waitForElementVisible('#web .modulemenu-group-container .modulemenu-item');
52 $I->click('#web_list');
53 $I->switchToContentFrame();
54 // Collapse all tables and expand category again - ensures category fits into window
55 $I->executeJS('$(\'.icon-actions-view-list-collapse\').click();');
56 $I->wait(1);
57 $I->executeJS('$(\'a[data-table="sys_category"] .icon-actions-view-list-expand\').click();');
58 $I->waitForElementVisible('#recordlist-sys_category tr[data-uid="7"] a[data-original-title="Edit record"]');
59 // Select category with id 7
60 $I->click('#recordlist-sys_category tr[data-uid="7"] a[data-original-title="Edit record"]');
61 $I->waitForText('Category', 20);
62 // Change title and level to root
63 $I->fillField('input[data-formengine-input-name="data[sys_category][7][title]"]', 'level-1-4');
64 $I->click('.identifier-0_7 text.node-name');
65 $I->click('.identifier-0_3 text.node-name');
66 $I->click('button[name="_savedok"]');
67 // Wait for tree and check if isset level-1-4
68 $I->waitForElement('.svg-tree-wrapper svg');
69 $I->waitForText('Category');
70 $I->see('level-1-4');
71 }
72 }