From fda1f4b8d3e4976605dafa7278d3495dd37b1dca Mon Sep 17 00:00:00 2001 From: Grzegorz Sadowski Date: Thu, 14 Apr 2022 09:44:14 +0200 Subject: [PATCH] [Behat][ShippingMethod] Adjust scenarios for shipping rules to be based on items total instead of order total --- ...hipping_cost_based_on_items_total.feature} | 12 ++--- ...ping_methods_based_on_items_total.feature} | 27 +++++----- ...ms_total_with_taxes_and_promotions.feature | 53 +++++++++++++++++++ .../adding_shipping_method_with_rule.feature | 4 +- .../applying_shipping_method_rules.yml | 1 + .../applying_shipping_method_rules.yml | 1 + 6 files changed, 76 insertions(+), 22 deletions(-) rename features/shipping/applying_shipping_method_rules/{seeing_estimated_shipping_cost_based_on_order_total.feature => seeing_estimated_shipping_cost_based_on_items_total.feature} (73%) rename features/shipping/applying_shipping_method_rules/{viewing_available_shipping_methods_based_on_order_total.feature => viewing_available_shipping_methods_based_on_items_total.feature} (63%) create mode 100644 features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total_with_taxes_and_promotions.feature diff --git a/features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_order_total.feature b/features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_items_total.feature similarity index 73% rename from features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_order_total.feature rename to features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_items_total.feature index 24c9b4320a..4b127868e6 100644 --- a/features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_order_total.feature +++ b/features/shipping/applying_shipping_method_rules/seeing_estimated_shipping_cost_based_on_items_total.feature @@ -1,5 +1,5 @@ @applying_shipping_method_rules -Feature: Seeing estimated shipping costs based on order total +Feature: Seeing estimated shipping costs based on items total In order to be aware of estimated shipping costs As a Customer I want to see estimated shipping costs that match the shipping method rule @@ -7,19 +7,19 @@ Feature: Seeing estimated shipping costs based on order total Background: Given the store operates on a single channel in "United States" And the store has a product "Cheap Jacket" priced at "$20.00" - And the store has a product "Expensive Jacket" priced at "$200.00" - And the store has "Ship with us, ship with pride" shipping method with "$200" fee + And the store has a product "Expensive Jacket" priced at "$30.00" + And the store has "Above $30" shipping method with "$1" fee And this shipping method is only available for orders over or equal to "$30" - And the store has "We delivery cheap goodz" shipping method with "$2" fee + And the store has "Below $29.99" shipping method with "$10" fee And this shipping method is only available for orders under or equal to "$29.99" And I am a logged in customer @ui @api Scenario: Seeing valid estimated shipping cost for the cart with a value over minimum price configured on the shipping method When I add product "Expensive Jacket" to the cart - Then my cart estimated shipping cost should be "$200.00" + Then my cart estimated shipping cost should be "$1.00" @ui @api Scenario: Seeing valid estimated shipping cost for the cart with a value under maximum price configured on the shipping method When I add product "Cheap Jacket" to the cart - Then my cart estimated shipping cost should be "$2.00" + Then my cart estimated shipping cost should be "$10.00" diff --git a/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_order_total.feature b/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total.feature similarity index 63% rename from features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_order_total.feature rename to features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total.feature index a723329c81..35620ff723 100644 --- a/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_order_total.feature +++ b/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total.feature @@ -1,5 +1,5 @@ @applying_shipping_method_rules -Feature: Viewing available shipping methods based on order total +Feature: Viewing available shipping methods based on items total In order to only see applicable shipping methods As a Customer I want to see the shipping methods that are available to my order @@ -7,12 +7,12 @@ Feature: Viewing available shipping methods based on order total Background: Given the store operates on a single channel in "United States" And the store has a product "Cheap Jacket" priced at "$20.00" - And the store has a product "Expensive Jacket" priced at "$200.00" + And the store has a product "Expensive Jacket" priced at "$50.00" + And the store has "Above $50" shipping method with "$1" fee + And this shipping method is only available for orders over or equal to "$50" + And the store has "Below $29.99" shipping method with "$10" fee + And this shipping method is only available for orders under or equal to "$29.99" And the store has "DHL" shipping method with "$20" fee - And the store has "Ship with us, ship with pride" shipping method with "$200" fee - And this shipping method is only available for orders over or equal to "$100" - And the store has "We delivery cheap goodz" shipping method with "$2" fee - And this shipping method is only available for orders under or equal to "$50" And I am a logged in customer @ui @api @@ -21,8 +21,8 @@ Feature: Viewing available shipping methods based on order total When I specified the billing address Then I should be on the checkout shipping step And I should see "DHL" shipping method - And I should see "Ship with us, ship with pride" shipping method - And I should not see "We delivery cheap goodz" shipping method + And I should see "Above $50" shipping method + And I should not see "Below $29.99" shipping method @ui @api Scenario: Seeing shipping methods that handle cheap goods @@ -30,15 +30,14 @@ Feature: Viewing available shipping methods based on order total When I specified the billing address Then I should be on the checkout shipping step And I should see "DHL" shipping method - And I should see "We delivery cheap goodz" shipping method - And I should not see "Ship with us, ship with pride" shipping method + And I should see "Below $29.99" shipping method + And I should not see "Above $50" shipping method @ui @api Scenario: Seeing shipping methods that handle all goods - Given I have product "Cheap Jacket" in the cart - And I add 2 of them to my cart + Given I have 2 products "Cheap Jacket" in the cart When I specified the billing address Then I should be on the checkout shipping step And I should see "DHL" shipping method - And I should not see "We delivery cheap goodz" shipping method - And I should not see "Ship with us, ship with pride" shipping method + And I should not see "Above $50" shipping method + And I should not see "Below $29.99" shipping method diff --git a/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total_with_taxes_and_promotions.feature b/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total_with_taxes_and_promotions.feature new file mode 100644 index 0000000000..b38805ff4b --- /dev/null +++ b/features/shipping/applying_shipping_method_rules/viewing_available_shipping_methods_based_on_items_total_with_taxes_and_promotions.feature @@ -0,0 +1,53 @@ +@applying_shipping_method_rules +Feature: Viewing available shipping methods based on items total + In order to only see applicable shipping methods + As a Customer + I want to see the shipping methods that are available to my order + + Background: + Given the store operates on a single channel in "United States" + And the store has "VAT" tax rate of 20% for "Clothes" within the "US" zone + And the store has "Shipping VAT" tax rate of 10% for "Shipping Services" within the "US" zone + And the store has a product "Cheap Jacket" priced at "$20.00" + And it belongs to "Clothes" tax category + And the store has a product "Expensive Jacket" priced at "$47.00" + And it belongs to "Clothes" tax category + And the store has "Above $50" shipping method with "$1" fee within the "US" zone + And shipping method "Above $50" belongs to "Shipping Services" tax category + And this shipping method is only available for orders over or equal to "$50" + And the store has "Below $29.99" shipping method with "$20" fee within the "US" zone + And shipping method "Below $29.99" belongs to "Shipping Services" tax category + And this shipping method is only available for orders under or equal to "$29.99" + And the store has "DHL" shipping method with "$20" fee + And there is a promotion "50% shipping discount" + And it gives "50%" discount on shipping to every order + And there is a promotion "Expensive promotion" + And it gives "$5.00" off on a "Expensive Jacket" product + And I am a logged in customer + + @ui @api + Scenario: Seeing shipping methods that handle expensive goods + Given I have product "Expensive Jacket" in the cart + When I specified the billing address + Then I should be on the checkout shipping step + And I should see "DHL" shipping method + And I should see "Above $50" shipping method + And I should not see "Below $29.99" shipping method + + @ui @api + Scenario: Seeing shipping methods that handle cheap goods + Given I have product "Cheap Jacket" in the cart + When I specified the billing address + Then I should be on the checkout shipping step + And I should see "DHL" shipping method + And I should see "Below $29.99" shipping method + And I should not see "Above $50" shipping method + + @ui @api + Scenario: Seeing shipping methods that handle all goods + Given I have 2 products "Cheap Jacket" in the cart + When I specified the billing address + Then I should be on the checkout shipping step + And I should see "DHL" shipping method + And I should not see "Above $50" shipping method + And I should not see "Below $29.99" shipping method diff --git a/features/shipping/managing_shipping_methods/adding_shipping_method_with_rule.feature b/features/shipping/managing_shipping_methods/adding_shipping_method_with_rule.feature index f594fb940f..623daae995 100644 --- a/features/shipping/managing_shipping_methods/adding_shipping_method_with_rule.feature +++ b/features/shipping/managing_shipping_methods/adding_shipping_method_with_rule.feature @@ -47,7 +47,7 @@ Feature: Adding a new shipping method with rule And I define it for the zone named "United States" And I choose "Flat rate per shipment" calculator And I specify its amount as 50 for "Web-US" channel - And I add the "Order total greater than or equal" rule configured with $200 for "Web-US" channel + And I add the "Items total greater than or equal" rule configured with $200 for "Web-US" channel And I add it Then I should be notified that it has been successfully created And the shipping method "FedEx Carrier" should appear in the registry @@ -61,7 +61,7 @@ Feature: Adding a new shipping method with rule And I define it for the zone named "United States" And I choose "Flat rate per shipment" calculator And I specify its amount as 50 for "Web-US" channel - And I add the "Order total less than or equal" rule configured with $200 for "Web-US" channel + And I add the "Items total less than or equal" rule configured with $200 for "Web-US" channel And I add it Then I should be notified that it has been successfully created And the shipping method "FedEx Carrier" should appear in the registry diff --git a/src/Sylius/Behat/Resources/config/suites/api/shipping/applying_shipping_method_rules.yml b/src/Sylius/Behat/Resources/config/suites/api/shipping/applying_shipping_method_rules.yml index 19ec4c7b11..11f287c2a2 100644 --- a/src/Sylius/Behat/Resources/config/suites/api/shipping/applying_shipping_method_rules.yml +++ b/src/Sylius/Behat/Resources/config/suites/api/shipping/applying_shipping_method_rules.yml @@ -26,6 +26,7 @@ default: - sylius.behat.context.setup.geographical - sylius.behat.context.setup.payment - sylius.behat.context.setup.product + - sylius.behat.context.setup.promotion - sylius.behat.context.setup.shop_security - sylius.behat.context.setup.shipping - sylius.behat.context.setup.taxation diff --git a/src/Sylius/Behat/Resources/config/suites/ui/shipping/applying_shipping_method_rules.yml b/src/Sylius/Behat/Resources/config/suites/ui/shipping/applying_shipping_method_rules.yml index 389b2a9558..beaab55563 100644 --- a/src/Sylius/Behat/Resources/config/suites/ui/shipping/applying_shipping_method_rules.yml +++ b/src/Sylius/Behat/Resources/config/suites/ui/shipping/applying_shipping_method_rules.yml @@ -23,6 +23,7 @@ default: - sylius.behat.context.setup.geographical - sylius.behat.context.setup.payment - sylius.behat.context.setup.product + - sylius.behat.context.setup.promotion - sylius.behat.context.setup.shop_security - sylius.behat.context.setup.shipping - sylius.behat.context.setup.taxation