[!!!][FEATURE] Replace ExtJS page tree
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Formhandler / ElementsGroupCest.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 use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
19
20 /**
21 * Tests for ElementsGroupelement fields
22 */
23 class ElementsGroupCest
24 {
25 public function _before(Admin $I, PageTree $pageTree)
26 {
27 $I->useExistingSession();
28 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
29 $I->switchToIFrame('list_frame');
30 $I->waitForText('Web Content Management System');
31 $I->switchToIFrame();
32
33 $I->click('List');
34 $pageTree->openPath(['styleguide TCA demo', 'elements group']);
35 $I->switchToIFrame('list_frame');
36
37 $I->executeJS('window.name="TYPO3Main";');
38
39 $I->waitForText('elements group');
40 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_group a[data-original-title="Edit record"]';
41 $I->click($editRecordLinkCssPath);
42 $I->waitForText('Edit Form', 3, 'h1');
43 }
44
45 /**
46 * @param Admin $I
47 */
48 public function sortElementsInGroup(Admin $I)
49 {
50 $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
51 $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
52 $select = $formWizardsWrap . ' > div:nth-of-type(2) > select';
53
54 $selectOption1 = 'styleguide demo user 1';
55 $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
56
57 $I->amGoingTo('put "' . $selectOption1 . '" on first position');
58 $I->selectOption($select, $selectOption1);
59 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
60 $I->see($selectOption1, $select . ' > option:nth-child(1)');
61
62 $I->amGoingTo('put "' . $selectOption1 . '" one position down / on the second position');
63 $I->selectOption($select, $selectOption1);
64 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
65 $I->see($selectOption1, $select . ' > option:nth-child(2)');
66
67 $I->amGoingTo('put "' . $selectOption1 . '" on the last position');
68 $I->selectOption($select, $selectOption1);
69 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-bottom');
70 $I->see($selectOption1, $select . ' > option:nth-last-child(1)');
71
72 $I->amGoingTo('put "' . $selectOption1 . '" one position up / on second last position');
73 $I->selectOption($select, $selectOption1);
74 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-up');
75 $I->see($selectOption1, $select . ' > option:nth-last-child(2)');
76
77 $I->amGoingTo('put ' . print_r($multiselect, 1) . ' on first position');
78 $I->selectOption($select, $multiselect);
79 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
80 $I->see($multiselect[0], $select . ' > option:nth-child(1)');
81 $I->see($multiselect[1], $select . ' > option:nth-child(2)');
82
83 $I->amGoingTo('put ' . print_r($multiselect, 1) . ' one position down');
84 $I->selectOption($select, $multiselect);
85 $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
86 $I->see($multiselect[0], $select . ' > option:nth-child(2)');
87 $I->see($multiselect[1], $select . ' > option:nth-child(3)');
88 }
89
90 /**
91 * @param Admin $I
92 */
93 public function addARecordWithRecordBrowserGroup(Admin $I)
94 {
95 $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
96 $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
97
98 $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
99 $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
100
101 $I->switchToWindow();
102 $I->switchToIFrame('modal_frame');
103
104 $I->amGoingTo('click + button to select record and close DB-Browser');
105 $I->click('#recordlist-be_users > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1) > a:nth-child(1)');
106
107 $I->switchToWindow();
108 $I->switchToIFrame('list_frame');
109 $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 5);
110 }
111
112 /**
113 * @param Admin $I
114 */
115 public function addTwoRecordWithRecordBrowserGroup(Admin $I)
116 {
117 $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
118 $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
119
120 $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
121 $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
122
123 $I->switchToWindow();
124 $I->switchToIFrame('modal_frame');
125
126 $I->amGoingTo('click record + in DB-Browser');
127 $I->click('#recordlist-be_groups > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1) > a:nth-child(1)');
128 $I->amGoingTo('click + button to select record and close DB-Browser');
129 $I->click('#recordlist-be_users > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1) > a:nth-child(1)');
130
131 $I->switchToWindow();
132 $I->switchToIFrame('list_frame');
133 $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 6);
134 }
135
136 /**
137 * @param Admin $I
138 */
139 public function searchForARecordWithRecordBrowserGroup(Admin $I)
140 {
141 $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
142 $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
143
144 $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
145 $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
146
147 $I->switchToWindow();
148 $I->switchToIFrame('modal_frame');
149
150 $I->amGoingTo("search record '' and limit 1 in DB-Browser");
151 $I->fillField('#showLimit', 1);
152 $I->click('button[name="search"]');
153 $I->waitForElement('.recordlist');
154 $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
155
156 $I->amGoingTo('search record style and limit 1 in DB-Browser');
157 $I->fillField('#search_field', 'style');
158 $I->click('button[name="search"]');
159 $I->waitForElement('.recordlist');
160 $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
161
162 $I->amGoingTo('reset limit');
163 $I->fillField('#showLimit', '');
164 $I->amGoingTo('search record foo in DB-Browser');
165 $I->fillField('#search_field', 'foo');
166 $I->click('button[name="search"]');
167 $I->waitForElementNotVisible('.recordlist');
168
169 $I->amGoingTo('search record admin in DB-Browser');
170 $I->fillField('#search_field', 'admin');
171 $I->click('button[name="search"]');
172 $I->waitForElement('.recordlist');
173 $I->see('admin', '.recordlist');
174
175 $I->amGoingTo('click + button to select record and close DB-Browser');
176 $I->click('#recordlist-be_users > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > span:nth-child(1) > a:nth-child(1)');
177 $I->switchToWindow();
178 $I->click('.t3js-modal-close');
179
180 $I->switchToIFrame('list_frame');
181 $I->see('admin', 'select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"]');
182 $I->click('.btn-toolbar button.btn:nth-child(2)');
183 $I->click('li a[data-form="EditDocumentController"] span[data-identifier="actions-document-save-close"]');
184 }
185 }