‪TYPO3CMS  ‪main
TasksCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
26 final class ‪TasksCest
27 {
28  public function ‪_before(‪ApplicationTester $I): void
29  {
30  $I->useExistingSession('admin');
31  $I->scrollTo('[data-modulemenu-identifier="scheduler"]');
32  $I->see('Scheduler', '[data-modulemenu-identifier="scheduler"]');
33  $I->click('[data-modulemenu-identifier="scheduler"]');
34  $I->switchToContentFrame();
35  }
36 
38  {
39  $I->see('No tasks defined yet');
40  $I->click('//a[contains(@title, "New task")]', '.module-docheader');
41  $I->waitForElementNotVisible('#task_SystemStatusUpdateNotificationEmail');
42 
43  $I->amGoingTo('check save action in case no settings given');
44  $I->click('button[value="save"]');
45  $I->waitForText('No frequency was defined, either as an interval or as a cron command.');
46 
47  $I->selectOption('#task_class', 'System Status Update');
48  $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
49  $I->selectOption('#task_type', 'Single');
50  $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
51  $I->wantTo('Click "Save"');
52  $I->click('button[value="save"]');
53  $I->waitForText('The task was added successfully.');
54  $I->click('a[title="Close"]');
55  }
56 
57  public function ‪canRunTask(‪ApplicationTester $I): void
58  {
59  // run the task
60  $I->click('button[name="execute"]');
61  $I->waitForText('Task "System Status Update (reports)" with uid');
62  $I->seeElement('[data-module-name="scheduler_manage"] tr[data-task-disabled="true"]');
63  $I->see('disabled');
64  }
65 
66  public function ‪canEditTask(‪ApplicationTester $I): void
67  {
68  $I->click('//a[contains(@title, "Edit")]');
69  $I->waitForText('Edit scheduled task "System Status Update (reports)"');
70  $I->seeInField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
71  $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'foo@local.typo3.org');
72  $I->wantTo('Click "Save"');
73  $I->click('button[value="save"]');
74  $I->waitForText('The task was updated successfully.');
75  }
76 
78  {
79  $I->wantTo('See an enable button for a task');
80  $I->click('//button[contains(@title, "Enable")]', '#tx_scheduler_form_0');
81  $I->dontSeeElement('[data-module-name="scheduler_manage"] tr[data-task-disabled="true"]');
82  $I->dontSee('disabled');
83  $I->wantTo('See a disable button for a task');
84  // Give tooltips some time to fully init
85  $I->wait(1);
86  $I->moveMouseOver('//button[contains(@title, "Disable")]');
87  $I->wait(1);
88  $I->click('//button[contains(@title, "Disable")]');
89  $I->waitForElementVisible('[data-module-name="scheduler_manage"]');
90  $I->seeElement('[data-module-name="scheduler_manage"] tr[data-task-disabled="true"]');
91  $I->see('disabled');
92  }
93 
94  public function ‪canDeleteTask(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
95  {
96  $I->wantTo('See a delete button for a task');
97  $I->seeElement('//button[contains(@title, "Delete")]');
98  $I->click('//button[contains(@title, "Delete")]');
99  $I->wantTo('Cancel the delete dialog');
100 
101  // don't use $modalDialog->clickButtonInDialog due to too low timeout
102  $modalDialog->‪canSeeDialog();
104  $I->waitForElementNotVisible(‪ModalDialog::$openedModalSelector, 30);
105 
106  $I->switchToContentFrame();
107  $I->wantTo('Still see and can click the Delete button as the deletion has been canceled');
108  $I->click('//button[contains(@title, "Delete")]');
109  $modalDialog->‪clickButtonInDialog('OK');
110  $I->switchToContentFrame();
111  $I->see('The task was successfully deleted.');
112  $I->see('No tasks defined yet');
113  }
114 
116  {
117  $I->selectOption('select[name=moduleMenu]', 'Scheduler setup check');
118  $I->waitForElementVisible('[data-module-name="scheduler_setupcheck"]');
119  $I->see('Scheduler setup check');
120  $I->see('This screen checks if the requisites for running the Scheduler as a cron job are fulfilled');
121  }
122 
124  {
125  $I->selectOption('select[name=moduleMenu]', 'Available scheduler commands & tasks');
126  $I->waitForElementVisible('[data-module-name="scheduler_availabletasks"]');
127  $I->see('Available scheduler commands & tasks');
128  $I->canSeeNumberOfElements('[data-module-name="scheduler_availabletasks"] table tbody tr', [1, 10000]);
129  $I->selectOption('select[name=moduleMenu]', 'Scheduled tasks');
130  }
131 
133  {
134  $I->amGoingTo('create a task when none exists yet');
135  $I->canSee('Scheduled tasks', 'h1');
136  $this->‪createASchedulerTask($I);
137 
138  $I->amGoingTo('test the new task group button on task edit view');
139  $I->click('[data-scheduler-table] > tbody > tr > td.col-control > div:nth-child(1) > a:nth-child(1)');
140  $I->waitForElementNotVisible('#t3js-ui-block');
141  $I->canSee('Edit scheduled task "System Status Update (reports)"');
142  $I->click('#task_group_row button.t3js-create-group');
143  $modalDialog->‪canSeeDialog();
144 
145  $I->fillField('.modal.show input[name="action[createGroup]"]', 'new task group');
146  $modalDialog->‪clickButtonInDialog('Create group');
147  $I->switchToContentFrame();
148  $I->selectOption('select#task_group', 'new task group');
149  $I->click('button[value="save"]');
150  $I->waitForElementNotVisible('#t3js-ui-block');
151  $I->click('a[title="Close"]');
152  $I->waitForElementVisible('[data-module-name="scheduler_manage"]');
153 
154  $I->canSee('new task group', '.panel-heading');
155  }
156 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalSelector
‪static string $openedModalSelector
Definition: ModalDialog.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest
Definition: TasksCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canEnableAndDisableTask
‪canEnableAndDisableTask(ApplicationTester $I)
Definition: TasksCest.php:77
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalButtonContainerSelector
‪static string $openedModalButtonContainerSelector
Definition: ModalDialog.php:37
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canRunTask
‪canRunTask(ApplicationTester $I)
Definition: TasksCest.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canDeleteTask
‪canDeleteTask(ApplicationTester $I, ModalDialog $modalDialog)
Definition: TasksCest.php:94
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canSwitchToSetupCheck
‪canSwitchToSetupCheck(ApplicationTester $I)
Definition: TasksCest.php:115
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler
Definition: TaskGroupsCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\createASchedulerTask
‪createASchedulerTask(ApplicationTester $I)
Definition: TasksCest.php:37
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\canSeeDialog
‪canSeeDialog()
Definition: ModalDialog.php:68
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\clickButtonInDialog
‪clickButtonInDialog(string $buttonLinkLocator)
Definition: ModalDialog.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\_before
‪_before(ApplicationTester $I)
Definition: TasksCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canEditTask
‪canEditTask(ApplicationTester $I)
Definition: TasksCest.php:66
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canCreateNewTaskGroupFromEditForm
‪canCreateNewTaskGroupFromEditForm(ApplicationTester $I, ModalDialog $modalDialog)
Definition: TasksCest.php:132
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canSwitchToInformation
‪canSwitchToInformation(ApplicationTester $I)
Definition: TasksCest.php:123
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:24