‪TYPO3CMS  11.5
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 
27 {
28  public function ‪_before(‪ApplicationTester $I): void
29  {
30  $I->useExistingSession('admin');
31  $I->scrollTo('#system_txschedulerM1');
32  $I->see('Scheduler', '#system_txschedulerM1');
33  $I->click('#system_txschedulerM1');
34  $I->switchToContentFrame();
35  }
36 
38  {
39  $I->see('No tasks defined yet');
40  $I->click('//a[contains(@title, "Add task")]', '.module-docheader');
41  $I->waitForElementNotVisible('#task_SystemStatusUpdateNotificationEmail');
42 
43  $I->amGoingTo('check save action in case no settings given');
44  $I->click('button.dropdown-toggle', '.module-docheader');
45  $I->click("//a[contains(@data-value,'saveclose')]");
46  $I->waitForText('No frequency was defined, either as an interval or as a cron command.', 5, '.alert');
47 
48  $I->selectOption('#task_class', 'System Status Update');
49  $I->seeElement('#task_SystemStatusUpdateNotificationEmail');
50  $I->selectOption('#task_type', 'Single');
51  $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
52  $I->click('button.dropdown-toggle', '.module-docheader');
53  $I->wantTo('Click "Save and close"');
54  $I->click("//a[contains(@data-value,'saveclose')]");
55  $I->waitForText('The task was added successfully.');
56  }
57 
61  public function ‪canRunTask(‪ApplicationTester $I): void
62  {
63  // run the task
64  $I->click('button[name="tx_scheduler[execute]"]');
65  $I->waitForText('Task "System Status Update (reports)" with uid "1" has been executed.');
66  $I->seeElement('.tx_scheduler_mod1 .disabled');
67  $I->see('disabled');
68  }
69 
73  public function ‪canEditTask(‪ApplicationTester $I): void
74  {
75  $I->click('//a[contains(@aria-label, "Edit")]');
76  $I->waitForText('Edit task');
77  $I->seeInField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
78  $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'foo@local.typo3.org');
79  $I->click('button.dropdown-toggle', '.module-docheader');
80  $I->wantTo('Click "Save and close"');
81  $I->click("//a[contains(@data-value,'saveclose')]");
82  $I->waitForText('The task was updated successfully.');
83  }
84 
89  {
90  $I->wantTo('See a enable button for a task');
91  $I->click('//a[contains(@aria-label, "Enable")]', '#tx_scheduler_form');
92  $I->dontSeeElement('.tx_scheduler_mod1 .disabled');
93  $I->dontSee('disabled');
94  $I->wantTo('See a disable button for a task');
95  // Give tooltips some time to fully init
96  $I->wait(1);
97  $I->moveMouseOver('//a[contains(@aria-label, "Disable")]');
98  $I->wait(1);
99  $I->click('//a[contains(@aria-label, "Disable")]');
100  $I->waitForElementVisible('div.tx_scheduler_mod1');
101  $I->seeElement('.tx_scheduler_mod1 .disabled');
102  $I->see('disabled');
103  }
104 
108  public function ‪canDeleteTask(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
109  {
110  $I->wantTo('See a delete button for a task');
111  $I->seeElement('//a[contains(@aria-label, "Delete")]');
112  $I->click('//a[contains(@aria-label, "Delete")]');
113  $I->wantTo('Cancel the delete dialog');
114 
115  // don't use $modalDialog->clickButtonInDialog due to too low timeout
116  $modalDialog->‪canSeeDialog();
118  $I->waitForElementNotVisible(‪ModalDialog::$openedModalSelector, 30);
119 
120  $I->switchToContentFrame();
121  $I->wantTo('Still see and can click the Delete button as the deletion has been canceled');
122  $I->click('//a[contains(@aria-label, "Delete")]');
123  $modalDialog->‪clickButtonInDialog('OK');
124  $I->switchToContentFrame();
125  $I->see('The task was successfully deleted.');
126  $I->see('No tasks defined yet');
127  }
128 
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 
138  {
139  $I->selectOption('select[name=SchedulerJumpMenu]', 'Information');
140  $I->waitForElementVisible('div.tx_scheduler_mod1');
141  $I->see('Information');
142  $I->canSeeNumberOfElements('.tx_scheduler_mod1 table tbody tr', [1, 10000]);
143  $I->selectOption('select[name=SchedulerJumpMenu]', 'Scheduled tasks');
144  }
145 
147  {
148  $I->amGoingTo('create a task when none exists yet');
149  $I->canSee('Scheduled tasks', 'h1');
150  $this->‪createASchedulerTask($I);
151 
152  $I->amGoingTo('test the new task group button on task edit view');
153  $I->click('.taskGroup-table > tbody > tr > td.nowrap > div:nth-child(1) > a:nth-child(1)');
154  $I->waitForElementNotVisible('#t3js-ui-block');
155  $I->canSee('Edit task', 'h2');
156  $I->click('#task_group_row > div > div > div > div > a');
157  $I->waitForElementNotVisible('#t3js-ui-block');
158  $I->canSee('Create new Scheduler task group on root level', 'h1');
159 
160  $I->fillField('//input[contains(@data-formengine-input-name, "data[tx_scheduler_task_group]") and contains(@data-formengine-input-name, "[groupName]")]', 'new task group');
161  $I->click('button[name="_savedok"]');
162  $I->wait(0.2);
163  $I->waitForElementNotVisible('#t3js-ui-block');
164  $I->click('a[title="Close"]');
165  $I->waitForElementVisible('#tx_scheduler_form');
166 
167  $I->selectOption('select#task_group', 'new task group');
168  $I->click('button[value="save"]');
169  $I->waitForElementNotVisible('#t3js-ui-block');
170  $I->click('a[title="Cancel"]');
171  $I->waitForElementVisible('div.tx_scheduler_mod1');
172 
173  $I->canSee('new task group', '.panel-heading');
174  }
175 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalSelector
‪static string $openedModalSelector
Definition: ModalDialog.php:33
‪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:88
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canCreateNewTaskGroupFromEditForm
‪canCreateNewTaskGroupFromEditForm(ApplicationTester $I)
Definition: TasksCest.php:146
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalButtonContainerSelector
‪static string $openedModalButtonContainerSelector
Definition: ModalDialog.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canRunTask
‪canRunTask(ApplicationTester $I)
Definition: TasksCest.php:61
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canDeleteTask
‪canDeleteTask(ApplicationTester $I, ModalDialog $modalDialog)
Definition: TasksCest.php:108
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canSwitchToSetupCheck
‪canSwitchToSetupCheck(ApplicationTester $I)
Definition: TasksCest.php:129
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler
Definition: TasksCest.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:73
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\clickButtonInDialog
‪clickButtonInDialog(string $buttonLinkLocator)
Definition: ModalDialog.php:62
‪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:73
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Scheduler\TasksCest\canSwitchToInformation
‪canSwitchToInformation(ApplicationTester $I)
Definition: TasksCest.php:137
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27