-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
671 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@managing_books | ||
Feature: Adding a new book | ||
In order to manage the library | ||
As an Administrator | ||
I want to add a new book | ||
|
||
@ui | ||
Scenario: Adding a new book | ||
When I want to create a new book | ||
And I name it "Carrie" | ||
And I specify its author as "Stephen King" | ||
And I add it | ||
Then the book "Carrie" should be added | ||
And the book "Carrie" should appear in the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Sylius\BehatBridge\Behat\Element\Admin\Action\CancelActionElement; | ||
use Sylius\BehatBridge\Behat\Element\Admin\Action\CancelActionElementInterface; | ||
use Sylius\BehatBridge\Behat\Element\Admin\Action\CreateActionElement; | ||
use Sylius\BehatBridge\Behat\Element\Admin\Action\CreateActionElementInterface; | ||
use Sylius\BehatBridge\Behat\Element\Admin\Action\UpdateActionElement; | ||
use Sylius\BehatBridge\Behat\Element\Admin\Action\UpdateActionElementInterface; | ||
|
||
return function (ContainerConfigurator $configurator): void { | ||
$services = $configurator->services(); | ||
|
||
$services | ||
->set('sylius_behat_bridge.behat.element.admin.action.cancel', CancelActionElement::class) | ||
->args([ | ||
service('behat.mink.default_session'), | ||
service('behat.mink.parameters'), | ||
]) | ||
; | ||
$services->alias(CancelActionElementInterface::class, 'sylius_behat_bridge.behat.element.admin.action.cancel'); | ||
|
||
$services | ||
->set('sylius_behat_bridge.behat.element.admin.action.create', CreateActionElement::class) | ||
->args([ | ||
service('behat.mink.default_session'), | ||
service('behat.mink.parameters'), | ||
]) | ||
; | ||
$services->alias(CreateActionElementInterface::class, 'sylius_behat_bridge.behat.element.admin.action.create'); | ||
|
||
$services | ||
->set('sylius_behat_bridge.behat.element.admin.action.update', UpdateActionElement::class) | ||
->args([ | ||
service('behat.mink.default_session'), | ||
service('behat.mink.parameters'), | ||
]) | ||
; | ||
$services->alias(UpdateActionElementInterface::class, 'sylius_behat_bridge.behat.element.admin.action.update'); | ||
}; |
35 changes: 35 additions & 0 deletions
35
src/BehatBridge/src/Behat/Context/Hook/DoctrineORMContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Context\Hook; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Behat\Hook\BeforeScenario; | ||
use Doctrine\Common\DataFixtures\Purger\ORMPurger; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
|
||
final class DoctrineORMContext implements Context | ||
{ | ||
public function __construct( | ||
private readonly EntityManagerInterface $entityManager, | ||
) { | ||
} | ||
|
||
#[BeforeScenario] | ||
public function purgeDatabase(): void | ||
{ | ||
$purger = new ORMPurger($this->entityManager); | ||
$purger->purge(); | ||
$this->entityManager->clear(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/BehatBridge/src/Behat/Element/Admin/Action/CancelActionElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
use FriendsOfBehat\PageObjectExtension\Element\Element; | ||
|
||
final class CancelActionElement extends Element implements CancelActionElementInterface | ||
{ | ||
public function cancel(): void | ||
{ | ||
$this->getElement('cancel_button')->click(); | ||
} | ||
|
||
protected function getDefinedElements(): array | ||
{ | ||
return [ | ||
'cancel_button' => '[data-test-cancel-changes-button]', | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/BehatBridge/src/Behat/Element/Admin/Action/CancelActionElementInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
interface CancelActionElementInterface | ||
{ | ||
public function cancel(): void; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/BehatBridge/src/Behat/Element/Admin/Action/CreateActionElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
use FriendsOfBehat\PageObjectExtension\Element\Element; | ||
|
||
final class CreateActionElement extends Element implements CreateActionElementInterface | ||
{ | ||
public function create(): void | ||
{ | ||
$this->getElement('create_button')->click(); | ||
} | ||
|
||
protected function getDefinedElements(): array | ||
{ | ||
return [ | ||
'create_button' => '[type=submit]:contains("Create")', | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/BehatBridge/src/Behat/Element/Admin/Action/CreateActionElementInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
interface CreateActionElementInterface | ||
{ | ||
public function create(): void; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/BehatBridge/src/Behat/Element/Admin/Action/UpdateActionElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
use FriendsOfBehat\PageObjectExtension\Element\Element; | ||
|
||
final class UpdateActionElement extends Element implements UpdateActionElementInterface | ||
{ | ||
public function update(): void | ||
{ | ||
$this->getElement('update_button')->click(); | ||
} | ||
|
||
protected function getDefinedElements(): array | ||
{ | ||
return [ | ||
'update_button' => '[data-test-update-changes-button]', | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/BehatBridge/src/Behat/Element/Admin/Action/UpdateActionElementInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\BehatBridge\Behat\Element\Admin\Action; | ||
|
||
interface UpdateActionElementInterface | ||
{ | ||
public function update(): void; | ||
} |
Oops, something went wrong.