[TASK] Refactor scheduler task acceptance tests
[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
19 /**
20 * Scheduler task tests
21 */
22 class TasksCest
23 {
24 /**
25 * @param Admin $I
26 */
27 public function _before(Admin $I)
28 {
29 $I->useExistingSession();
30
31 $I->see('Scheduler', '#system_txschedulerM1');
32 $I->click('Scheduler', '#system_txschedulerM1');
33
34 // switch to content iframe
35 $I->switchToIFrame('content');
36 }
37
38 /**
39 * @param Admin $I
40 * @return Admin
41 */
42 public function createASchedulerTask(Admin $I)
43 {
44 $I->see('No tasks defined yet');
45 $I->click('//a[contains(@title, "Add task")]', '.module-docheader');
46
47 $I->cantSeeElement('#task_SystemStatusUpdateNotificationEmail');
48 $I->selectOption('#task_class', 'System Status Update');
49 $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
50
51 $I->selectOption('#task_type', 'Single');
52
53 $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
54
55 $I->click('button.dropdown-toggle', '.module-docheader');
56 $I->wantTo('Click "Save and close"');
57 $I->click("//a[contains(@data-value,'saveclose')]");
58
59 $I->waitForText('The task was added successfully.');
60
61 return $I;
62 }
63
64 /**
65 * @depends createASchedulerTask
66 * @param Admin $I
67 * @return Admin
68 */
69 public function canRunTask(Admin $I)
70 {
71 // run the task
72 $I->click('//a[contains(@title, "Run task")]');
73 $I->waitForText('Executed: System Status Update');
74
75 return $I;
76 }
77
78 /**
79 * @depends createASchedulerTask
80 * @param Admin $I
81 */
82 public function canDeleteTask(Admin $I)
83 {
84 // delete the task
85 $I->click('//a[contains(@title, "Delete")]');
86 $I->switchToIFrame();
87 $I->waitForElement('.t3-modal.modal');
88 $I->click('.t3-modal.modal .btn.btn-warning');
89 $I->switchToIFrame('content');
90 $I->see('The task was successfully deleted.');
91 $I->see('No tasks defined yet');
92 }
93 }