From d082e5d539c6dd955481441190cac4aa4ea5e07d Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 27 May 2024 11:07:10 +0200 Subject: [PATCH] Fix tests --- features/importing_product_models.feature | 4 +++ features/importing_products.feature | 8 ++++++ features/reconciliate_products.feature | 6 ++-- .../Setup/AkeneoAttributeOptionContext.php | 28 +++++++++++++++++++ tests/Behat/Resources/services.xml | 2 ++ tests/Behat/Resources/suites.yml | 2 ++ 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 tests/Behat/Context/Setup/AkeneoAttributeOptionContext.php diff --git a/features/importing_product_models.feature b/features/importing_product_models.feature index 8918a1f9..5fa2b79e 100644 --- a/features/importing_product_models.feature +++ b/features/importing_product_models.feature @@ -10,6 +10,8 @@ Feature: Importing product models @cli Scenario: Importing product model and its variants Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect" + Given there is an option "M" for attribute "size" on Akeneo + Given there is an option "L" for attribute "size" on Akeneo And there is a family variant "accessories_size" on Akeneo for the family "accessories" And the family variant "accessories_size" of family "accessories" has the attribute "size" as axes of first level @@ -18,10 +20,12 @@ Feature: Importing product models And there is a product "BRAIDED_HAT_M" on Akeneo And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_M" has an attribute "size" with data "M" And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD" And there is a product "BRAIDED_HAT_L" on Akeneo And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_L" has an attribute "size" with data "L" And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD" And the store is also available in "it_IT" diff --git a/features/importing_products.feature b/features/importing_products.feature index db53dade..ae74fa80 100644 --- a/features/importing_products.feature +++ b/features/importing_products.feature @@ -10,6 +10,8 @@ Feature: Importing products @cli Scenario: Importing single product model and its variants Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect" + Given there is an option "M" for attribute "size" on Akeneo + Given there is an option "L" for attribute "size" on Akeneo And there is a family variant "accessories_size" on Akeneo for the family "accessories" And the family variant "accessories_size" of family "accessories" has the attribute "size" as axes of first level @@ -18,10 +20,12 @@ Feature: Importing products And there is a product "BRAIDED_HAT_M" on Akeneo And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_M" has an attribute "size" with data "M" And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD" And there is a product "BRAIDED_HAT_L" on Akeneo And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_L" has an attribute "size" with data "L" And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD" And the store is also available in "it_IT" @@ -34,6 +38,8 @@ Feature: Importing products @cli Scenario: Importing products with images should not leave temporary files in temporary files directory Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect" + Given there is an option "M" for attribute "size" on Akeneo + Given there is an option "L" for attribute "size" on Akeneo Given there is an attribute "attachment" on Akeneo of type "pim_catalog_file" And there is a family variant "accessories_size" on Akeneo for the family "accessories" @@ -43,12 +49,14 @@ Feature: Importing products And there is a product "BRAIDED_HAT_M" on Akeneo And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_M" has an attribute "size" with data "M" And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD" And the product "BRAIDED_HAT_M" has an attribute "attachment" with data "sample.pdf" And the product "BRAIDED_HAT_M" has an attribute "image" with data "star_wars_m.jpeg" And there is a product "BRAIDED_HAT_L" on Akeneo And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT" + And the product "BRAIDED_HAT_L" has an attribute "size" with data "L" And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD" And the product "BRAIDED_HAT_L" has an attribute "attachment" with data "sample.pdf" And the product "BRAIDED_HAT_L" has an attribute "image" with data "star_wars_l.jpeg" diff --git a/features/reconciliate_products.feature b/features/reconciliate_products.feature index b224abeb..8369cc2a 100644 --- a/features/reconciliate_products.feature +++ b/features/reconciliate_products.feature @@ -22,11 +22,11 @@ Feature: Reconcile products And there is a product "PRODUCT_1_VARIANT_2" updated at "2021-04-19" on Akeneo And there is a product "PRODUCT_2_VARIANT_2" updated at "2021-04-19" on Akeneo And the store has a product "product-1-variant-1" - And this product has "product-1-variant-2" variant priced at "$25" + And this product has "product-1-variant-2" variant priced at "$25.00" And the store has a product "product-2-variant-1" - And this product has "product-2-variant-2" variant priced at "$25" + And this product has "product-2-variant-2" variant priced at "$25.00" And the store has a product "product-3-variant-1" - And this product has "product-3-variant-2" variant priced at "$25" + And this product has "product-3-variant-2" variant priced at "$25.00" When I reconcile items Then the "product-1-variant-1" product should be enabled And the "product-1-variant-1" product variant should be enabled diff --git a/tests/Behat/Context/Setup/AkeneoAttributeOptionContext.php b/tests/Behat/Context/Setup/AkeneoAttributeOptionContext.php new file mode 100644 index 00000000..9cc2a367 --- /dev/null +++ b/tests/Behat/Context/Setup/AkeneoAttributeOptionContext.php @@ -0,0 +1,28 @@ + + + diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index 6d27865b..5d3c874a 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -11,6 +11,7 @@ default: - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model - webgriffe_sylius_akeneo.behat.context.setup.akeneo_family_variant - webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute_option - webgriffe_sylius_akeneo.behat.context.db.product - webgriffe_sylius_akeneo.behat.context.cli.import_command @@ -51,6 +52,7 @@ default: - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model - webgriffe_sylius_akeneo.behat.context.setup.akeneo_family_variant - webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute_option - webgriffe_sylius_akeneo.behat.context.db.product - webgriffe_sylius_akeneo.behat.context.cli.import_command