|
24 | 24 | use Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget; |
25 | 25 | use Ibexa\AdminUi\Behat\Component\UpperMenu; |
26 | 26 | use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; |
| 27 | +use Ibexa\Behat\Browser\Element\Criterion\ElementAttributeCriterion; |
27 | 28 | use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; |
28 | 29 | use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; |
29 | 30 | use Ibexa\Behat\Browser\Page\Page; |
|
33 | 34 | use Ibexa\Contracts\Core\Repository\Values\Content\Content; |
34 | 35 | use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; |
35 | 36 | use PHPUnit\Framework\Assert; |
| 37 | +use Symfony\Component\Filesystem\Exception\IOExceptionInterface; |
| 38 | +use Symfony\Component\Filesystem\Filesystem; |
36 | 39 |
|
37 | 40 | class ContentViewPage extends Page |
38 | 41 | { |
@@ -337,6 +340,7 @@ protected function specifyLocators(): array |
337 | 340 | new VisibleCSSLocator('addUrlAliasButton', '#ibexa-tab-location-view-urls [data-bs-target="#ibexa-modal--custom-url-alias"]'), |
338 | 341 | new VisibleCSSLocator('customUrlAliasesTable', '#ibexa-tab-location-view-urls .ibexa-table'), |
339 | 342 | new VisibleCSSLocator('alertTitle', '.ibexa-alert__title'), |
| 343 | + new VisibleCSSLocator('selectHideMode', '.form-check .ibexa-input--radio'), |
340 | 344 | ]; |
341 | 345 | } |
342 | 346 |
|
@@ -384,4 +388,35 @@ public function verifyMessage(string $expectedMessage): void |
384 | 388 | { |
385 | 389 | $this->getHTMLPage()->setTimeout(3)->find($this->getLocator('alertTitle'))->assert()->textEquals($expectedMessage); |
386 | 390 | } |
| 391 | + |
| 392 | + public function selectHideOption(string $viewMode): void |
| 393 | + { |
| 394 | + $this->getHTMLPage() |
| 395 | + ->findAll($this->getLocator('selectHideMode')) |
| 396 | + ->getByCriterion(new ElementAttributeCriterion('value', $viewMode))->click(); |
| 397 | + } |
| 398 | + |
| 399 | + public function verifyMessageContains(string $alertMessage): void |
| 400 | + { |
| 401 | + $this->getHTMLPage()->find($this->getLocator('alertTitle'))->assert()->textContains($alertMessage); |
| 402 | + } |
| 403 | + |
| 404 | + public function runScheduledJobs(): void |
| 405 | + { |
| 406 | + shell_exec('bin/console ibexa:scheduled:run'); |
| 407 | + } |
| 408 | + |
| 409 | + public function clearBehatCacheDirectory(): void |
| 410 | + { |
| 411 | + $filesystem = new Filesystem(); |
| 412 | + $cacheDir = getcwd() . \DIRECTORY_SEPARATOR . 'var' . \DIRECTORY_SEPARATOR . 'cache'; |
| 413 | + |
| 414 | + try { |
| 415 | + $filesystem->remove($cacheDir); |
| 416 | + $this->getHTMLPage()->setTimeout(5); |
| 417 | + $this->getSession()->reload(); |
| 418 | + } catch (IOExceptionInterface $exception) { |
| 419 | + throw new \Exception('Error while clearing cache: ' . $exception->getMessage()); |
| 420 | + } |
| 421 | + } |
387 | 422 | } |
0 commit comments