[BUGFIX] Acceptance tests fails due to viewport changes
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Topbar / SearchCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar;
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 TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin;
18 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar;
19
20 /**
21 * Test the search module in the top bar
22 */
23 class SearchCest
24 {
25 /**
26 * Selector for the module container in the topbar
27 *
28 * @var string
29 */
30 public static $topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem';
31
32 /**
33 * @param Admin $I
34 */
35 public function _before(Admin $I)
36 {
37 $I->useExistingSession();
38 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
39 $I->switchToIFrame('contentIframe');
40 $I->waitForText('Web Content Management System');
41 $I->switchToIFrame();
42 }
43
44 /**
45 * @param Admin $I
46 */
47 public function searchAndTestIfAutocompletionWorks(Admin $I)
48 {
49 $I->cantSeeElement(self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
50 $I->fillField('#live-search-box', 'adm');
51 $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
52
53 $I->canSee('Backend user', self::$topBarModuleSelector);
54 $I->click('admin', self::$topBarModuleSelector);
55
56 $I->switchToIFrame('contentIframe');
57 $I->waitForElementVisible('#EditDocumentController');
58 $I->canSee('Edit Backend user "admin" on root level');
59 }
60
61 /**
62 * @param Admin $I
63 */
64 public function searchForFancyTextAndCheckEmptyResultInfo(Admin $I)
65 {
66 $I->fillField('#live-search-box', 'Kasper = Jesus # joh316');
67 $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
68
69 // tod0: check why TYPO3 does not return a result for "Kasper" by itself
70 $I->canSee('No results found.', self::$topBarModuleSelector);
71
72 $I->click(self::$topBarModuleSelector . ' .close');
73 $I->waitForElementNotVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
74 $I->cantSeeInField('#live-search-box', 'Kasper = Jesus # joh316');
75 }
76
77 /**
78 * @param Admin $I
79 */
80 public function checkIfTheShowAllLinkPointsToTheListViewWithSearchResults(Admin $I)
81 {
82 $I->fillField('#live-search-box', 'fileadmin');
83 $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
84
85 $I->canSee('fileadmin/ (auto-created)', self::$topBarModuleSelector);
86 $I->click('.t3js-live-search-show-all', self::$topBarModuleSelector);
87
88 $I->switchToIFrame('contentIframe');
89 $I->waitForElementVisible('form[name="dblistForm"]');
90 $I->canSee('fileadmin/ (auto-created)');
91 }
92 }