287f628d03de1700ea06c828017789ce0d216156
[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\Step\Backend\Admin;
18 use TYPO3\CMS\Core\Tests\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
32 $I->see('Scheduler', '#system_txschedulerM1');
33 $I->click('Scheduler', '#system_txschedulerM1');
34
35 // switch to content iframe
36 $I->switchToIFrame('contentIframe');
37 }
38
39 /**
40 * @param Admin $I
41 * @return Admin
42 */
43 public function createASchedulerTask(Admin $I)
44 {
45 $I->see('No tasks defined yet');
46 $I->click('//a[contains(@title, "Add task")]', '.module-docheader');
47
48 $I->cantSeeElement('#task_SystemStatusUpdateNotificationEmail');
49 $I->selectOption('#task_class', 'System Status Update');
50 $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
51
52 $I->selectOption('#task_type', 'Single');
53
54 $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
55
56 $I->click('button.dropdown-toggle', '.module-docheader');
57 $I->wantTo('Click "Save and close"');
58 $I->click("//a[contains(@data-value,'saveclose')]");
59
60 $I->waitForText('The task was added successfully.');
61
62 return $I;
63 }
64
65 /**
66 * @depends createASchedulerTask
67 * @param Admin $I
68 * @return Admin
69 */
70 public function canRunTask(Admin $I)
71 {
72 // run the task
73 $I->click('//a[contains(@title, "Run task")]');
74 $I->waitForText('Executed: System Status Update');
75
76 return $I;
77 }
78
79 /**
80 * @depends createASchedulerTask
81 * @param Admin $I
82 * @param ModalDialog $modalDialog
83 */
84 public function canDeleteTask(Admin $I, ModalDialog $modalDialog)
85 {
86 $I->wantTo('See a delete button for a task');
87 $I->seeElement('//a[contains(@title, "Delete")]');
88
89 $I->click('//a[contains(@title, "Delete")]');
90 $I->wantTo('Cancel the delete dialog');
91 $modalDialog->clickButtonInDialog('Cancel');
92 $I->switchToIFrame('contentIframe');
93
94 $I->wantTo('Still see and can click the Delete button as the deletion has been canceled');
95 $I->click('//a[contains(@title, "Delete")]');
96 $modalDialog->clickButtonInDialog('OK');
97
98 $I->switchToIFrame('contentIframe');
99 $I->see('The task was successfully deleted.');
100 $I->see('No tasks defined yet');
101 }
102 }