@@ -8,34 +8,60 @@ Feature: Add discount to cart
88 | sku | name | price |
99 | 001 | potatoes | 2 .5 |
1010 | 002 | water | 0 .95 |
11- And there is a cart discount "free shipping" for 1 euros with code "FREE-SHIPPING"
12- And there is a cart discount "Amazing discount" for 1 euros with a minimum total price of 6 euros
11+ And there is a cart discount "free shipping" for 10 % with code "FREE-SHIPPING"
1312 And I have a cart
1413
1514 Scenario : Add discount
1615 Given I add 2 units of product "001" to my cart
1716 When I apply "FREE-SHIPPING" discount to my cart
18- Then the cart's total cost should be 4.0 euros
17+ Then the cart's total cost should be 4.50 euros
1918 And there should be discount "free shipping" in my cart
2019
2120 Scenario : Add discount only apply once
2221 Given I add 2 units of product "001" to my cart
2322 And I apply "FREE-SHIPPING" discount to my cart
2423 When I apply "FREE-SHIPPING" discount to my cart
25- Then the cart's total cost should be 4.0 euros
24+ Then the cart's total cost should be 4.5 euros
2625 And there should be discount "free shipping" in my cart
2726
2827 Scenario : Mix automatic and code discounts
29- Given I add 3 units of product "001" to my cart
28+ Given there is a cart discount "Amazing discount" for 10 % with a minimum total price of 6 euros
29+ And I add 3 units of product "001" to my cart
3030 When I apply "FREE-SHIPPING" discount to my cart
31- Then the cart's total cost should be 5.5 euros
31+ Then the cart's total cost should be 6.0 euros
3232 And there should be discount "free shipping" in my cart
3333 And there should be discount "Amazing discount" in my cart
3434
3535 Scenario : Code discounts are no recalculated
36- Given I add 2 units of product "001" to my cart
36+ Given there is a cart discount "Amazing discount" for 10 % with a minimum total price of 6 euros
37+ And I add 2 units of product "001" to my cart
3738 And I add 2 units of product "002" to my cart
3839 And I apply "FREE-SHIPPING" discount to my cart
3940 When I remove product "002" of my cart
40- Then the cart's total cost should be 4.0 euros
41- And there should be discount "free shipping" in my cart
41+ Then the cart's total cost should be 4.5 euros
42+ And there should be discount "free shipping" in my cart
43+
44+ Scenario Outline : Add discount examples
45+ Given the following products exist:
46+ | sku | name | price |
47+ | 003 | orange juice | <product_price > |
48+ And there is a cart discount "super discount" for <percentage> % with code "SUPER-DISCOUNT"
49+ Given I add <product_quantity> units of product "003" to my cart
50+ When I apply "SUPER-DISCOUNT" discount to my cart
51+ Then the cart's total cost should be <cart_total> euros
52+ And there should be discount "super discount" in my cart
53+ Examples :
54+ | product_price | product_quantity | percentage | cart_total |
55+ | 21 .0 | 1 | 10 | 18 .90 |
56+ | 20 .0 | 2 | 15 | 34 .0 |
57+ | 5 .0 | 3 | 3 | 14 .55 |
58+
59+ Scenario : Cart value is always positive
60+ Given there is a cart discount "super discount" for 50 % with code "SUPER-DISCOUNT"
61+ And there is a cart discount "another super discount" for 55 % with code "ANOTHER-SUPER-DISCOUNT"
62+ And I add 5 units of product "001" to my cart
63+ When I apply "SUPER-DISCOUNT" discount to my cart
64+ And I apply "ANOTHER-SUPER-DISCOUNT" discount to my cart
65+ Then the cart's total cost should be 0 euros
66+ And there should be discount "super discount" in my cart
67+ And there should be discount "another super discount" in my cart
0 commit comments