[Behat][ShippingMethod] Adjust scenarios for shipping rules to be based on items total instead of order total

This commit is contained in:
Grzegorz Sadowski 2022-04-14 09:44:14 +02:00
parent baa6c087b4
commit fda1f4b8d3
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
6 changed files with 76 additions and 22 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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