[TASK] Refactor scheduler task acceptance tests 67/47667/4
authorSascha Egerer <sascha@sascha-egerer.de>
Thu, 14 Apr 2016 14:00:06 +0000 (16:00 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 14 Apr 2016 19:06:51 +0000 (21:06 +0200)
* Use Admin Actor
* Rename the class / test
* Split the test in smaller pieces
* Make the test more robust
* Add test for deleting a scheduler task

Change-Id: I0b1c0e326bc27590311451fd46cb40600af30719
Resolves: #75618
Releases: master
Reviewed-on: https://review.typo3.org/47667
Reviewed-by: Dirk Jüttner <dirk.juettner@gmail.com>
Tested-by: Dirk Jüttner <dirk.juettner@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php [new file with mode: 0644]

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php
deleted file mode 100644 (file)
index 9eb2f20..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Scheduler;
-
-/*
- * 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 CreateASchedulerTaskCest
-{
-    /**
-     * @param Kasper $I
-     */
-    public function _before(Kasper $I)
-    {
-        $I->loginAsAdmin();
-    }
-
-    /**
-     * @param Kasper $I
-     */
-    public function _after(Kasper $I)
-    {
-        $I->logout();
-    }
-
-    /**
-     * @param Kasper $I
-     */
-    public function tryToTest(Kasper $I)
-    {
-        $I->wantTo("To create a scheduler task");
-        $I->see('Scheduler', '#system_txschedulerM1');
-        $I->click('Scheduler', '#system_txschedulerM1');
-
-        // switch to content iframe
-        $I->switchToIFrame('content');
-
-        // create a new task
-        $I->see('No tasks defined yet');
-        $I->click("//a[contains(@title, 'Add task')]");
-        $I->selectOption("form select[id=task_class]", 'System Status Update');
-        $I->selectOption("form select[id=task_type]", 'Single');
-        $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
-        $I->click("div.module button.dropdown-toggle");
-        $I->click("//a[contains(@data-value,'saveclose')]");
-        $I->waitForText('The task was added successfully.');
-
-        // run the task
-        $I->click("//a[contains(@title, 'Run task')]");
-        $I->waitForText('Executed: System Status Update');
-
-        // leave the iframe
-        $I->switchToIFrame();
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php
new file mode 100644 (file)
index 0000000..15990f8
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Scheduler;
+
+/*
+ * 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;
+
+/**
+ * Scheduler task tests
+ */
+class TasksCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+
+        $I->see('Scheduler', '#system_txschedulerM1');
+        $I->click('Scheduler', '#system_txschedulerM1');
+
+        // switch to content iframe
+        $I->switchToIFrame('content');
+    }
+
+    /**
+     * @param Admin $I
+     * @return Admin
+     */
+    public function createASchedulerTask(Admin $I)
+    {
+        $I->see('No tasks defined yet');
+        $I->click('//a[contains(@title, "Add task")]', '.module-docheader');
+
+        $I->cantSeeElement('#task_SystemStatusUpdateNotificationEmail');
+        $I->selectOption('#task_class', 'System Status Update');
+        $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
+
+        $I->selectOption('#task_type', 'Single');
+
+        $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
+
+        $I->click('button.dropdown-toggle', '.module-docheader');
+        $I->wantTo('Click "Save and close"');
+        $I->click("//a[contains(@data-value,'saveclose')]");
+
+        $I->waitForText('The task was added successfully.');
+
+        return $I;
+    }
+
+    /**
+     * @depends createASchedulerTask
+     * @param Admin $I
+     * @return Admin
+     */
+    public function canRunTask(Admin $I)
+    {
+        // run the task
+        $I->click('//a[contains(@title, "Run task")]');
+        $I->waitForText('Executed: System Status Update');
+
+        return $I;
+    }
+
+    /**
+     * @depends createASchedulerTask
+     * @param Admin $I
+     */
+    public function canDeleteTask(Admin $I)
+    {
+        // delete the task
+        $I->click('//a[contains(@title, "Delete")]');
+        $I->switchToIFrame();
+        $I->waitForElement('.t3-modal.modal');
+        $I->click('.t3-modal.modal .btn.btn-warning');
+        $I->switchToIFrame('content');
+        $I->see('The task was successfully deleted.');
+        $I->see('No tasks defined yet');
+    }
+}