[TASK] Add basic test for category 96/48096/4
authorAdam Marcinkowski <a.marcinkowski@macopedia.pl>
Thu, 12 May 2016 09:44:33 +0000 (11:44 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 12 May 2016 16:23:54 +0000 (18:23 +0200)
* Add fixture with categories
* Add test to check if categories are visible in list module
* Add test to check if category is editable

Releases: master
Resolves: #76162
Change-Id: Ia518e059d23238f52f79224acffccd21bf8aaa88
Reviewed-on: https://review.typo3.org/48096
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/Tests/Acceptance/Backend/Formhandler/CategoryTreeCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Fixtures/sys_category.xml [new file with mode: 0644]
typo3/sysext/core/Tests/AcceptanceCoreEnvironment.php

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/CategoryTreeCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/CategoryTreeCest.php
new file mode 100644 (file)
index 0000000..fc98a43
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
+
+/*
+ * 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\Admin;
+
+/**
+ * Category tree tests
+ */
+class CategoryTreeCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function checkIfCategoryListIsAvailable(Admin $I)
+    {
+        // A sub-element of web module is show
+        $I->waitForElementVisible('#web .typo3-module-menu-group-container .typo3-module-menu-item');
+        $I->click('#web_list');
+        $I->switchToIFrame('content');
+        $I->waitForElement('#recordlist-sys_category');
+        $I->seeNumberOfElements('#recordlist-sys_category table > tbody > tr', [5,100]);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function editCategoryItem(Admin $I)
+    {
+        // A sub-element of web module is show
+        $I->waitForElementVisible('#web .typo3-module-menu-group-container .typo3-module-menu-item');
+        $I->click('#web_list');
+        $I->switchToIFrame('content');
+        // Select category with id 7
+        $I->click('#recordlist-sys_category tr[data-uid="7"] a[data-original-title="Edit record"]');
+        // Change title and level to root
+        $I->fillField('input[data-formengine-input-name="data[sys_category][7][title]"]','level-1-4');
+        $I->click('div[ext\:tree-node-id="7"]');
+        $I->click('div[ext\:tree-node-id="3"]');
+        $I->click('button[name="_savedok"]');
+        // Wait for tree and check if isset level-1-4
+        $I->waitForElement('.x-panel.x-tree');
+        $I->see('level-1-4', '.x-panel.x-tree');
+    }
+
+
+
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Fixtures/sys_category.xml b/typo3/sysext/core/Tests/Acceptance/Fixtures/sys_category.xml
new file mode 100644 (file)
index 0000000..fab5572
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<dataset>
+    <sys_category>
+        <uid>1</uid>
+        <pid>0</pid>
+        <title>level-1-1</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>2</uid>
+        <parent>1</parent>
+        <pid>0</pid>
+        <title>level-1-1-1</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>3</uid>
+        <parent>2</parent>
+        <pid>0</pid>
+        <title>level-1-1-1-1</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>4</uid>
+        <parent>2</parent>
+        <pid>0</pid>
+        <title>level-1-1-1-2</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>5</uid>
+        <parent>2</parent>
+        <pid>0</pid>
+        <title>level-1-1-1-3</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>6</uid>
+        <parent>3</parent>
+        <pid>0</pid>
+        <title>level-1-1-1-1-1</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>7</uid>
+        <parent>3</parent>
+        <pid>0</pid>
+        <title>level-1-1-1-1-2</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>8</uid>
+        <pid>0</pid>
+        <title>level-1-2</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>9</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-1</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>10</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-2</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>11</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-3</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>12</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-4</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>13</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-5</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>14</uid>
+        <parent>8</parent>
+        <pid>0</pid>
+        <title>level-1-2-6</title>
+        <deleted>0</deleted>
+    </sys_category>
+    <sys_category>
+        <uid>15</uid>
+        <pid>0</pid>
+        <title>level-1-3</title>
+        <deleted>0</deleted>
+    </sys_category>
+</dataset>
index ebe8ae3..f5d134c 100644 (file)
@@ -135,6 +135,7 @@ class AcceptanceCoreEnvironment extends Extension
         'typo3/sysext/core/Tests/Acceptance/Fixtures/be_users.xml',
         'typo3/sysext/core/Tests/Acceptance/Fixtures/be_sessions.xml',
         'typo3/sysext/core/Tests/Acceptance/Fixtures/be_groups.xml',
+        'typo3/sysext/core/Tests/Acceptance/Fixtures/sys_category.xml',
     ];
 
     /**