|
22 | 22 | use Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget; |
23 | 23 | use Ibexa\AdminUi\Behat\Component\UpperMenu; |
24 | 24 | use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; |
| 25 | +use Ibexa\Behat\Browser\Element\Criterion\ElementAttributeCriterion; |
25 | 26 | use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; |
26 | 27 | use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; |
27 | 28 | use Ibexa\Behat\Browser\Page\Page; |
|
31 | 32 | use Ibexa\Contracts\Core\Repository\Values\Content\Content; |
32 | 33 | use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; |
33 | 34 | use PHPUnit\Framework\Assert; |
| 35 | +use Symfony\Component\Filesystem\Exception\IOExceptionInterface; |
| 36 | +use Symfony\Component\Filesystem\Filesystem; |
34 | 37 |
|
35 | 38 | class ContentViewPage extends Page |
36 | 39 | { |
@@ -309,6 +312,7 @@ protected function specifyLocators(): array |
309 | 312 | new VisibleCSSLocator('moreTab', '.ibexa-tabs__tab--more'), |
310 | 313 | new VisibleCSSLocator('popupMenuItem', '.ibexa-popup-menu__item .ibexa-popup-menu__item-content'), |
311 | 314 | new VisibleCSSLocator('alertTitle', '.ibexa-alert__title'), |
| 315 | + new VisibleCSSLocator('selectHideMode', '.form-check .ibexa-input--radio'), |
312 | 316 | ]; |
313 | 317 | } |
314 | 318 |
|
@@ -356,4 +360,35 @@ public function verifyMessage(string $expectedMessage): void |
356 | 360 | { |
357 | 361 | $this->getHTMLPage()->setTimeout(3)->find($this->getLocator('alertTitle'))->assert()->textEquals($expectedMessage); |
358 | 362 | } |
| 363 | + |
| 364 | + public function selectHideOption(string $viewMode): void |
| 365 | + { |
| 366 | + $this->getHTMLPage() |
| 367 | + ->findAll($this->getLocator('selectHideMode')) |
| 368 | + ->getByCriterion(new ElementAttributeCriterion('value', $viewMode))->click(); |
| 369 | + } |
| 370 | + |
| 371 | + public function verifyMessageContains(string $alertMessage): void |
| 372 | + { |
| 373 | + $this->getHTMLPage()->find($this->getLocator('alertTitle'))->assert()->textContains($alertMessage); |
| 374 | + } |
| 375 | + |
| 376 | + public function runScheduledJobs(): void |
| 377 | + { |
| 378 | + shell_exec('bin/console ibexa:scheduled:run'); |
| 379 | + } |
| 380 | + |
| 381 | + public function clearBehatCacheDirectory(): void |
| 382 | + { |
| 383 | + $filesystem = new Filesystem(); |
| 384 | + $cacheDir = getcwd() . \DIRECTORY_SEPARATOR . 'var' . \DIRECTORY_SEPARATOR . 'cache'; |
| 385 | + |
| 386 | + try { |
| 387 | + $filesystem->remove($cacheDir); |
| 388 | + $this->getHTMLPage()->setTimeout(5); |
| 389 | + $this->getSession()->reload(); |
| 390 | + } catch (IOExceptionInterface $exception) { |
| 391 | + throw new \Exception('Error while clearing cache: ' . $exception->getMessage()); |
| 392 | + } |
| 393 | + } |
359 | 394 | } |
0 commit comments