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