Skip to content

Commit

Permalink
[Behat] IBX-4482 Fix for toggle button enabled (#786) (#814)
Browse files Browse the repository at this point in the history
Co-authored-by: Bogdan Mazur <[email protected]>
Co-authored-by: Bogdan Mazur <[email protected]>
  • Loading branch information
3 people authored Jun 19, 2023
1 parent b6e5792 commit a4392dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/Behat/Component/Fields/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ private function setEnabledField(bool $enabled)
{
$isCurrentlyEnabled = $this->getHTMLPage()->find($this->parentLocator)->find($this->getLocator('buttonEnabled'))->getText() === 'On';
if ($isCurrentlyEnabled !== $enabled) {
$this->getHTMLPage()->find($this->parentLocator)->find($this->getLocator('buttonEnabled'))->click();
$script = sprintf("document.querySelector('%s %s').click()", $this->parentLocator->getSelector(), $this->getLocator('buttonEnabled')->getSelector());
$this->getHTMLPage()->executeJavaScript($script);
$this->getHTMLPage()
->setTimeout(10)
->waitUntilCondition(new ElementExistsCondition($this->getHTMLPage(), $this->getLocator('buttonEnabledToggleConfirmation')));
Expand Down

0 comments on commit a4392dd

Please sign in to comment.