Skip to content

Commit

Permalink
Merge branch '4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mnocon committed Nov 13, 2023
2 parents 08ef415 + e80352c commit f6f020e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/lib/Behat/Component/Fields/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@

namespace Ibexa\AdminUi\Behat\Component\Fields;

use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion;
use Behat\Mink\Session;
use Ibexa\AdminUi\Behat\Component\IbexaDropdown;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;
use PHPUnit\Framework\Assert;

class Country extends FieldTypeComponent
{
private IbexaDropdown $dropdown;

public function __construct(Session $session, IbexaDropdown $dropdown)
{
parent::__construct($session);
$this->dropdown = $dropdown;
}

public function setValue(array $parameters): void
{
$this->getHTMLPage()->find($this->getLocator('dropdownSelector'))->click();
Assert::assertTrue($this->getHTMLPage()->find($this->getLocator('dropdownExpanded'))->isVisible());
$this->getHTMLPage()->findAll($this->getLocator('dropdownItem'))->getByCriterion(new ElementTextCriterion($parameters['value']))->click();
$this->getHTMLPage()->find($this->getLocator('dropdownSelector'))->click();
$this->dropdown->verifyIsLoaded();
$this->dropdown->selectOption($parameters['value']);
}

public function getFieldTypeIdentifier(): string
Expand All @@ -32,8 +39,6 @@ public function specifyLocators(): array
return [
new VisibleCSSLocator('fieldInput', 'select'),
new VisibleCSSLocator('dropdownSelector', '.ibexa-dropdown__selection-info'),
new VisibleCSSLocator('dropdownExpanded', '.ibexa-dropdown-popover .ibexa-dropdown__items'),
new VisibleCSSLocator('dropdownItem', '.ibexa-dropdown__item'),
];
}
}

0 comments on commit f6f020e

Please sign in to comment.