diff --git a/src/lib/Behat/PageElement/ContentTypePicker.php b/src/lib/Behat/PageElement/ContentTypePicker.php index b1c0e5a116..9f5e0b7b12 100644 --- a/src/lib/Behat/PageElement/ContentTypePicker.php +++ b/src/lib/Behat/PageElement/ContentTypePicker.php @@ -8,6 +8,7 @@ use EzSystems\Behat\Browser\Context\BrowserContext; use EzSystems\Behat\Browser\Element\Element; +use PHPUnit\Framework\Assert; class ContentTypePicker extends Element { @@ -19,6 +20,7 @@ public function __construct(BrowserContext $context) parent::__construct($context); $this->fields = [ 'contentTypeSelector' => '.form-check-label', + 'headerSelector' => '.ez-extra-actions--create .ez-extra-actions__header', ]; } @@ -26,4 +28,13 @@ public function select(string $contentType): void { $this->context->getElementByText($contentType, $this->fields['contentTypeSelector'])->click(); } + + public function verifyVisibility(): void + { + $this->context->waitUntil($this->defaultTimeout, function () { + return $this->context->findElement($this->fields['headerSelector'])->getText() !== ''; + }); + + Assert::assertEquals('Create content', $this->context->findElement($this->fields['headerSelector'])->getText()); + } } diff --git a/src/lib/Behat/PageObject/ContentItemPage.php b/src/lib/Behat/PageObject/ContentItemPage.php index 80731e4bc1..9f5c795af4 100644 --- a/src/lib/Behat/PageObject/ContentItemPage.php +++ b/src/lib/Behat/PageObject/ContentItemPage.php @@ -58,6 +58,7 @@ public function startCreatingContent(string $contentType): ContentUpdateItemPage $this->rightMenu->clickButton('Create'); $contentTypePicker = ElementFactory::createElement($this->context, ContentTypePicker::ELEMENT_NAME); + $contentTypePicker->verifyVisibility(); $contentTypePicker->select($contentType); $contentUpdatePage = PageObjectFactory::createPage($this->context, ContentUpdateItemPage::PAGE_NAME, $contentType);