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