Skip to content

Commit

Permalink
[Behat] Added switching into specific tabs in Roles feature (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnocon authored Feb 1, 2022
1 parent ae5cf34 commit c90516f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/Behat/Component/UniversalDiscoveryWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Ibexa\AdminUi\Behat\Component;

use Ibexa\Behat\Browser\Component\Component;
use Ibexa\Behat\Browser\Element\Condition\ElementNotExistsCondition;
use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion;
use Ibexa\Behat\Browser\Element\ElementInterface;
use Ibexa\Behat\Browser\Locator\CSSLocator;
Expand Down Expand Up @@ -39,6 +40,9 @@ public function selectContent(string $itemPath): void
public function confirm(): void
{
$this->getHTMLPage()->find($this->getLocator('confirmButton'))->click();
$this->getHTMLPage()
->setTimeout(3)
->waitUntilCondition(new ElementNotExistsCondition($this->getHTMLPage(), $this->getLocator('udw')));
}

public function cancel(): void
Expand Down
6 changes: 6 additions & 0 deletions src/lib/Behat/Page/AdminUpdateItemPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ protected function getRoute(): string
throw new \Exception('Update Page cannot be opened on its own!');
}

public function switchToTab(string $tabName): void
{
$this->getHTMLPage()->findAll($this->getLocator('tab'))->getByCriterion(new ElementTextCriterion($tabName))->click();
}

public function getName(): string
{
return 'Admin item update';
Expand Down Expand Up @@ -78,6 +83,7 @@ protected function specifyLocators(): array
new VisibleCSSLocator('formElement', '.ibexa-main-container '),
new VisibleCSSLocator('closeButton', '.ibexa-content-edit-container__close'),
new VisibleCSSLocator('button', '.container button'),
new VisibleCSSLocator('tab', '.ibexa-anchor-navigation-menu__item'),
new VisibleCSSLocator('fieldInput', 'input'),
];
}
Expand Down
4 changes: 4 additions & 0 deletions src/lib/Behat/Page/RoleUpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public function assign(array $itemPaths, string $itemType)

public function assignSectionLimitation(string $limitationName): void
{
$this->verifyIsLoaded();
$this->switchToTab('Limitations');
$this->fillFieldWithValue('Sections', true);
$this->getHTMLPage()->find($this->getLocator('policyAssignmentSelect'))->click();
$this->getHTMLPage()->find($this->getLocator('ibexaDropdownSelectionInfo'))->click();
Expand All @@ -119,6 +121,8 @@ public function assignSectionLimitation(string $limitationName): void

public function selectLimitationForAssignment(string $itemPath)
{
$this->verifyIsLoaded();
$this->switchToTab('Limitations');
$this->fillFieldWithValue('Subtree', 'true');
$this->clickButton('Select path');
$this->universalDiscoveryWidget->verifyIsLoaded();
Expand Down

0 comments on commit c90516f

Please sign in to comment.