[TASK] Codeception simple tests for admin user 12/46912/14
authorRoland Golla <rolandgolla@gmail.com>
Sat, 5 Mar 2016 22:42:01 +0000 (23:42 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 6 Mar 2016 12:14:21 +0000 (13:14 +0100)
Resolves: #73566
Releases: master
Change-Id: I294ae235c7e9edcbbfeb838dadaec68722b492ba
Reviewed-on: https://review.typo3.org/46912
Reviewed-by: Timo Schmidt <timo-schmidt@gmx.net>
Tested-by: Timo Schmidt <timo-schmidt@gmx.net>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Build/Configuration/Acceptance/acceptance.suite.yml
typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Page/InfoOnModuleCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Profile/UsernameOnAvatarCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchAdminCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchNoResultCest.php [new file with mode: 0644]

index 4c42852..36d8933 100644 (file)
@@ -8,11 +8,10 @@ modules:
     WebDriver:
       url: http://localhost:8000/typo3temp/var/tests/acceptance
       browser: phantomjs
-      http_proxy: direct
-      window_size: 1024x768
+      window_size: 1440x570
 env:
   firefox:
     modules:
       config:
         WebDriver:
-          browser: 'firefox'
\ No newline at end of file
+          browser: firefox
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php
new file mode 100644 (file)
index 0000000..d8fe146
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Menu;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class ModuleMenuSliderCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    // tests
+    public function tryToTest(Kasper $I)
+    {
+        $ids = ['#web', '#tools', '#system'];
+        $sees = ['Page', 'Extensions'];
+        $typo3Menu = '#typo3-menu';
+
+        $I->wantTo('check the slider in the module menu');
+
+        foreach ($ids as $id) {
+            $I->waitForElement($id);
+
+            // we close all
+            $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($id) {
+                return $webdriver->findElement(\WebDriverBy::cssSelector($id))->getAttribute('class');
+            });
+
+            if (strpos($classString, 'expanded') !== false) {
+                $I->click($id . ' > div');
+                $I->wait(2); // the animation is so fast
+            }
+        }
+
+        foreach ($sees as $see) {
+            $I->cantSee($see);
+        }
+
+        // we open all
+        foreach ($ids as $id) {
+            $I->click($id . ' > div');
+            $I->wait(2);
+        }
+
+        foreach ($sees as $see) {
+            $I->see($see);
+        }
+    }
+}
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php
new file mode 100644 (file)
index 0000000..5baa56e
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * This testcase is used to check if a page can be added with the page module.
+ */
+class AddPageInPageModuleCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    /**
+     * @env firefox
+     * @env chrome
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantToTest('Add a page with page module');
+        $I->click('Page');
+        $I->waitForElement('#typo3-navigationContainer');
+        $rootNode = '.x-tree-node:nth-child(1) > div > a';
+        $contextMenuNew = '#typo3-pagetree-contextmenu > ul > li:nth-child(2) > a > span.x-menu-item-text';
+        $I->waitForElement($rootNode);
+        $I->clickWithRightButton($rootNode);
+        $I->waitForElement($contextMenuNew);
+        $I->click($contextMenuNew);
+        $I->switchToIFrame('content');
+        $saveButton = 'body > div > div.module-docheader.t3js-module-docheader > div.module-docheader-bar.module-docheader-bar-buttons.t3js-module-docheader-bar.t3js-module-docheader-bar-buttons > div.module-docheader-bar-column-left > div > div > button:nth-child(1)';
+        $I->waitForElement($saveButton);
+
+        // Check empty
+        $I->amGoingTo('check empty error');
+        $I->click($saveButton);
+        $I->wait(2);
+        $generalTab = '#EditDocumentController > div > div:nth-child(1) > ul > li';
+        $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($generalTab) {
+            return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute('class');
+        });
+        $I->assertNotEquals(false, strpos($classString, 'has-validation-error'));
+        $I->switchToIFrame();
+    }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Page/InfoOnModuleCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Page/InfoOnModuleCest.php
new file mode 100644 (file)
index 0000000..e661860
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * This testcase is used to check if the expected information is found when
+ * the page module was opened.
+ */
+class InfoOnModuleCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    /**
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantToTest('Info is ok when select page module');
+        $I->click('Page');
+        $I->switchToIFrame('content');
+        $I->waitForElement('h4');
+        $I->see('Web>Page module');
+        $I->switchToIFrame();
+    }
+}
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Profile/UsernameOnAvatarCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Profile/UsernameOnAvatarCest.php
new file mode 100644 (file)
index 0000000..8319d9a
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Profile;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * This testcase is used to check if username is visible in the toolbar.
+ */
+class UsernameOnAvatarCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    /**
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->see('admin', '#typo3-cms-backend-backend-toolbaritems-usertoolbaritem');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchAdminCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchAdminCest.php
new file mode 100644 (file)
index 0000000..986b89c
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Search;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * This testcase searches for "ad" and expects to retrieve
+ * the admin backend user as result.
+ */
+class SearchAdminCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    // tests
+    public function tryToTest(\AcceptanceTester $I)
+    {
+        $liveSearchToolBarItem = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem';
+        $searchResultHeader = $liveSearchToolBarItem . ' > div > div > div:nth-child(1)';
+        $I->wantTo('Search "admin" with auto completion');
+        $I->fillField('#live-search-box', 'ad');
+        $I->waitForElement($searchResultHeader);
+        $dropDownHeader = $I->grabTextFrom($searchResultHeader);
+        $I->assertEquals('Backend user', $dropDownHeader);
+        $I->click($liveSearchToolBarItem . ' > div > div > div:nth-child(2) > a');
+        $I->switchToIFrame("content");
+        $I->waitForElement('#EditDocumentController');
+        $I->see('Edit Backend user "admin" on root level');
+        $I->switchToIFrame();
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchNoResultCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Search/SearchNoResultCest.php
new file mode 100644 (file)
index 0000000..46d24ed
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Search;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * This testcase performs a search in the backend and checks if
+ * no results get returned for the query "no results".
+ */
+class SearchNoResultCest
+{
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    // tests
+    public function tryToTest(Kasper $I)
+    {
+        $liveSearchToolBarItem = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem';
+        $searchDropdownInfo = $liveSearchToolBarItem . ' > div > div > div > div.dropdown-info';
+        $I->wantTo('Search "no" and check no result info');
+        $I->fillField('#live-search-box', 'no result');
+        // Using more than two letters to have better test stability on phantomjs
+        $I->waitForElement($searchDropdownInfo);
+        $dropdownHeader = $I->grabTextFrom($searchDropdownInfo);
+        $I->assertEquals('No results found.', $dropdownHeader);
+    }
+}