-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2057 from dpfaffenbauer/feature/cart-item-actions
[CartPriceRules] introduce feature to allow cart-price rules based on cart-items
- Loading branch information
Showing
86 changed files
with
2,398 additions
and
164 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
features/domain/cart/rules/cart_item/amount_condition.feature
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 @@ | ||
@domain @cart @cart_item | ||
Feature: Adding a new cart item rule | ||
In order to give the customer discounts | ||
based on the cart, we add a new rule | ||
with a amount condition for specific cart items | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the site has a currency "Euro" with iso "EUR" | ||
And I am in country "Austria" | ||
And the site has two categories "Shoes" and "Coats" | ||
And the site has a category "Sneakers" | ||
And the category "Sneakers" is child of category "Shoes" | ||
And the site has a product "Shoe" priced at 10000 | ||
And it is in category "Shoes" | ||
And the site has a product "Shoe 2" priced at 15000 | ||
And it is in category "Shoes" | ||
And the site has a product "Jacket" priced at 40000 | ||
And it is in category "Coats" | ||
And the site has a product "Sneaker" priced at 350000 | ||
And it is in category "Sneakers" | ||
And I add the product "Shoe" to my cart | ||
|
||
Scenario: Add a new amount condition with is valid | ||
Given adding a cart price rule named "amount" | ||
And the cart rule is active | ||
And the cart rule is not a voucher rule | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a condition amount with value "90" to "150" | ||
And the cart item action has a action discount-percent with 10% discount | ||
Then I refresh my cart | ||
And the cart discount should be "-1000" excluding tax | ||
|
||
Scenario: Add a new amount condition with is invalid cause of min value | ||
Given adding a cart price rule named "amount" | ||
And the cart rule is active | ||
And the cart rule is not a voucher rule | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a condition amount with value "120" to "500" | ||
And the cart item action has a action discount-percent with 10% discount | ||
Then the cart rule should be valid for my cart | ||
And the cart discount should be "0" excluding tax | ||
|
||
Scenario: Add a new amount condition with is invalid cause of max value | ||
Given adding a cart price rule named "amount" | ||
And the cart rule is active | ||
And the cart rule is not a voucher rule | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a condition amount with value "10" to "90" | ||
And the cart item action has a action discount-percent with 10% discount | ||
Then the cart rule should be valid for my cart | ||
And the cart discount should be "0" excluding tax |
22 changes: 22 additions & 0 deletions
22
features/domain/cart/rules/cart_item/discount_amount_action.feature
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,22 @@ | ||
@domain @cart | ||
Feature: Adding a new cart rule | ||
In order to give the customer discounts | ||
based on the cart, we add a new rule | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the site has a currency "Euro" with iso "EUR" | ||
And I am in country "Austria" | ||
And the site has a product "Shoe" priced at 10000 | ||
And I add the product "Shoe" to my cart | ||
|
||
Scenario: Add a new discount rule with 20 percent discount for all products | ||
Given adding a cart price rule named "discount" | ||
And the cart rule is active | ||
And the cart rule is a voucher rule with code "asdf" | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a action discount with 20 in currency "EUR" off | ||
And I apply the voucher code "asdf" to my cart | ||
Then the cart discount should be "-2000" including tax | ||
Then the cart total should be "8000" including tax | ||
|
32 changes: 32 additions & 0 deletions
32
features/domain/cart/rules/cart_item/discount_over_100_percent.feature
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,32 @@ | ||
@domain @cart | ||
Feature: Adding a new cart rule | ||
In order to give the customer discounts | ||
based on the cart, we add a new rule with a 100% discount | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the site has a currency "Euro" with iso "EUR" | ||
And I am in country "Austria" | ||
And the site has a tax rate "AT" with "20%" rate | ||
And the site has a tax rule group "AT" | ||
And the tax rule group has a tax rule for country "Austria" with tax rate "AT" | ||
And the site has a product "Shoe" priced at 10000 | ||
And the product has the tax rule group "AT" | ||
And I add the product "Shoe" to my cart | ||
|
||
Scenario: Add a new discount rule with 100 percent discount | ||
Given adding a cart price rule named "discount-10" | ||
And the cart rule is not a voucher rule | ||
And the cart rule is active | ||
And the cart rule has a action discount-percent with 100% discount | ||
Given adding a cart price rule named "discount-100" | ||
And the cart rule is a voucher rule with code "discount-100" | ||
And the cart rule is active | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a action discount-percent with 100% discount | ||
And I apply the voucher code "discount-100" to my cart | ||
Then the cart discount should be "-12000" including tax | ||
Then the cart discount should be "-10000" excluding tax | ||
Then the cart total tax should be "0" | ||
Then the cart total should be "0" excluding tax | ||
Then the cart total should be "0" including tax |
27 changes: 27 additions & 0 deletions
27
features/domain/cart/rules/cart_item/discount_percent_condition.feature
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,27 @@ | ||
@domain @cart | ||
Feature: Adding a new cart rule | ||
In order to give the customer discounts | ||
based on the cart, we add a new rule | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the site has a currency "Euro" with iso "EUR" | ||
And I am in country "Austria" | ||
And the site has two categories "Shoes" and "Coats" | ||
And the site has a product "Shoe" priced at 10000 | ||
And it is in category "Shoes" | ||
And the site has a product "Shoe 2" priced at 15000 | ||
And it is in category "Shoes" | ||
And the site has a product "Jacket" priced at 40000 | ||
And it is in category "Coats" | ||
And I add the product "Shoe" to my cart | ||
|
||
Scenario: Add a new discount rule with 20 percent discount for all products | ||
Given adding a cart price rule named "discount" | ||
And the cart rule is active | ||
And the cart rule is a voucher rule with code "asdf" | ||
And the cart rule has a cart-item-action action | ||
And the cart item action has a action discount-percent with 10% discount | ||
And I apply the voucher code "asdf" to my cart | ||
Then the cart discount should be "-1000" including tax | ||
Then the cart total should be "9000" including tax |
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
Oops, something went wrong.