‪TYPO3CMS  ‪main
ElementsGroupCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Facebook\WebDriver\WebDriverKeys;
23 
28 {
32  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
33  {
34  $I->useExistingSession('admin');
35 
36  $I->click('List');
37  $pageTree->‪openPath(['styleguide TCA demo', 'elements group']);
38  $I->switchToContentFrame();
39 
40  $I->executeJS('window.name="TYPO3Main";');
41 
42  $I->waitForText('elements group', 20);
43  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_group a[aria-label="Edit record"]';
44  $I->click($editRecordLinkCssPath);
45  $I->waitForText('Edit Form', 3, 'h1');
46  }
47 
48  public function ‪sortElementsInGroup(‪ApplicationTester $I): void
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(2)';
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, true) . ' 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, true) . ' 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 
91  {
92  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
93  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(2)';
94  $select = $formWizardsWrap . ' > div:nth-of-type(2) > select';
95 
96  $selectOption1 = 'styleguide demo user 1';
97  $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
98 
99  $I->amGoingTo('put "' . $selectOption1 . '" on first position');
100  $I->selectOption($select, $selectOption1);
101  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::SHIFT, WebDriverKeys::UP]);
102  $I->see($selectOption1, $select . ' > option:nth-child(1)');
103 
104  $I->amGoingTo('put "' . $selectOption1 . '" one position down / on the second position');
105  $I->selectOption($select, $selectOption1);
106  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::DOWN]);
107  $I->see($selectOption1, $select . ' > option:nth-child(2)');
108 
109  $I->amGoingTo('put "' . $selectOption1 . '" on the last position');
110  $I->selectOption($select, $selectOption1);
111  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::SHIFT, WebDriverKeys::DOWN]);
112  $I->see($selectOption1, $select . ' > option:nth-last-child(1)');
113 
114  $I->amGoingTo('put "' . $selectOption1 . '" one position up / on second last position');
115  $I->selectOption($select, $selectOption1);
116  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::UP]);
117  $I->see($selectOption1, $select . ' > option:nth-last-child(2)');
118 
119  $I->amGoingTo('put ' . print_r($multiselect, true) . ' on first position');
120  $I->selectOption($select, $multiselect);
121  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::SHIFT, WebDriverKeys::UP]);
122  $I->see($multiselect[0], $select . ' > option:nth-child(1)');
123  $I->see($multiselect[1], $select . ' > option:nth-child(2)');
124 
125  $I->amGoingTo('put ' . print_r($multiselect, true) . ' one position down');
126  $I->selectOption($select, $multiselect);
127  $I->pressKey($select, [WebDriverKeys::ALT, WebDriverKeys::DOWN]);
128  $I->see($multiselect[0], $select . ' > option:nth-child(2)');
129  $I->see($multiselect[1], $select . ' > option:nth-child(3)');
130  }
131 
133  {
134  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
135  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(2)';
136  $select = $formWizardsWrap . ' > div:nth-of-type(2) > select';
137 
138  $selectOption1 = 'styleguide demo user 1';
139  $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
140 
141  $I->amGoingTo('remove "' . $selectOption1);
142  $I->selectOption($select, $selectOption1);
143  $I->pressKey($select, WebDriverKeys::DELETE);
144  $I->dontSee($selectOption1, $select . ' > option:nth-child(1)');
145 
146  $I->amGoingTo('remove ' . print_r($multiselect, true));
147  $I->selectOption($select, $multiselect);
148  $I->pressKey($select, WebDriverKeys::DELETE);
149  $I->dontSee($multiselect[0], $select . ' > option:nth-child(1)');
150  $I->dontSee($multiselect[1], $select . ' > option:nth-child(2)');
151  }
152 
154  {
155  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
156  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(2)';
157 
158  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
159  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
160 
161  $I->switchToWindow('typo3-backend');
162  $I->switchToIFrame('modal_frame');
163 
164  $I->amGoingTo('click + button to select record and close DB-Browser');
165  $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)');
166 
167  $I->switchToWindow('typo3-backend');
168  $I->switchToContentFrame();
169  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 5);
170  }
171 
173  {
174  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
175  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(2)';
176 
177  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
178  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
179 
180  $I->switchToWindow('typo3-backend');
181  $I->switchToIFrame('modal_frame');
182 
183  $I->amGoingTo('click record + in DB-Browser');
184  $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)');
185  $I->amGoingTo('click + button to select record and close DB-Browser');
186  $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)');
187 
188  $I->switchToWindow('typo3-backend');
189  $I->switchToContentFrame();
190  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 6);
191  }
192 
194  {
195  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
196  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(2)';
197 
198  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
199  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
200 
201  $I->switchToWindow('typo3-backend');
202  $I->switchToIFrame('modal_frame');
203 
204  $I->amGoingTo('search record foo in DB-Browser');
205  $I->fillField('#recordsearchbox-searchterm', 'foo');
206  $I->click('button[name="search"]');
207  $I->waitForElementNotVisible('.recordlist');
208 
209  $I->amGoingTo('search record admin in DB-Browser');
210  $I->fillField('#recordsearchbox-searchterm', 'admin');
211  $I->click('button[name="search"]');
212  $I->waitForElement('.recordlist');
213  $I->see('admin', '.recordlist');
214 
215  $I->amGoingTo('click + button to select record and close DB-Browser');
216  $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)');
217  $I->switchToWindow('typo3-backend');
218  $I->click('.t3js-modal-close');
219 
220  $I->switchToContentFrame();
221  $I->see('admin', 'select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"]');
222  $I->click('.btn-toolbar button.btn:nth-child(2)');
223  $I->click('button[name="_savedok"]');
224  }
225 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\sortElementsInGroup
‪sortElementsInGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:48
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\addARecordWithRecordBrowserGroup
‪addARecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:153
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\removeElementInGroupWithDeleteKey
‪removeElementInGroupWithDeleteKey(ApplicationTester $I)
Definition: ElementsGroupCest.php:132
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\sortElementsInGroupWithArrowAndAltKeys
‪sortElementsInGroupWithArrowAndAltKeys(ApplicationTester $I)
Definition: ElementsGroupCest.php:90
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\AbstractTree\openPath
‪openPath(array $path)
Definition: AbstractTree.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest
Definition: ElementsGroupCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\searchForARecordWithRecordBrowserGroup
‪searchForARecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:193
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\addTwoRecordWithRecordBrowserGroup
‪addTwoRecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:172
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: ElementsGroupCest.php:32