TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ElementsGroupCest.php
Go to the documentation of this file.
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;
20 
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 
38  $I->executeJS('window.name="TYPO3Main";');
39 
40  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_group a[data-original-title="Edit record"]';
41  $I->waitForElement($editRecordLinkCssPath, 30);
42  $I->click($editRecordLinkCssPath);
43  $I->waitForText('Edit Form', 3, 'h1');
44  }
45 
49  public function sortElementsInGroup(Admin $I)
50  {
51  $select = '.typo3-TCEforms > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > fieldset:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3) > div:nth-child(1) > select:nth-child(1)';
52  $selectOption1 = 'styleguide demo user 1';
53  $multiselect = ['styleguide demo user 1', 'styleguide demo user 2'];
54 
55  $I->amGoingTo('put "' . $selectOption1 . '" on first position');
56  $I->selectOption($select, $selectOption1);
57  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-top');
58  $I->see($selectOption1, $select . ' > option:nth-child(1)');
59 
60  $I->amGoingTo('put "' . $selectOption1 . '" one position down / on the second position');
61  $I->selectOption($select, $selectOption1);
62  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-down');
63  $I->see($selectOption1, $select . ' > option:nth-child(2)');
64 
65  $I->amGoingTo('put "' . $selectOption1 . '" on the last position');
66  $I->selectOption($select, $selectOption1);
67  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-bottom');
68  $I->see($selectOption1, $select . ' > option:nth-last-child(1)');
69 
70  $I->amGoingTo('put "' . $selectOption1 . '" one position up / on second last position');
71  $I->selectOption($select, $selectOption1);
72  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-up');
73  $I->see($selectOption1, $select . ' > option:nth-last-child(2)');
74 
75  $I->amGoingTo('put ' . print_r($multiselect, 1) . ' on first position');
76  $I->selectOption($select, $multiselect);
77  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-top');
78  $I->see($multiselect[0], $select . ' > option:nth-child(1)');
79  $I->see($multiselect[1], $select . ' > option:nth-child(2)');
80 
81  $I->amGoingTo('put ' . print_r($multiselect, 1) . ' one position down');
82  $I->selectOption($select, $multiselect);
83  $I->click('.typo3-TCEforms div:nth-child(1) div:nth-child(2) div:nth-child(1) fieldset:nth-child(1) a.t3js-btn-moveoption-down');
84  $I->see($multiselect[0], $select . ' > option:nth-child(2)');
85  $I->see($multiselect[1], $select . ' > option:nth-child(3)');
86  }
87 
92  {
93  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
94  $I->click('.typo3-TCEforms > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > fieldset:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3) > div:nth-child(3) > div:nth-child(1) > a:nth-child(1)');
95  $I->switchToWindow('Typo3WinBrowser');
96 
97  try {
98  $I->amGoingTo('click record name in DB-Browser');
99  $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(2)');
100  } catch (NoSuchWindowException $e) {
101  // missing focus by auto close window
102  }
103 
104  $I->switchToWindow();
105  $I->switchToIFrame('list_frame');
106  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 5);
107  }
108 
113  {
114  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 4);
115  $I->click('.typo3-TCEforms > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > fieldset:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3) > div:nth-child(3) > div:nth-child(1) > a:nth-child(1)');
116  $I->switchToWindow('Typo3WinBrowser');
117 
118  $I->amGoingTo('click record + in DB-Browser');
119  $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)');
120 
121  try {
122  $I->amGoingTo('click record name in DB-Browser');
123  $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(2)');
124  } catch (NoSuchWindowException $e) {
125  // missing focus by auto close window
126  }
127 
128  $I->switchToWindow();
129  $I->switchToIFrame('list_frame');
130  $I->seeNumberOfElements('select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"] option', 6);
131  $I->click('.btn-toolbar button.btn:nth-child(2)');
132  $I->click('li a[data-form="EditDocumentController"] span[data-identifier="actions-document-save-close"]');
133  }
134 
139  {
140  $I->click('.typo3-TCEforms > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > fieldset:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3) > div:nth-child(3) > div:nth-child(1) > a:nth-child(1)');
141  $I->switchToWindow('Typo3WinBrowser');
142 
143  $I->amGoingTo("search record '' and limit 1 in DB-Browser");
144  $I->fillField('#showLimit', 1);
145  $I->click('button[name="search"]');
146  $I->waitForElement('.recordlist');
147  $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
148 
149  $I->amGoingTo('search record style and limit 1 in DB-Browser');
150  $I->fillField('#search_field', 'style');
151  $I->click('button[name="search"]');
152  $I->waitForElement('.recordlist');
153  $I->seeNumberOfElements('.recordlist #recordlist-be_groups table tbody tr', 1);
154 
155  $I->amGoingTo('reset limit');
156  $I->fillField('#showLimit', '');
157  $I->amGoingTo('search record foo in DB-Browser');
158  $I->fillField('#search_field', 'foo');
159  $I->click('button[name="search"]');
160  $I->waitForElementNotVisible('.recordlist');
161 
162  $I->amGoingTo('search record admin in DB-Browser');
163  $I->fillField('#search_field', 'admin');
164  $I->click('button[name="search"]');
165  $I->waitForElement('.recordlist');
166  $I->see('admin', '.recordlist');
167 
168  // search Test only by string
169  try {
170  $I->click('admin');
171  } catch (NoSuchWindowException $e) {
172  // missing focus by auto close window
173  }
174 
175  $I->switchToWindow();
176  $I->switchToIFrame('list_frame');
177  $I->see('admin', 'select[data-formengine-input-name="data[tx_styleguide_elements_group][1][group_db_1]"]');
178  $I->click('.btn-toolbar button.btn:nth-child(2)');
179  $I->click('li a[data-form="EditDocumentController"] span[data-identifier="actions-document-save-close"]');
180  }
181 }