diff --git a/features/creating_bundled_product.feature b/features/creating_bundled_product.feature index be965851..edded4ff 100644 --- a/features/creating_bundled_product.feature +++ b/features/creating_bundled_product.feature @@ -1,34 +1,52 @@ @bundled_product Feature: Creating a product in store which is a bundle of other products - I want to be able to add bundled product to cart + As an Administrator + I want to be able to add bundled product to cart - Background: - Given the store operates on a single channel in "United States" - And I am logged in as an administrator - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the store has a product "Johny Walker Black" priced at "$10.00" - And the store has a product "Jim Beam Double Oak" priced at "$10.00" + Background: + Given the store operates on a single channel in "United States" + And I am logged in as an administrator + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the store has a product "Johny Walker Black" priced at "$10.00" + And the store has a product "Jim Beam Double Oak" priced at "$10.00" - @ui @javascript - Scenario: Creating a bundled product - When I want to create a new bundled product - And I specify its code as "WHISKEY_PACK" - And I name it "Whiskey double pack" in "English (United States)" - And I set its slug to "whiskey-double-pack" in "English (United States)" - And I set its price to "$10.00" for "United States" channel - And I set its original price to "$20.00" for "United States" channel - And I add product "Johny Walker Black" and "Jack Daniels Gentleman" to the bundle - And I add it - Then I should be notified that it has been successfully created + @ui @javascript + Scenario: Creating a bundled product + When I want to create a new bundled product + And I specify its code as "WHISKEY_PACK" + And I name it "Whiskey double pack" in "English (United States)" + And I set its slug to "whiskey-double-pack" in "English (United States)" + And I set its price to "$10.00" for "United States" channel + And I set its original price to "$20.00" for "United States" channel + And I add product "Johny Walker Black" and "Jack Daniels Gentleman" to the bundle + And I add it + Then I should be notified that it has been successfully created - @ui @javascript - Scenario: Creating a bundled product with more products - When I want to create a new bundled product - And I specify its code as "WHISKEY_BIG_PACK" - And I name it "Whiskey triple pack" in "English (United States)" - And I set its slug to "whiskey-triple-pack" in "English (United States)" - And I set its price to "$10.00" for "United States" channel - And I set its original price to "$20.00" for "United States" channel - And I add product "Johny Walker Black" and "Jack Daniels Gentleman" and "Jim Beam Double Oak" to the bundle - And I add it - Then I should be notified that it has been successfully created + @ui @javascript + Scenario: Creating a bundled product with more products + When I want to create a new bundled product + And I specify its code as "WHISKEY_BIG_PACK" + And I name it "Whiskey triple pack" in "English (United States)" + And I set its slug to "whiskey-triple-pack" in "English (United States)" + And I set its price to "$10.00" for "United States" channel + And I set its original price to "$20.00" for "United States" channel + And I add product "Johny Walker Black" and "Jack Daniels Gentleman" and "Jim Beam Double Oak" to the bundle + And I add it + Then I should be notified that it has been successfully created + And there should be a "WHISKEY_BIG_PACK" bundle containing "Johny Walker Black" with quantity 1 + And there should be a "WHISKEY_BIG_PACK" bundle containing "Jack Daniels Gentleman" with quantity 1 + And there should be a "WHISKEY_BIG_PACK" bundle containing "Jim Beam Double Oak" with quantity 1 + + @ui @javascript + Scenario: Creating a bundled product with higher quantity + When I want to create a new bundled product + And I specify its code as "WHISKEY_BIG_PACK" + And I name it "Whiskey triple pack" in "English (United States)" + And I set its slug to "whiskey-triple-pack" in "English (United States)" + And I set its price to "$10.00" for "United States" channel + And I set its original price to "$20.00" for "United States" channel + And I add product "Jim Beam Double Oak" with quantity 5 and "Jack Daniels Gentleman" with quantity 2 to the bundle + And I add it + Then I should be notified that it has been successfully created + And there should be a "WHISKEY_BIG_PACK" bundle containing "Jim Beam Double Oak" with quantity 5 + And there should be a "WHISKEY_BIG_PACK" bundle containing "Jack Daniels Gentleman" with quantity 2 diff --git a/features/having_bundled_product_in_store.feature b/features/having_bundled_product_in_store.feature index 1e9031d2..bc75045f 100644 --- a/features/having_bundled_product_in_store.feature +++ b/features/having_bundled_product_in_store.feature @@ -1,40 +1,66 @@ @bundled_product Feature: Having a product in store which is a bundle of other products - I want to be able to add bundled product to cart + As a Customer + I want to be able to order bundled products - Background: - Given the store operates on a single channel in "United States" - And I am a logged in customer - And the store ships everywhere for Free - And the store allows paying Offline + Background: + Given the store operates on a single channel in "United States" + And the store has "VAT" tax rate of 50% for "Coke" within the "US" zone + And I am a logged in customer + And the store ships everywhere for Free + And the store allows paying Offline + And the store has a product "Jim Beam" priced at "$10.00" + And the store has a product "Jim Beam Double Oak" priced at "$10.00" + And the store has a product "Coca-Cola" priced at "$5.00" + And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" + And the store has bundled product "Jim Beam&Coke" priced at "$12.00" which contains "Jim Beam" and "Coca-Cola" + And it belongs to "Coke" tax category + And all store products appear under a main taxonomy - @ui - Scenario: Adding a product bundle to the cart - Given the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the store has a product "Johny Walker Black" priced at "$10.00" - And the store has bundled product "Whiskey double pack" priced at "$18.00" which contains "Jack Daniels Gentleman" and "Johny Walker Black" - And all store products appear under a main taxonomy - Then I added product "Whiskey double pack" to the cart - And I should be on my cart summary page - And there should be one item in my cart + @ui + Scenario: Adding product bundles to cart + When I added product "Jim Beam double pack" to the cart + And I change product "Jim Beam double pack" quantity to 5 in my cart + Then I should see "Jim Beam double pack" with quantity 5 in my cart + And my cart total should be "$90.00" - @ui - Scenario: Adding a few product bundles to the cart - Given the store has a product "Jim Beam" priced at "$10.00" - And the store has a product "Jim Beam Double Oak" priced at "$10.00" - And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" - And all store products appear under a main taxonomy - Then I added product "Jim Beam double pack" to the cart - And I change product "Jim Beam double pack" quantity to 5 in my cart - And I should see "Jim Beam double pack" with quantity 5 in my cart + @ui + Scenario: Placing an order for bundled products + Given I have product "Jim Beam double pack" in the cart + And I have product "Jim Beam&Coke" in the cart + And my cart total should be "$30.00" + And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + And I proceed with "Free" shipping method and "Offline" payment + When I confirm my order + Then I should see the thank you page - @ui - Scenario: Placing an order for a bundled product - Given the store has a product "Jim Beam" priced at "$10.00" - And the store has a product "Jim Beam Double Oak" priced at "$10.00" - And the store has bundled product "Jim Beam double pack" priced at "$18.00" which contains "Jim Beam" and "Jim Beam Double Oak" - Given I have product "Jim Beam double pack" in the cart - And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" - And I proceed with "Free" shipping method and "Offline" payment - And I confirm my order - Then I should see the thank you page + @ui + Scenario: Placing an order for bundled products with promotion applied + Given there is a promotion "Holiday promotion" + And this promotion gives "$1.00" off on every product with minimum price at "$15.00" + And I have product "Jim Beam double pack" in the cart + And I have product "Jim Beam&Coke" in the cart + And my cart total should be "$29.00" + And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + And I proceed with "Free" shipping method and "Offline" payment + When I confirm my order + Then I should see the thank you page + + @ui + Scenario: Placing an order for bundled products with tax applied + Given I have product "Jim Beam double pack" in the cart + And I have product "Jim Beam&Coke" in the cart + And I have product "Coca-Cola" in the cart + When I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + And I proceed with "Free" shipping method and "Offline" payment + Then my cart total should be "$41.00" + And my cart taxes should be "$6.00" + + @api + Scenario: Adding product bundles to cart with API + When I pick up my cart + And I add bundle "Jim Beam&Coke" with quantity 5 to my cart + And I add bundle "Jim Beam&Coke" with quantity 5 to my cart + Then I should have bundle "Jim Beam&Coke" with quantity 10 in my cart + And I should have product "Jim Beam" in bundled items + And I should have product "Coca-Cola" in bundled items diff --git a/features/viewing_products_from_ordered_bundle.feature b/features/viewing_products_from_ordered_bundle.feature new file mode 100644 index 00000000..44051955 --- /dev/null +++ b/features/viewing_products_from_ordered_bundle.feature @@ -0,0 +1,37 @@ +@bundled_product +Feature: Reviewing products from ordered bundle + As a Customer + I want to be able to see products in the bundle I ordered + + Background: + Given the store operates on a single channel in "United States" + And the store ships everywhere for Free + And the store allows paying Offline + And the store has a product "Jim Beam" priced at "$10.00" + And the store has a product "Coca-Cola" priced at "$5.00" + And the store has bundled product "Jim Beam&Coke" priced at "$12.00" which contains "Jim Beam" and "Coca-Cola" + And all store products appear under a main taxonomy + And I am a logged in customer with name "Bundle Customer" + + @ui @shop + Scenario: Viewing bundled products in cart + Given I have product "Jim Beam&Coke" in the cart + When I see the summary of my cart + Then there should be one item in my cart + And this item should have name "Jim Beam&Coke" + And there should be bundled products listed + And the list should contain "Jim Beam" + And the list should contain "Coca-Cola" + + @ui @shop + Scenario: Viewing bundled products in order history + Given there is a customer "sylius@example.com" that placed an order "#1" later + And the customer bought a single bundle "Jim Beam&Coke" + And I addressed it to "Ankh Morpork", "Frost Alley", "90210" "Los Angeles" in the "United States" + And for the billing address of "Ankh Morpork" in the "Frost Alley", "90210" "Los Angeles", "United States" + And I chose "Free" shipping method with "Offline" payment + When I view the summary of my order "#1" + Then it should have the number "#1" + And there should be bundled products listed in order details + And the list should contain "Jim Beam" in order details + And the list should contain "Coca-Cola" in order details diff --git a/tests/Behat/Context/Api/ProductBundleContext.php b/tests/Behat/Context/Api/ProductBundleContext.php new file mode 100644 index 00000000..fc9182c9 --- /dev/null +++ b/tests/Behat/Context/Api/ProductBundleContext.php @@ -0,0 +1,83 @@ +requestFactory->customItemAction( + 'shop', + Resources::ORDERS, + $this->sharedStorage->get('cart_token'), + HttpRequest::METHOD_PATCH, + 'product-bundle', + ); + $request->updateContent([ + 'productCode' => $product->getCode(), + 'quantity' => $quantity, + ]); + + $this->client->executeCustomRequest($request); + } + + /** + * @When I should have bundle :product with quantity :quantity in my cart + */ + public function iShouldHaveBundleWithQuantityInMyCart(ProductInterface $product, int $quantity): void + { + $response = $this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token')); + + $item = $this->responseChecker->getValue($response, 'items')[0]; + Assert::eq($item['productName'], $product->getName()); + Assert::eq($item['quantity'], $quantity); + } + + /** + * @When I should have product :product in bundled items + */ + public function iShouldHaveProductInBundledItems(ProductInterface $product): void + { + $response = $this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token')); + + $productBundleOrderItems = $this->responseChecker->getValue($response, 'items')[0]['productBundleOrderItems']; + foreach ($productBundleOrderItems as $item) { + if ($item['productVariant']['code'] === $product->getCode()) { + return; + } + } + + throw new \InvalidArgumentException('Product not found in bundled items'); + } +} diff --git a/tests/Behat/Context/Setup/ProductBundleContext.php b/tests/Behat/Context/Setup/ProductBundleContext.php index ab406ff0..b7c1bb74 100644 --- a/tests/Behat/Context/Setup/ProductBundleContext.php +++ b/tests/Behat/Context/Setup/ProductBundleContext.php @@ -14,16 +14,21 @@ use Behat\Behat\Context\Context; use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface; use BitBag\SyliusProductBundlePlugin\Entity\ProductInterface; +use BitBag\SyliusProductBundlePlugin\Factory\OrderItemFactoryInterface; +use BitBag\SyliusProductBundlePlugin\Factory\ProductBundleOrderItemFactoryInterface; use BitBag\SyliusProductBundlePlugin\Factory\ProductFactory; use Doctrine\ORM\EntityManagerInterface; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Component\Core\Formatter\StringInflector; use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ChannelPricingInterface; +use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ProductTaxonInterface; use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Core\Repository\ProductRepositoryInterface; +use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface; +use Sylius\Component\Order\Modifier\OrderModifierInterface; use Sylius\Component\Product\Generator\SlugGeneratorInterface; use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; use Sylius\Component\Resource\Factory\FactoryInterface; @@ -31,16 +36,21 @@ final class ProductBundleContext implements Context { public function __construct( - private SharedStorageInterface $sharedStorage, - private FactoryInterface $taxonFactory, - private ProductRepositoryInterface $productRepository, - private FactoryInterface $productTaxonFactory, - private EntityManagerInterface $productTaxonManager, - private ProductFactory $productFactory, - private FactoryInterface $productBundleItemFactory, - private FactoryInterface $channelPricingFactory, - private ProductVariantResolverInterface $productVariantResolver, - private SlugGeneratorInterface $slugGenerator, + private readonly SharedStorageInterface $sharedStorage, + private readonly FactoryInterface $taxonFactory, + private readonly ProductRepositoryInterface $productRepository, + private readonly FactoryInterface $productTaxonFactory, + private readonly EntityManagerInterface $productTaxonManager, + private readonly ProductFactory $productFactory, + private readonly FactoryInterface $productBundleItemFactory, + private readonly FactoryInterface $channelPricingFactory, + private readonly ProductVariantResolverInterface $productVariantResolver, + private readonly SlugGeneratorInterface $slugGenerator, + private readonly EntityManagerInterface $objectManager, + private readonly OrderItemQuantityModifierInterface $orderItemQuantityModifier, + private readonly ProductBundleOrderItemFactoryInterface $productBundleOrderItemFactory, + private readonly OrderModifierInterface $orderModifier, + private readonly OrderItemFactoryInterface $cartItemFactory, ) { } @@ -149,4 +159,27 @@ private function createProduct( return $product; } + + /** + * @When the customer bought a single bundle :product + */ + public function theCustomerBoughtBundle(ProductInterface $product): void + { + /** @var OrderInterface|null $cart */ + $cart = $this->sharedStorage->get('order'); + /** @var ProductVariantInterface|null $variant */ + $variant = $product->getVariants()->first(); + + $cartItem = $this->cartItemFactory->createWithVariant($variant); + $this->orderItemQuantityModifier->modify($cartItem, 1); + + foreach ($product->getProductBundle()->getProductBundleItems() as $bundleItem) { + $productBundleOrderItem = $this->productBundleOrderItemFactory->createFromProductBundleItem($bundleItem); + $cartItem->addProductBundleOrderItem($productBundleOrderItem); + } + + $this->orderModifier->addToOrder($cart, $cartItem); + + $this->objectManager->flush(); + } } diff --git a/tests/Behat/Context/Ui/ProductBundleContext.php b/tests/Behat/Context/Ui/ProductBundleContext.php index 43058dc5..5087e04d 100644 --- a/tests/Behat/Context/Ui/ProductBundleContext.php +++ b/tests/Behat/Context/Ui/ProductBundleContext.php @@ -12,13 +12,21 @@ namespace Tests\BitBag\SyliusProductBundlePlugin\Behat\Context\Ui; use Behat\Behat\Context\Context; +use BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface; +use BitBag\SyliusProductBundlePlugin\Entity\ProductInterface; use Sylius\Component\Core\Model\ChannelInterface; +use Sylius\Component\Core\Repository\ProductRepositoryInterface; use Tests\BitBag\SyliusProductBundlePlugin\Behat\Page\Admin\CreateBundledProductPageInterface; +use Tests\BitBag\SyliusProductBundlePlugin\Behat\Page\Shop\BundledProductsListPageInterface; +use Webmozart\Assert\Assert; class ProductBundleContext implements Context { public function __construct( private CreateBundledProductPageInterface $createBundledProductPage, + private ProductRepositoryInterface $productRepository, + private BundledProductsListPageInterface $summaryPage, + private BundledProductsListPageInterface $orderShowPage, ) { } @@ -90,4 +98,67 @@ public function iAddProductsToBundledProduct(...$productsNames) { $this->createBundledProductPage->addProductsToBundle($productsNames); } + + /** + * @When I add product :firstProductName with quantity :firstQuantity and :secondProductName with quantity :secondQuantity to the bundle + */ + public function iAddProductsWithQuantitiesToBundledProduct(string $firstProductName, string $secondProductName, int $firstQuantity, int $secondQuantity) + { + $this->createBundledProductPage->addProductsToBundle([$firstProductName, $secondProductName], [$firstQuantity, $secondQuantity]); + } + + /** + * @When there should be a :bundleName bundle containing :productName with quantity :quantity + */ + public function theProductBundleShouldContainProductWithQuantity(string $bundleCode, string $productName, int $quantity): void + { + /** @var ProductInterface $product */ + $product = $this->productRepository->findOneBy(['code' => $bundleCode]); + + Assert::notNull($product->getProductBundle()); + + $bundleItems = $product->getProductBundle()->getProductBundleItems(); + /** @var ProductBundleItemInterface $item */ + foreach ($bundleItems as $item) { + if ($item->getProductVariant()->getProduct()->getName() === $productName) { + Assert::same($item->getQuantity(), $quantity); + + return; + } + } + + throw new \InvalidArgumentException(sprintf('Product "%s" not found in bundle "%s"', $productName, $bundleCode)); + } + + /** + * @When there should be bundled products listed + */ + public function thereShouldBeBundledProductsListed(): void + { + Assert::true($this->summaryPage->hasBundledProductsList()); + } + + /** + * @When the list should contain :productName + */ + public function thereShouldBeAProductOnTheList(string $productName): void + { + Assert::true($this->summaryPage->hasBundledProduct($productName)); + } + + /** + * @When there should be bundled products listed in order details + */ + public function thereShouldBeBundledProductsListedOnOrderShowPage(): void + { + Assert::true($this->orderShowPage->hasBundledProductsList()); + } + + /** + * @When the list should contain :productName in order details + */ + public function thereShouldBeAProductOnTheListOnOrderShowPage(string $productName): void + { + Assert::true($this->orderShowPage->hasBundledProduct($productName)); + } } diff --git a/tests/Behat/Page/Admin/CreateBundledProductPage.php b/tests/Behat/Page/Admin/CreateBundledProductPage.php index eb2f8ae0..23067825 100644 --- a/tests/Behat/Page/Admin/CreateBundledProductPage.php +++ b/tests/Behat/Page/Admin/CreateBundledProductPage.php @@ -60,13 +60,13 @@ public function specifyOriginalPrice(ChannelInterface $channel, int $originalPri $this->getElement('original_price', ['%channelCode%' => $channel->getCode()])->setValue($originalPrice); } - public function addProductsToBundle(array $productsNames): void + public function addProductsToBundle(array $productsNames, array $quantites = []): void { $this->clickTabIfItsNotActive('bundle'); $productCounter = 0; - foreach ($productsNames as $productName) { + foreach ($productsNames as $i => $productName) { $addSelector = $this->getElement('add_product_to_bundle_button'); $addSelector->click(); $addSelector->waitFor(5, fn () => $this->hasElement('product_selector_dropdown')); @@ -80,7 +80,8 @@ public function addProductsToBundle(array $productsNames): void ]); $item->click(); - $this->getElement('product_selector_quantity', ['%productCounter%' => $productCounter])->setValue('1'); + $quantity = array_key_exists($i, $quantites) ? (string) $quantites[$i] : '1'; + $this->getElement('product_selector_quantity', ['%productCounter%' => $productCounter])->setValue($quantity); ++$productCounter; } diff --git a/tests/Behat/Page/Shop/BundledProductsListPageInterface.php b/tests/Behat/Page/Shop/BundledProductsListPageInterface.php new file mode 100644 index 00000000..971d19aa --- /dev/null +++ b/tests/Behat/Page/Shop/BundledProductsListPageInterface.php @@ -0,0 +1,19 @@ +hasElement('products_in_bundle'); + } + + public function hasBundledProduct(string $productName): bool + { + return $this->hasElement('bundled_product', ['%productName%' => $productName]); + } + + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'products_in_bundle' => '#sylius-order > tbody > tr:nth-child(2) > td > div > div.title.bundled-items-header > strong:contains("Products in bundle")', + 'bundled_product' => '#sylius-order > tbody > tr:nth-child(2) > td > div > div.content.bundled-items > div > div > div > div:contains("%productName%")', + ]); + } +} diff --git a/tests/Behat/Page/Shop/SummaryPage.php b/tests/Behat/Page/Shop/SummaryPage.php new file mode 100644 index 00000000..8acb33fd --- /dev/null +++ b/tests/Behat/Page/Shop/SummaryPage.php @@ -0,0 +1,35 @@ +hasElement('products_in_bundle'); + } + + public function hasBundledProduct(string $productName): bool + { + return $this->hasElement('bundled_product', ['%productName%' => $productName]); + } + + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'products_in_bundle' => '#sylius-cart-items > tbody > tr:nth-child(2) > td > div > div.title.bundled-items-header > strong:contains("Products in bundle")', + 'bundled_product' => '#sylius-cart-items > tbody > tr:nth-child(2) > td > div > div.content.bundled-items > div > div > div > div:contains("%productName%")', + ]); + } +} diff --git a/tests/Behat/Resources/services.yml b/tests/Behat/Resources/services.yml index f6ae41e7..db9940d3 100644 --- a/tests/Behat/Resources/services.yml +++ b/tests/Behat/Resources/services.yml @@ -14,6 +14,11 @@ services: - '@sylius.factory.channel_pricing' - '@sylius.product_variant_resolver.default' - '@sylius.generator.slug' + - '@doctrine.orm.entity_manager' + - '@sylius.order_item_quantity_modifier' + - '@bitbag_sylius_product_bundle.custom_factory.product_bundle_order_item' + - '@sylius.order_modifier' + - '@bitbag_sylius_product_bundle.custom_factory.order_item' bitbag_sylius_product_bundle_plugin.behat.page.create_bundled_product_page: class: Tests\BitBag\SyliusProductBundlePlugin\Behat\Page\Admin\CreateBundledProductPage @@ -22,7 +27,28 @@ services: arguments: - 'bitbag_product_bundle_admin_product_create_bundle' + bitbag_sylius_product_bundle_plugin.behat.page.summary_page: + class: Tests\BitBag\SyliusProductBundlePlugin\Behat\Page\Shop\SummaryPage + parent: sylius.behat.page.shop.cart_summary + public: false + + bitbag_sylius_product_bundle_plugin.behat.page.account.order_show_page: + class: Tests\BitBag\SyliusProductBundlePlugin\Behat\Page\Shop\OrderShowPage + parent: sylius.behat.page.shop.account.order.show + public: false + bitbag_sylius_product_bundle_plugin.behat.context.ui.product_bundle: class: Tests\BitBag\SyliusProductBundlePlugin\Behat\Context\Ui\ProductBundleContext arguments: - '@bitbag_sylius_product_bundle_plugin.behat.page.create_bundled_product_page' + - '@sylius.repository.product' + - '@bitbag_sylius_product_bundle_plugin.behat.page.summary_page' + - '@bitbag_sylius_product_bundle_plugin.behat.page.account.order_show_page' + + bitbag_sylius_product_bundle_plugin.behat.context.api.product_bundle: + class: Tests\BitBag\SyliusProductBundlePlugin\Behat\Context\Api\ProductBundleContext + arguments: + - '@sylius.behat.shared_storage' + - '@sylius.behat.api_platform_client.shop' + - '@sylius.behat.request_factory' + - '@Sylius\Behat\Client\ResponseCheckerInterface' diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index 70c3f6c8..1b818d96 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -4,24 +4,29 @@ default: contexts: - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.transform.lexical - - sylius.behat.context.transform.product - - sylius.behat.context.transform.address - - sylius.behat.context.transform.payment - - sylius.behat.context.transform.shipping_method - - sylius.behat.context.transform.zone - - sylius.behat.context.transform.locale - - sylius.behat.context.transform.channel - - - sylius.behat.context.setup.currency - - sylius.behat.context.setup.locale + - sylius.behat.context.setup.admin_security - sylius.behat.context.setup.channel + - sylius.behat.context.setup.currency - sylius.behat.context.setup.customer - - sylius.behat.context.setup.shop_security + - sylius.behat.context.setup.locale + - sylius.behat.context.setup.payment - sylius.behat.context.setup.product - - sylius.behat.context.setup.admin_security + - sylius.behat.context.setup.promotion + - sylius.behat.context.setup.taxation - sylius.behat.context.setup.shipping - - sylius.behat.context.setup.payment + - sylius.behat.context.setup.shop_security + + - sylius.behat.context.transform.address + - sylius.behat.context.transform.channel + - sylius.behat.context.transform.lexical + - sylius.behat.context.transform.locale + - sylius.behat.context.transform.payment + - sylius.behat.context.transform.product + - sylius.behat.context.transform.promotion + - sylius.behat.context.transform.shared_storage + - sylius.behat.context.transform.shipping_method + - sylius.behat.context.transform.tax_category + - sylius.behat.context.transform.zone - sylius.behat.context.ui.shop.cart - sylius.behat.context.ui.shop.checkout.addressing @@ -30,7 +35,76 @@ default: - sylius.behat.context.ui.shop.checkout.thank_you - sylius.behat.context.ui.admin.notification + - bitbag_sylius_product_bundle_plugin.behat.context.ui.product_bundle - bitbag_sylius_product_bundle_plugin.behat.context.setup.product_bundle + + filters: + tags: "@bundled_product&&@ui&&~@shop" + + shop_bundled_product: + contexts: + - sylius.behat.context.hook.doctrine_orm + + - sylius.behat.context.setup.channel + - sylius.behat.context.setup.customer + - sylius.behat.context.setup.order + - sylius.behat.context.setup.payment + - sylius.behat.context.setup.product + - sylius.behat.context.setup.shipping + - sylius.behat.context.setup.shop_security + + - sylius.behat.context.transform.address + - sylius.behat.context.transform.customer + - sylius.behat.context.transform.lexical + - sylius.behat.context.transform.order + - sylius.behat.context.transform.payment + - sylius.behat.context.transform.product + - sylius.behat.context.transform.shared_storage + - sylius.behat.context.transform.shipping_method + + - sylius.behat.context.ui.shop.account + - sylius.behat.context.ui.shop.cart + - bitbag_sylius_product_bundle_plugin.behat.context.ui.product_bundle + - bitbag_sylius_product_bundle_plugin.behat.context.setup.product_bundle + + filters: + tags: "@bundled_product&&@ui&&@shop" + + api_bundled_product: + contexts: + - sylius.behat.context.hook.doctrine_orm + + - sylius.behat.context.setup.admin_security + - sylius.behat.context.setup.channel + - sylius.behat.context.setup.currency + - sylius.behat.context.setup.customer + - sylius.behat.context.setup.locale + - sylius.behat.context.setup.payment + - sylius.behat.context.setup.product + - sylius.behat.context.setup.promotion + - sylius.behat.context.setup.taxation + - sylius.behat.context.setup.shipping + - sylius.behat.context.setup.shop_security + + - sylius.behat.context.transform.address + - sylius.behat.context.transform.channel + - sylius.behat.context.transform.lexical + - sylius.behat.context.transform.locale + - sylius.behat.context.transform.payment + - sylius.behat.context.transform.product + - sylius.behat.context.transform.promotion + - sylius.behat.context.transform.shared_storage + - sylius.behat.context.transform.shipping_method + - sylius.behat.context.transform.tax_category + - sylius.behat.context.transform.zone + + - sylius.behat.context.api.shop.cart + - sylius.behat.context.api.shop.checkout + - sylius.behat.context.api.shop.checkout.complete + + - bitbag_sylius_product_bundle_plugin.behat.context.api.product_bundle + - bitbag_sylius_product_bundle_plugin.behat.context.setup.product_bundle + filters: - tags: "@bundled_product" + tags: "@bundled_product&&@api"