Skip to content

Commit

Permalink
OP-558 - update plugin to Sylius 2 - fix behat test
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusz-rup committed Jan 14, 2025
1 parent 9f22063 commit 5d6966b
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function addRule(string $ruleName): void

$form = $this->getElement('form');

usleep(500000); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
usleep(1000000); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
$form->waitFor(1500, fn () => !$form->hasAttribute('busy'));
}

Expand All @@ -54,6 +54,27 @@ public function fillRuleOption(string $option, string $value): void
$this->getLastCollectionItem('rules')->fillField($option, $value);
}

public function fillRuleOption2(string $optionName, string $value): void
{
$field = $this->getDocument()->findField($optionName);
if (null === $field) {
throw new \InvalidArgumentException(sprintf('Field "%s" not found.', $optionName));
}
$field->setValue($value);
}

public function selectRuleOption2(string $optionName, string $value): void
{
$field = $this->getDocument()->findField($optionName);

if (null === $field) {
throw new \InvalidArgumentException(sprintf('Field "%s" not found.', $optionName));
}
$field->selectOption($value);
}



public function selectAutocompleteRuleOption(string $option, $value, bool $multiple = false): void
{
$option = strtolower(str_replace(' ', '_', $option));
Expand Down

0 comments on commit 5d6966b

Please sign in to comment.