Skip to content

[Behat] IBX-9859: Adjustments for discounts behat tests #1532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 4.6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/lib/Behat/Component/CreateNewPopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Ibexa\Behat\Browser\Component\Component;
use Ibexa\Behat\Browser\Element\Condition\ElementTransitionHasEndedCondition;
use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion;
use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;

class CreateNewPopup extends Component
Expand Down Expand Up @@ -40,7 +41,7 @@ public function verifyHeaderText(string $expectedHeader): void
public function selectFromDropdown(string $dropdownLabel, string $dropdownValue): void
{
$definition = $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('popup'))->findAll($this->getLocator('formGroup'))
->getByCriterion(new ChildElementTextCriterion($this->getLocator('dropdownLabel'), $dropdownLabel));
->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $dropdownLabel));
if ($definition->find($this->getLocator('dropdownValue'))->getText() === $dropdownValue) {
return;
}
Expand All @@ -50,6 +51,17 @@ public function selectFromDropdown(string $dropdownLabel, string $dropdownValue)
$this->ibexaDropdown->selectOption($dropdownValue);
}

public function selectRadio(string $radioLabel, string $radioValue): void
{
$definition = $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('popup'))->findAll($this->getLocator('formGroup'))
->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $radioLabel));
if ($definition->find($this->getLocator('radioValue'))->getText() === $radioValue) {
return;
}
$this->getHTMLPage()->setTimeout(5)->findAll($this->getLocator('radioValue'))->getByCriterion(new ElementTextCriterion($radioValue))
->find($this->getLocator('radioLabel'))->click();
}

public function confirm(): void
{
$this->getHTMLPage()->find($this->getLocator('addButton'))->click();
Expand All @@ -69,8 +81,10 @@ protected function specifyLocators(): array
new VisibleCSSLocator('popup', '.ibexa-extra-actions:not(.ibexa-extra-actions--hidden)'),
new VisibleCSSLocator('formGroup', '.form-group'),
new VisibleCSSLocator('dropdown', '.ibexa-dropdown'),
new VisibleCSSLocator('dropdownLabel', '.ibexa-label'),
new VisibleCSSLocator('label', '.ibexa-label'),
new VisibleCSSLocator('dropdownValue', '.ibexa-dropdown__selection-info'),
new VisibleCSSLocator('radioValue', '.ibexa-dc-extra-actions-applies-to__option'),
new VisibleCSSLocator('radioLabel', '.ibexa-label--checkbox-radio'),
];
}
}
2 changes: 1 addition & 1 deletion src/lib/Behat/Component/Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function verifyIsLoaded(): void
protected function specifyLocators(): array
{
return [
new VisibleCSSLocator('confirm', '.modal.show button[type="submit"],.modal.show button[data-click], .modal.show .ibexa-btn--confirm'),
new VisibleCSSLocator('confirm', '.modal.show button[type="submit"],.modal.show button[data-click], .modal.show .ibexa-btn--confirm, .modal.show .ibexa-btn--primary'),
new VisibleCSSLocator('decline', '.modal.show .ibexa-btn--secondary'),
];
}
Expand Down
Loading