Skip to content

Commit

Permalink
[Behat] IBX-671 - added checks for LP editor launch mode (#1971)
Browse files Browse the repository at this point in the history
* [Behat] IBX-671 - added checks for LP editor launch mode

* CR fixes
  • Loading branch information
tomaszszopinski authored Oct 22, 2021
1 parent 906b04b commit cae59db
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/Behat/BrowserContext/ContentTypeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,13 @@ public function iCheckBlockInField($blockName)
$this->contentTypeUpdatePage->expandDefaultBlocksOption();
$this->contentTypeUpdatePage->selectBlock($blockName);
}

/**
* @Given I select :viewMode editor launch mode in ezlandingpage field options
*/
public function iCheckEditorLaunchModeOption(string $viewMode): void
{
$this->contentTypeUpdatePage->expandFieldDefinition('Landing Page');
$this->contentTypeUpdatePage->selectEditorLaunchMode($viewMode);
}
}
8 changes: 8 additions & 0 deletions src/lib/Behat/Page/ContentTypeUpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use EzSystems\Behat\API\ContentData\FieldTypeNameConverter;
use Ibexa\AdminUi\Behat\Component\Notification;
use Ibexa\AdminUi\Behat\Component\RightMenu;
use Ibexa\Behat\Browser\Element\Criterion\ElementAttributeCriterion;
use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion;
use Ibexa\Behat\Browser\Element\ElementInterface;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;
Expand Down Expand Up @@ -61,6 +62,7 @@ public function specifyLocators(): array
new VisibleCSSLocator('fieldBody', 'ez-card__body'),
new VisibleCSSLocator('fieldCollapsed', 'ez-card--collapsed'),
new VisibleCSSLocator('fieldDefinitionToggler', '.ez-card__body-display-toggler'),
new VisibleCSSLocator('selectLaunchEditorMode', '.form-check-label .ez-input--radio'),
new XPathLocator('ezlandingpageFieldDisplayButton', '//*[@id="field-definition-page"]/button'),
new XPathLocator('selectBlocksDropdown', '//div[contains(@class,"ez-page-select-items")]/a[contains(text(),"Select blocks")]'),
new XPathLocator('selectBlocksDropdownDefault', '//div[contains(@class,"ez-page-select-items__group")]/a[contains(text(),"default")]'),
Expand Down Expand Up @@ -103,4 +105,10 @@ public function selectBlock(string $blockName): void
$scriptToExecute = sprintf($blockFindingScript, $blockName);
$this->getSession()->executeScript($scriptToExecute);
}

public function selectEditorLaunchMode(string $viewMode): void
{
$this->getHTMLPage()->findAll($this->getLocator('selectLaunchEditorMode'))
->getByCriterion(new ElementAttributeCriterion('value', $viewMode))->click();
}
}

0 comments on commit cae59db

Please sign in to comment.