[TASK] Add modal dialog helper for acceptance tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Menu / ModuleMenuSliderCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Menu;
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\Kasper;
18
19 /**
20 * Acceptance test
21 */
22 class ModuleMenuSliderCest
23 {
24 public function _before(Kasper $I)
25 {
26 $I->loginAsAdmin();
27 }
28
29 public function _after(Kasper $I)
30 {
31 $I->logout();
32 }
33
34 // tests
35 public function tryToTest(Kasper $I)
36 {
37 $ids = ['#web', '#tools', '#system'];
38 $sees = ['Page', 'Extensions'];
39
40 $menuItems = [
41 ['mainId' => '#web', 'menuItem' => 'Page'],
42 ['mainId' => '#tools', 'menuItem' => 'Extensions'],
43 ['mainId' => '#system', 'menuItem' => 'Log']
44 ];
45
46 $I->wantTo('check the slider in the module menu');
47
48 foreach ($menuItems as $menuItem) {
49 $id = $menuItem['mainId'];
50 $menuItem = $menuItem['menuItem'];
51
52 $I->waitForElement($id);
53
54 // close the item
55 $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($id) {
56 return $webdriver->findElement(\WebDriverBy::cssSelector($id))->getAttribute('class');
57 });
58
59 if (strpos($classString, 'expanded') !== false) {
60 $I->click($id . ' > div');
61 $I->wait(2); // the animation is so fast
62 }
63
64 $I->dontSee($menuItem);
65
66 // now we expand it
67 $I->click($id . ' > div');
68
69 // and wait a short moment
70 $I->waitForText($menuItem);
71 }
72 }
73 }