‪TYPO3CMS  11.5
DbCheckModuleCest.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;
21 use Facebook\WebDriver\Remote\RemoteWebDriver;
22 use Facebook\WebDriver\Remote\RemoteWebElement;
25 
30 {
31  protected static string ‪$defaultDashboardTitle = 'My Dashboard';
32 
36  public function ‪_before(‪ApplicationTester $I): void
37  {
38  $I->useExistingSession('admin');
39  $I->click('#system_dbint');
40  $I->switchToContentFrame();
41  }
42 
46  public function ‪seeOverview(‪ApplicationTester $I): void
47  {
48  $I->see('Database integrity check', 'h1');
49  $I->see('Records Statistics', 'a');
50  $I->see('Relations', 'a');
51  $I->see('Search', 'a');
52  $I->see('Check and update global reference index', 'a');
53  }
54 
60  public function ‪seeRecordStatistics(‪ApplicationTester $I, Example $testData): void
61  {
62  $this->‪goToPageAndSeeHeadline($I, 'Record Statistics', 'Records Statistics');
63 
64  $count = $this->‪getCountByRowName($I, $testData['name'])->getText();
65  // Use >= here to make sure we don't get in trouble with other tests creating db entries
66  $I->assertGreaterThanOrEqual($testData['count'], $count);
67  }
68 
73  {
74  $this->‪goToPageAndSeeHeadline($I, 'Database Relations', 'Relations');
75  $I->see('Select fields', 'h2');
76  $I->see('Group fields', 'h2');
77  }
78 
82  public function ‪seeFullSearch(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
83  {
84  $this->‪goToPageAndSeeHeadline($I, 'Full search', 'Search whole Database');
85  $I->see('Search options', 'h2');
86  $I->see('Result', 'h2');
87 
88  // Fill in search phrase and check results
89  $I->fillField('input[name="SET[sword]"]', 'styleguide demo group 1');
90  $I->click('Search All Records');
91  $I->see('styleguide demo group 1', 'td');
92  $I->dontSee('styleguide demo group 2', 'td');
93 
94  // Open info modal and see text in card
95  $I->click('a[data-dispatch-args-list]');
96  $modalDialog->‪canSeeDialog();
97  $I->switchToIFrame('.modal-iframe');
98  $I->see('styleguide demo group 1', '.card-title');
99  }
100 
105  {
106  $this->‪goToPageAndSeeHeadline($I, 'Manage Reference Index', 'Manage Reference Index');
107 
108  $I->click('Check reference index');
109  $I->waitForElement('.alert');
110 
111  $I->click('Update reference index');
112  $I->waitForElement('.alert');
113 
114  $I->click('Check reference index');
115  $I->waitForElement('.alert-success');
116  $I->see('Index Integrity was perfect!', '.alert-success');
117 
118  $I->click('Update reference index');
119  $I->see('Index Integrity was perfect!', '.alert-success');
120  }
121 
125  protected function ‪recordStatisticsDataProvider(): array
126  {
127  return [
128  [
129  'name' => 'Total number of default language pages',
130  'count' => 84,
131  ],
132  [
133  'name' => 'Total number of translated pages',
134  'count' => 132,
135  ],
136  [
137  'name' => 'Marked-deleted pages',
138  'count' => 0,
139  ],
140  [
141  'name' => 'Hidden pages',
142  'count' => 1,
143  ],
144  [
145  'name' => 'Standard',
146  'count' => 1,
147  ],
148  [
149  'name' => 'Backend User Section',
150  'count' => 0,
151  ],
152  [
153  'name' => 'Link to External URL',
154  'count' => 0,
155  ],
156  ];
157  }
158 
164  protected function ‪goToPageAndSeeHeadline(‪ApplicationTester $I, string $select, string $headline): void
165  {
166  $I->selectOption('select[name=DatabaseJumpMenu]', $select);
167  $I->see($headline, 'h1');
168  }
169 
177  protected function ‪getCountByRowName(‪ApplicationTester $I, string $rowName, int $sibling = 1): RemoteWebElement
178  {
179  $I->comment('Get context for table row "' . $rowName . '"');
180  return $I->executeInSelenium(
181  static function (RemoteWebDriver $webDriver) use ($rowName, $sibling) {
182  return $webDriver->findElement(
183  \Facebook\WebDriver\WebDriverBy::xpath(
184  '//td[contains(text(),"' . $rowName . '")]/following-sibling::td[' . $sibling . ']'
185  )
186  );
187  }
188  );
189  }
190 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest
Definition: DbCheckModuleCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\seeRecordStatistics
‪seeRecordStatistics(ApplicationTester $I, Example $testData)
Definition: DbCheckModuleCest.php:60
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\$defaultDashboardTitle
‪static string $defaultDashboardTitle
Definition: DbCheckModuleCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\getCountByRowName
‪RemoteWebElement getCountByRowName(ApplicationTester $I, string $rowName, int $sibling=1)
Definition: DbCheckModuleCest.php:177
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\canSeeDialog
‪canSeeDialog()
Definition: ModalDialog.php:73
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\seeOverview
‪seeOverview(ApplicationTester $I)
Definition: DbCheckModuleCest.php:46
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\recordStatisticsDataProvider
‪array[] recordStatisticsDataProvider()
Definition: DbCheckModuleCest.php:125
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\_before
‪_before(ApplicationTester $I)
Definition: DbCheckModuleCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\seeFullSearch
‪seeFullSearch(ApplicationTester $I, ModalDialog $modalDialog)
Definition: DbCheckModuleCest.php:82
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck
Definition: DbCheckModuleCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\seeDatabaseRelations
‪seeDatabaseRelations(ApplicationTester $I)
Definition: DbCheckModuleCest.php:72
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\goToPageAndSeeHeadline
‪goToPageAndSeeHeadline(ApplicationTester $I, string $select, string $headline)
Definition: DbCheckModuleCest.php:164
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\DbCheck\DbCheckModuleCest\seeManageReferenceIndex
‪seeManageReferenceIndex(ApplicationTester $I)
Definition: DbCheckModuleCest.php:104