Skip to content

Commit

Permalink
OP-543: Behat fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Sep 13, 2024
1 parent 0475fdc commit d2f4438
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/Behat/Context/Setup/BlockContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private function createBlockWithContentElement(string $code, string $contentElem
/** @var ContentConfigurationInterface $contentConfiguration */
$contentConfiguration = new ContentConfiguration();
$contentConfiguration->setType(mb_strtolower($contentElement));
$contentConfiguration->setLocale('en_US');
$contentConfiguration->setConfiguration(ContentElementHelper::getExampleConfigurationByContentElement($contentElement));
$contentConfiguration->setBlock($block);

Expand Down
1 change: 1 addition & 0 deletions tests/Behat/Context/Setup/PageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ private function createPageWithContentElement(string $contentElement): PageInter
/** @var ContentConfigurationInterface $contentConfiguration */
$contentConfiguration = new ContentConfiguration();
$contentConfiguration->setType(mb_strtolower($contentElement));
$contentConfiguration->setLocale('en_US');
$contentConfiguration->setConfiguration(ContentElementHelper::getExampleConfigurationByContentElement($contentElement));
$contentConfiguration->setPage($page);

Expand Down
17 changes: 15 additions & 2 deletions tests/Behat/Page/Admin/Page/CreatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,21 @@ public function addTextareaContentElementWithContent(string $content): void
{
Assert::isInstanceOf($this->getDriver(), ChromeDriver::class);

$textarea = $this->getElement('content_elements_textarea');
$textarea->setValue($content);
$iframe = $this->getDocument()->find('css', '.cke_wysiwyg_frame');
if (null === $iframe) {
throw new \Exception('CKEditor iframe not found');
}

$this->getDriver()->switchToIFrame($iframe->getAttribute('name'));

$body = $this->getDocument()->find('css', 'body');
if (null === $body) {
throw new \Exception('CKEditor body not found');
}

$body->setValue($content);

$this->getDriver()->switchToIFrame(null);
}

public function addSingleMediaContentElementWithName(string $name): void
Expand Down

0 comments on commit d2f4438

Please sign in to comment.