‪TYPO3CMS  11.5
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 
22 
27 {
34  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
35  {
36  $I->useExistingSession('admin');
37 
38  $I->click('List');
39  $I->waitForElement('svg .nodes .node');
40  $pageTree->‪openPath(['styleguide TCA demo', 'elements group']);
41  $I->switchToContentFrame();
42 
43  $I->executeJS('window.name="TYPO3Main";');
44 
45  $I->waitForText('elements group', 20);
46  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_group a[aria-label="Edit record"]';
47  $I->click($editRecordLinkCssPath);
48  $I->waitForText('Edit Form', 3, 'h1');
49  }
50 
54  public function ‪sortElementsInGroup(‪ApplicationTester $I): void
55  {
56  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
57  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
58  $select = $formWizardsWrap . ' > div:nth-of-type(2) > select';
59 
60  $selectOption1 = 'styleguide demo user 1';
61  $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
62 
63  $I->amGoingTo('put "' . $selectOption1 . '" on first position');
64  $I->selectOption($select, $selectOption1);
65  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
66  $I->see($selectOption1, $select . ' > option:nth-child(1)');
67 
68  $I->amGoingTo('put "' . $selectOption1 . '" one position down / on the second position');
69  $I->selectOption($select, $selectOption1);
70  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
71  $I->see($selectOption1, $select . ' > option:nth-child(2)');
72 
73  $I->amGoingTo('put "' . $selectOption1 . '" on the last position');
74  $I->selectOption($select, $selectOption1);
75  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-bottom');
76  $I->see($selectOption1, $select . ' > option:nth-last-child(1)');
77 
78  $I->amGoingTo('put "' . $selectOption1 . '" one position up / on second last position');
79  $I->selectOption($select, $selectOption1);
80  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-up');
81  $I->see($selectOption1, $select . ' > option:nth-last-child(2)');
82 
83  $I->amGoingTo('put ' . print_r($multiselect, true) . ' on first position');
84  $I->selectOption($select, $multiselect);
85  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-top');
86  $I->see($multiselect[0], $select . ' > option:nth-child(1)');
87  $I->see($multiselect[1], $select . ' > option:nth-child(2)');
88 
89  $I->amGoingTo('put ' . print_r($multiselect, true) . ' one position down');
90  $I->selectOption($select, $multiselect);
91  $I->click($formWizardsWrap . ' div:nth-of-type(3) > div > a.t3js-btn-moveoption-down');
92  $I->see($multiselect[0], $select . ' > option:nth-child(2)');
93  $I->see($multiselect[1], $select . ' > option:nth-child(3)');
94  }
95 
100  {
101  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
102  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
103 
104  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
105  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
106 
107  $I->switchToWindow();
108  $I->switchToIFrame('modal_frame');
109 
110  $I->amGoingTo('click + button to select record and close DB-Browser');
111  $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)');
112 
113  $I->switchToWindow();
114  $I->switchToContentFrame();
115  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 5);
116  }
117 
122  {
123  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
124  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
125 
126  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
127  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
128 
129  $I->switchToWindow();
130  $I->switchToIFrame('modal_frame');
131 
132  $I->amGoingTo('click record + in DB-Browser');
133  $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)');
134  $I->amGoingTo('click + button to select record and close DB-Browser');
135  $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)');
136 
137  $I->switchToWindow();
138  $I->switchToContentFrame();
139  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 6);
140  }
141 
146  {
147  $fieldset = 'div.typo3-TCEforms > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > fieldset:nth-of-type(1)';
148  $formWizardsWrap = $fieldset . ' > div:nth-of-type(1) div.t3js-formengine-field-item > div:nth-of-type(1)';
149 
150  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
151  $I->click($formWizardsWrap . ' div:nth-of-type(4) > div > a:nth-of-type(1)');
152 
153  $I->switchToWindow();
154  $I->switchToIFrame('modal_frame');
155 
156  $I->amGoingTo('search record foo in DB-Browser');
157  $I->fillField('#search_field', 'foo');
158  $I->click('button[name="search"]');
159  $I->waitForElementNotVisible('.recordlist');
160 
161  $I->amGoingTo('search record admin in DB-Browser');
162  $I->fillField('#search_field', 'admin');
163  $I->click('button[name="search"]');
164  $I->waitForElement('.recordlist');
165  $I->see('admin', '.recordlist');
166 
167  $I->amGoingTo('click + button to select record and close DB-Browser');
168  $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)');
169  $I->switchToWindow();
170  $I->click('.t3js-modal-close');
171 
172  $I->switchToContentFrame();
173  $I->see('admin', 'select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"]');
174  $I->click('.btn-toolbar button.btn:nth-child(2)');
175  $I->click('button[name="_savedok"]');
176  }
177 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\sortElementsInGroup
‪sortElementsInGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:54
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\addARecordWithRecordBrowserGroup
‪addARecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:99
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree\openPath
‪openPath(array $path)
Definition: PageTree.php:76
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest
Definition: ElementsGroupCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\searchForARecordWithRecordBrowserGroup
‪searchForARecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:145
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\addTwoRecordWithRecordBrowserGroup
‪addTwoRecordWithRecordBrowserGroup(ApplicationTester $I)
Definition: ElementsGroupCest.php:121
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsGroupCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: ElementsGroupCest.php:34