2 declare(strict_types
= 1);
4 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Redirect
;
7 * This file is part of the TYPO3 CMS project.
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
16 * The TYPO3 project - inspiring people to share!
19 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin
;
22 * Tests concerning Redirects Module
24 class RedirectModuleCest
30 public function _before(Admin
$I)
32 $I->useExistingSession();
34 $I->click('Redirects');
35 $I->switchToContentFrame();
36 $I->canSee('Redirect Management', 'h1');
42 public function createNewRecordIfNoneExist(Admin
$I)
44 $I->amGoingTo('create a new redirects record while none are in the system, yet');
45 $I->canSee('No redirects found!');
46 $I->click('Create new redirect');
47 $I->waitForElementNotVisible('#t3js-ui-block');
48 $I->canSee('Create new Redirect on root level');
50 $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[source_path]")]', '/my-path/');
51 $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[target]")]', 1);
53 $saveButtonLink = '//*/button[@name="_savedok"][1]';
54 $I->waitForElement($saveButtonLink, 30);
55 $I->click($saveButtonLink);
56 $I->waitForElementNotVisible('#t3js-ui-block');
58 $I->click('div.module-docheader .btn.t3js-editform-close');
60 $I->waitForElementVisible('table.table-striped');
61 $I->canSee('Redirect Management', 'h1');
62 $I->canSeeNumberOfElements('table.table-striped > tbody > tr', 1);
68 public function canEditRecordFromListView(Admin
$I)
70 $sourceHost = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(1)');
71 $sourcePath = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(2) > a');
73 $I->amGoingTo('test edit on source path');
74 $I->click('table.table-striped > tbody > tr > td:nth-child(2) > a');
75 $this->openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
77 $I->amGoingTo('test edit on edit button');
78 $I->click('table.table-striped > tbody > tr > td:nth-child(6) > div > a:nth-child(2)');
79 $this->openAndCloseTheEditForm($I, $sourceHost . ', ' . $sourcePath);
86 private function openAndCloseTheEditForm(Admin
$I, string $name): void
88 $I->waitForElementNotVisible('#t3js-ui-block');
89 $I->canSee('Edit Redirect "' . $name . '" on root level');
91 $I->click('div.module-docheader .btn.t3js-editform-close');
92 $I->waitForElementVisible('table.table-striped');
93 $I->canSee('Redirect Management', 'h1');