‪TYPO3CMS  11.5
RedirectModuleCest.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 
20 use Codeception\Example;
22 
27 {
28  public function ‪_before(‪ApplicationTester $I): void
29  {
30  $I->useExistingSession('admin');
31  $I->click('Redirects');
32  $I->switchToContentFrame();
33  $I->canSee('Redirect Management', 'h1');
34  }
35 
37  {
38  $I->amGoingTo('create a new redirects record while none are in the system, yet');
39  $I->canSee('No redirects found!');
40  $I->click('Create new redirect');
41  $I->waitForElementNotVisible('#t3js-ui-block');
42  $I->canSee('Create new Redirect on root level');
43 
44  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[source_path]")]', '/my-path/');
45  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_redirect]") and contains(@data-formengine-input-name, "[target]")]', 1);
46 
47  $saveButtonLink = '//*/button[@name="_savedok"][1]';
48  $I->waitForElement($saveButtonLink, 30);
49  $I->click($saveButtonLink);
50  $I->waitForElementNotVisible('#t3js-ui-block');
51 
52  $I->click('div.module-docheader .btn.t3js-editform-close');
53 
54  $I->waitForElementVisible('table.table-striped');
55  $I->canSee('Redirect Management', 'h1');
56  $I->canSeeNumberOfElements('table.table-striped > tbody > tr', 1);
57  }
58 
60  {
61  $sourceHost = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(1)');
62  $sourcePath = $I->grabTextFrom('table.table-striped > tbody > tr > td:nth-child(2) > a');
63 
64  $I->amGoingTo('test edit on source path');
65  $I->click('table.table-striped > tbody > tr > td:nth-child(2) > a');
66  $I->waitForElementNotVisible('#t3js-ui-block');
67  $I->canSee('Edit Redirect "' . $sourceHost . ', ' . $sourcePath . '" on root level');
68  $I->click('div.module-docheader .btn.t3js-editform-close');
69  $I->waitForElementVisible('table.table-striped');
70  $I->canSee('Redirect Management', 'h1');
71 
72  $I->amGoingTo('test edit on edit button');
73  $I->click('table.table-striped > tbody > tr > td:last-child > div > a:nth-child(2)');
74  $I->waitForElementNotVisible('#t3js-ui-block');
75  $I->canSee('Edit Redirect "' . $sourceHost . ', ' . $sourcePath . '" on root level');
76  $I->click('div.module-docheader .btn.t3js-editform-close');
77  $I->waitForElementVisible('table.table-striped');
78  $I->canSee('Redirect Management', 'h1');
79  }
80 
85  public function ‪seeStatusCodesWhenCreatingNewRedirect(‪ApplicationTester $I, Example $example): void
86  {
87  $I->amGoingTo('Create a redirect and see the different status codes');
88  $I->click('a[title="Add redirect"]');
89  $I->waitForElementNotVisible('#t3js-ui-block');
90  $I->canSee('Create new Redirect on root level');
91  $I->seeElement('//select[contains(@name, "data[sys_redirect]") and contains(@name, "[target_statuscode]")]//option[@value="' . $example['code'] . '"]');
92  }
93 
94  protected function ‪possibleRedirectStatusCodes(): array
95  {
96  return [
97  ['code' => 301],
98  ['code' => 302],
99  ['code' => 303],
100  ['code' => 307],
101  ['code' => 308],
102  ];
103  }
104 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest\canEditRecordFromListView
‪canEditRecordFromListView(ApplicationTester $I)
Definition: RedirectModuleCest.php:59
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect
Definition: RedirectModuleCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest\createNewRecordIfNoneExist
‪createNewRecordIfNoneExist(ApplicationTester $I)
Definition: RedirectModuleCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest
Definition: RedirectModuleCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest\possibleRedirectStatusCodes
‪possibleRedirectStatusCodes()
Definition: RedirectModuleCest.php:94
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest\_before
‪_before(ApplicationTester $I)
Definition: RedirectModuleCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Redirect\RedirectModuleCest\seeStatusCodesWhenCreatingNewRedirect
‪seeStatusCodesWhenCreatingNewRedirect(ApplicationTester $I, Example $example)
Definition: RedirectModuleCest.php:85