From 028aecf5f31082afbb791239feec806938ef1b11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gordon=20Br=C3=BCggemann?=
 <gordon.brueggemann@di-unternehmer.com>
Date: Mon, 24 Oct 2016 17:31:03 +0200
Subject: [PATCH] [TASK] Acceptance test for Scheduler task

Resolves: #78404
Releases: master
Change-Id: I80c1155631702b4632018624d42362e648cb42a8
Reviewed-on: https://review.typo3.org/50344
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Daniel Lorenz <info@extco.de>
Tested-by: Daniel Lorenz <info@extco.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Backend/Scheduler/TasksCest.php           | 68 +++++++++++++++----
 1 file changed, 53 insertions(+), 15 deletions(-)

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php
index bfb1434630a7..cb451bfbc1d2 100644
--- a/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/TasksCest.php
@@ -32,52 +32,73 @@ class TasksCest
         $I->switchToIFrame('list_frame');
         $I->waitForText('Web Content Management System');
         $I->switchToIFrame();
-
         $I->see('Scheduler', '#system_txschedulerM1');
         $I->click('Scheduler', '#system_txschedulerM1');
-
         // switch to content iframe
         $I->switchToIFrame('list_frame');
     }
 
     /**
      * @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');
+        $I->seeElement('.tx_scheduler_mod1 .disabled');
+        $I->see('disabled');
+    }
+
+    /**
+     * @depends createASchedulerTask
+     * @param Admin $I
+     */
+    public function canEditTask(Admin $I)
+    {
+        $I->click('//a[contains(@title, "Edit")]');
+        $I->waitForText('Edit task');
+        $I->seeInField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
+        $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'foo@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 updated successfully.');
+    }
 
-        return $I;
+    /**
+     * @depends canRunTask
+     * @param Admin $I
+     */
+    public function canEnableAndDisableTask(Admin $I)
+    {
+        $I->wantTo('See a enable button for a task');
+        $I->click('//a[contains(@title, "Enable")]', '#tx_scheduler_form');
+        $I->dontSeeElement('.tx_scheduler_mod1 .disabled');
+        $I->dontSee('disabled');
+        $I->wantTo('See a disable button for a task');
+        $I->click('//a[contains(@title, "Disable")]');
+        $I->seeElement('.tx_scheduler_mod1 .disabled');
+        $I->see('disabled');
     }
 
     /**
@@ -89,18 +110,35 @@ class TasksCest
     {
         $I->wantTo('See a delete button for a task');
         $I->seeElement('//a[contains(@title, "Delete")]');
-
         $I->click('//a[contains(@title, "Delete")]');
         $I->wantTo('Cancel the delete dialog');
         $modalDialog->clickButtonInDialog('Cancel');
         $I->switchToIFrame('list_frame');
-
         $I->wantTo('Still see and can click the Delete button as the deletion has been canceled');
         $I->click('//a[contains(@title, "Delete")]');
         $modalDialog->clickButtonInDialog('OK');
-
         $I->switchToIFrame('list_frame');
         $I->see('The task was successfully deleted.');
         $I->see('No tasks defined yet');
     }
+
+    /**
+     * @param Admin $I
+     */
+    public function canSwitchToSetupCheck(Admin $I)
+    {
+        $I->selectOption('select[name=SchedulerJumpMenu]', 'Setup check');
+        $I->see('Setup check');
+        $I->see('This screen checks if the requisites for running the Scheduler as a cron job are fulfilled');
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function canSwitchToInformation(Admin $I)
+    {
+        $I->selectOption('select[name=SchedulerJumpMenu]', 'Information');
+        $I->see('Information');
+        $I->canSeeNumberOfElements('.tx_scheduler_mod1 table tbody tr', [1, 10000]);
+    }
 }
-- 
GitLab