TYPO3 CMS  TYPO3_8-7
ElementsGroupCest.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 {
25  public function _before(BackendTester $I, PageTree $pageTree)
26  {
27  $I->useExistingSession('admin');
28 
29  $I->click('List');
30  $pageTree->openPath(['styleguide TCA demo', 'elements group']);
31  $I->switchToContentFrame();
32 
33  $I->executeJS('window.name="TYPO3Main";');
34 
35  $I->waitForText('elements group', 20);
36  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_group a[data-original-title="Edit record"]';
37  $I->click($editRecordLinkCssPath);
38  $I->waitForText('Edit Form', 3, 'h1');
39  }
40 
44  public function sortElementsInGroup(BackendTester $I)
45  {
46  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
47  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
48  $select = $formWizardsWrap . ' > div:nth-of-type(2) > select';
49 
50  $selectOption1 = 'styleguide demo user 1';
51  $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
52 
53  $I->amGoingTo('put "' . $selectOption1 . '" on first position');
54  $I->selectOption($select, $selectOption1);
55  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
56  $I->see($selectOption1, $select . ' > option:nth-child(1)');
57 
58  $I->amGoingTo('put "' . $selectOption1 . '" one position down / on the second position');
59  $I->selectOption($select, $selectOption1);
60  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
61  $I->see($selectOption1, $select . ' > option:nth-child(2)');
62 
63  $I->amGoingTo('put "' . $selectOption1 . '" on the last position');
64  $I->selectOption($select, $selectOption1);
65  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-bottom');
66  $I->see($selectOption1, $select . ' > option:nth-last-child(1)');
67 
68  $I->amGoingTo('put "' . $selectOption1 . '" one position up / on second last position');
69  $I->selectOption($select, $selectOption1);
70  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-up');
71  $I->see($selectOption1, $select . ' > option:nth-last-child(2)');
72 
73  $I->amGoingTo('put ' . print_r($multiselect, 1) . ' on first position');
74  $I->selectOption($select, $multiselect);
75  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
76  $I->see($multiselect[0], $select . ' > option:nth-child(1)');
77  $I->see($multiselect[1], $select . ' > option:nth-child(2)');
78 
79  $I->amGoingTo('put ' . print_r($multiselect, 1) . ' one position down');
80  $I->selectOption($select, $multiselect);
81  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
82  $I->see($multiselect[0], $select . ' > option:nth-child(2)');
83  $I->see($multiselect[1], $select . ' > option:nth-child(3)');
84  }
85 
90  {
91  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
92  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
93 
94  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
95  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
96 
97  $I->switchToWindow('Typo3WinBrowser');
98 
99  $I->amGoingTo('click + button to select record and close DB-Browser');
100  $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)');
101 
102  $I->switchToWindow();
103  $I->switchToContentFrame();
104  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 5);
105  }
106 
111  {
112  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
113  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
114 
115  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
116  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
117 
118  $I->switchToWindow('Typo3WinBrowser');
119 
120  $I->amGoingTo('click record + in DB-Browser');
121  $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)');
122 
123  $I->amGoingTo('click record + in DB-Browser');
124  $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)');
125  $I->amGoingTo('click + button to select record and close DB-Browser');
126  $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)');
127 
128  $I->switchToWindow();
129  $I->switchToContentFrame();
130  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 6);
131  }
132 
137  {
138  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
139  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
140 
141  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
142  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
143 
144  $I->switchToWindow('Typo3WinBrowser');
145 
146  $I->amGoingTo("search record '' and limit 1 in DB-Browser");
147  $I->fillField('#showLimit', 1);
148  $I->click('button[name="search"]');
149  $I->waitForElement('.recordlist');
150  $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
151 
152  $I->amGoingTo('search record style and limit 1 in DB-Browser');
153  $I->fillField('#search_field', 'style');
154  $I->click('button[name="search"]');
155  $I->waitForElement('.recordlist');
156  $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
157 
158  $I->amGoingTo('reset limit');
159  $I->fillField('#showLimit', '');
160  $I->amGoingTo('search record foo in DB-Browser');
161  $I->fillField('#search_field', 'foo');
162  $I->click('button[name="search"]');
163  $I->waitForElementNotVisible('.recordlist');
164 
165  $I->amGoingTo('search record admin in DB-Browser');
166  $I->fillField('#search_field', 'admin');
167  $I->click('button[name="search"]');
168  $I->waitForElement('.recordlist');
169  $I->see('admin', '.recordlist');
170 
171  $I->amGoingTo('click + button to select record and close DB-Browser');
172  $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)');
173  $I->switchToWindow();
174 
175  $I->switchToContentFrame();
176  $I->see('admin', 'select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"]');
177  $I->click('.btn-toolbar button.btn:nth-child(2)');
178  $I->click('li a[data-form="EditDocumentController"] span[data-identifier="actions-document-save-close"]');
179  }
180 }