b86034d17c452acd419fd159366dbb786fea85c6
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Scheduler / TasksCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Scheduler;
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\Components\TestingFramework\Core\Acceptance\Step\Backend\Admin;
18 use TYPO3\Components\TestingFramework\Core\Acceptance\Support\Helper\ModalDialog;
19
20 /**
21 * Scheduler task tests
22 */
23 class TasksCest
24 {
25 /**
26 * @param Admin $I
27 */
28 public function _before(Admin $I)
29 {
30 $I->useExistingSession();
31 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
32 $I->switchToIFrame('list_frame');
33 $I->waitForText('Web Content Management System');
34 $I->switchToIFrame();
35 $I->see('Scheduler', '#system_txschedulerM1');
36 $I->click('Scheduler', '#system_txschedulerM1');
37 // switch to content iframe
38 $I->switchToIFrame('list_frame');
39 }
40
41 /**
42 * @param Admin $I
43 */
44 public function createASchedulerTask(Admin $I)
45 {
46 $I->see('No tasks defined yet');
47 $I->click('//a[contains(@title, "Add task")]', '.module-docheader');
48 $I->cantSeeElement('#task_SystemStatusUpdateNotificationEmail');
49 $I->selectOption('#task_class', 'System Status Update');
50 $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
51 $I->selectOption('#task_type', 'Single');
52 $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
53 $I->click('button.dropdown-toggle', '.module-docheader');
54 $I->wantTo('Click "Save and close"');
55 $I->click("//a[contains(@data-value,'saveclose')]");
56 $I->waitForText('The task was added successfully.');
57 }
58
59 /**
60 * @depends createASchedulerTask
61 * @param Admin $I
62 */
63 public function canRunTask(Admin $I)
64 {
65 // run the task
66 $I->click('//a[contains(@title, "Run task")]');
67 $I->waitForText('Executed: System Status Update');
68 $I->seeElement('.tx_scheduler_mod1 .disabled');
69 $I->see('disabled');
70 }
71
72 /**
73 * @depends createASchedulerTask
74 * @param Admin $I
75 */
76 public function canEditTask(Admin $I)
77 {
78 $I->click('//a[contains(@title, "Edit")]');
79 $I->waitForText('Edit task');
80 $I->seeInField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
81 $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'foo@local.typo3.org');
82 $I->click('button.dropdown-toggle', '.module-docheader');
83 $I->wantTo('Click "Save and close"');
84 $I->click("//a[contains(@data-value,'saveclose')]");
85 $I->waitForText('The task was updated successfully.');
86 }
87
88 /**
89 * @depends canRunTask
90 * @param Admin $I
91 */
92 public function canEnableAndDisableTask(Admin $I)
93 {
94 $I->wantTo('See a enable button for a task');
95 $I->click('//a[contains(@title, "Enable")]', '#tx_scheduler_form');
96 $I->dontSeeElement('.tx_scheduler_mod1 .disabled');
97 $I->dontSee('disabled');
98 $I->wantTo('See a disable button for a task');
99 $I->click('//a[contains(@title, "Disable")]');
100 $I->seeElement('.tx_scheduler_mod1 .disabled');
101 $I->see('disabled');
102 }
103
104 /**
105 * @depends createASchedulerTask
106 * @param Admin $I
107 * @param ModalDialog $modalDialog
108 */
109 public function canDeleteTask(Admin $I, ModalDialog $modalDialog)
110 {
111 $I->wantTo('See a delete button for a task');
112 $I->seeElement('//a[contains(@title, "Delete")]');
113 $I->click('//a[contains(@title, "Delete")]');
114 $I->wantTo('Cancel the delete dialog');
115 $modalDialog->clickButtonInDialog('Cancel');
116 $I->switchToIFrame('list_frame');
117 $I->wantTo('Still see and can click the Delete button as the deletion has been canceled');
118 $I->click('//a[contains(@title, "Delete")]');
119 $modalDialog->clickButtonInDialog('OK');
120 $I->switchToIFrame('list_frame');
121 $I->see('The task was successfully deleted.');
122 $I->see('No tasks defined yet');
123 }
124
125 /**
126 * @param Admin $I
127 */
128 public function canSwitchToSetupCheck(Admin $I)
129 {
130 $I->selectOption('select[name=SchedulerJumpMenu]', 'Setup check');
131 $I->see('Setup check');
132 $I->see('This screen checks if the requisites for running the Scheduler as a cron job are fulfilled');
133 }
134
135 /**
136 * @param Admin $I
137 */
138 public function canSwitchToInformation(Admin $I)
139 {
140 $I->selectOption('select[name=SchedulerJumpMenu]', 'Information');
141 $I->see('Information');
142 $I->canSeeNumberOfElements('.tx_scheduler_mod1 table tbody tr', [1, 10000]);
143 }
144 }