‪TYPO3CMS  9.5
RedirectModuleCest.php
Go to the documentation of this file.
1 <?php
2 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 
24 {
25 
29  public function ‪_before(‪BackendTester $I)
30  {
31  $I->useExistingSession('admin');
32 
33  $I->click('Redirects');
34  $I->switchToContentFrame();
35  $I->canSee('Redirect Management', 'h1');
36  }
37 
42  {
43  $I->amGoingTo('create a new redirects record while none are in the system, yet');
44  $I->canSee('No redirects found!');
45  $I->click('Create new redirect');
46  $I->waitForElementNotVisible('#t3js-ui-block');
47  $I->canSee('Create new Redirect on root level');
48 
49  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[source_path]")]', '/my-path/');
50  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[target]")]', 1);
51 
52  $saveButtonLink = '//*/button[@name="_savedok"][1]';
53  $I->waitForElement($saveButtonLink, 30);
54  $I->click($saveButtonLink);
55  $I->waitForElementNotVisible('#t3js-ui-block');
56 
57  $I->click('div.module-docheader .btn.t3js-editform-close');
58 
59  $I->waitForElementVisible('table.table-striped');
60  $I->canSee('Redirect Management', 'h1');
61  $I->canSeeNumberOfElements('table.table-striped > tbody > tr', 1);
62  }
63 
68  {
69  $sourceHost = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(1)');
70  $sourcePath = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(2) > a');
71 
72  $I->amGoingTo('test edit on source path');
73  $I->click('table.table-striped > tbody > tr > td:nth-child(2) > a');
74  $this->‪openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
75 
76  $I->amGoingTo('test edit on edit button');
77  $I->click('table.table-striped > tbody > tr > td:nth-child(6) > div > a:nth-child(2)');
78  $this->‪openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
79  }
80 
85  private function ‪openAndCloseTheEditForm(‪BackendTester $I, string $name): void
86  {
87  $I->waitForElementNotVisible('#t3js-ui-block');
88  $I->canSee('Edit Redirect "' . $name . '" on root level');
89 
90  $I->click('div.module-docheader .btn.t3js-editform-close');
91  $I->waitForElementVisible('table.table-striped');
92  $I->canSee('Redirect Management', 'h1');
93  }
94 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect\RedirectModuleCest\openAndCloseTheEditForm
‪openAndCloseTheEditForm(BackendTester $I, string $name)
Definition: RedirectModuleCest.php:85
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect\RedirectModuleCest\createNewRecordIfNoneExist
‪createNewRecordIfNoneExist(BackendTester $I)
Definition: RedirectModuleCest.php:41
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect\RedirectModuleCest\_before
‪_before(BackendTester $I)
Definition: RedirectModuleCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect\RedirectModuleCest
Definition: RedirectModuleCest.php:24
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect
Definition: RedirectModuleCest.php:3
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect\RedirectModuleCest\canEditRecordFromListView
‪canEditRecordFromListView(BackendTester $I)
Definition: RedirectModuleCest.php:67