Skip to content

Commit

Permalink
[WiP][Behat] IBX-1313 Added selection of editor launch mode in conten…
Browse files Browse the repository at this point in the history
…t type (#372)

* added selection of editor launch mode in content type for behat

fixed selector

added ElementAttributeCriterion use

fixed condition

readability changes

* sorting imports
  • Loading branch information
tomaszszopinski authored Mar 25, 2022
1 parent 3f5462d commit 543e74b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/Behat/BrowserContext/ContentTypeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,14 @@ 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->verifyIsLoaded();
$this->contentTypeUpdatePage->expandLastFieldDefinition();
$this->contentTypeUpdatePage->selectEditorLaunchMode($viewMode);
}
}
9 changes: 9 additions & 0 deletions src/lib/Behat/Page/ContentTypeUpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition;
use Ibexa\Behat\Browser\Element\Condition\ElementTransitionHasEndedCondition;
use Ibexa\Behat\Browser\Element\Criterion\ElementAttributeCriterion;
use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion;
use Ibexa\Behat\Browser\Element\Mapper\ElementTextMapper;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;
Expand Down Expand Up @@ -47,6 +48,7 @@ public function specifyLocators(): array
new VisibleCSSLocator('availableFieldLabelList', '.ibexa-available-field-types__list > li'),
new VisibleCSSLocator('workspace', '#content_collapse > div.ibexa-collapse__body-content > div'),
new VisibleCSSLocator('fieldDefinitionToggle', '.ibexa-collapse:nth-last-child(2) > div.ibexa-collapse__header > button:last-child:not([data-bs-target="#content_collapse"])'),
new VisibleCSSLocator('selectLaunchEditorMode', '.form-check .ibexa-input--radio'),
new VisibleCSSLocator('fieldDefinitionOpenContainer', '[data-collapsed="false"] .ibexa-content-type-edit__field-definition-content'),
new VisibleCSSLocator('selectBlocksDropdown', '.ibexa-page-select-items__toggler'),
]);
Expand Down Expand Up @@ -123,4 +125,11 @@ public function verifyIsLoaded(): void
parent::verifyIsLoaded();
$this->getHTMLPage()->find($this->getLocator('contentTypeAddButton'))->assert()->isVisible();
}

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

0 comments on commit 543e74b

Please sign in to comment.