Skip to content

Commit

Permalink
[Behat] Submit live component before submitting the form
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojdylak authored and GSadee committed May 15, 2024
1 parent 630f9a1 commit e6deeb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Sylius/Behat/Page/Admin/Crud/CreatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Behat\Mink\Session;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
use Sylius\Behat\Service\DriverHelper;
use Symfony\Component\Routing\RouterInterface;

class CreatePage extends SymfonyPage implements CreatePageInterface
Expand All @@ -34,6 +35,9 @@ public function __construct(

public function create(): void
{
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getDocument()->find('css', 'body')->click();
}
$this->getDocument()->pressButton('Create');
}

Expand Down
4 changes: 4 additions & 0 deletions src/Sylius/Behat/Page/Admin/Crud/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Behat\Mink\Session;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Component\Core\Formatter\StringInflector;
use Symfony\Component\Routing\RouterInterface;

Expand All @@ -35,6 +36,9 @@ public function __construct(

public function saveChanges(): void
{
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getDocument()->find('css', 'body')->click();
}
$this->getDocument()->find('css', '[data-test-update-changes-button]')->click();
}

Expand Down

0 comments on commit e6deeb4

Please sign in to comment.