Skip to content

Commit c5f9b08

Browse files
MAGETWO-71375: Zero Subtotal Orders have incorrect status
- Add automation test
1 parent c27fae6 commit c5f9b08

File tree

7 files changed

+262
-0
lines changed

7 files changed

+262
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<!--Fill shipment form for free shipping-->
12+
<actionGroup name="ShipmentFormFreeShippingActionGroup" extends="ShipmentFormActionGroup">
13+
<see userInput="$0.00 Free Free Shipping" selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName('Free Shipping')}}" stepKey="seeShippingMethod" after="clickToChooseState"/>
14+
<click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Free Shipping')}}" stepKey="selectFlatShippingMethod" after="seeShippingMethod"/>
15+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask" after="selectFlatShippingMethod"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="ZeroSubtotalOrdersWithProcessingStatusTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="MAGETWO-71375: Zero Subtotal Orders have incorrect status"/>
15+
<title value="Checking status of Zero Subtotal Orders with 'Processing' New Order Status"/>
16+
<description value="Created order should be in Processing status"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-94178"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="simplecategory"/>
23+
<createData entity="SimpleProduct" stepKey="simpleproduct">
24+
<requiredEntity createDataKey="simplecategory"/>
25+
</createData>
26+
<createData entity="PaymentMethodsSettingConfig" stepKey="paymentMethodsSettingConfig"/>
27+
<createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/>
28+
<!--Go to Admin page-->
29+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
30+
</before>
31+
32+
<after>
33+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteSalesRule">
34+
<argument name="ruleName" value="{{ApiSalesRule.name}}"/>
35+
</actionGroup>
36+
<createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/>
37+
<createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/>
38+
<createData entity="DisablePaymentMethodsSettingConfig" stepKey="disablePaymentMethodsSettingConfig"/>
39+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
40+
<deleteData createDataKey="simpleproduct" stepKey="deleteProduct"/>
41+
<deleteData createDataKey="simplecategory" stepKey="deleteCategory"/>
42+
</after>
43+
44+
<!--Open MARKETING > Cart Price Rules-->
45+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
46+
<waitForPageLoad stepKey="waitForRulesPage"/>
47+
48+
<!--Add New Rule-->
49+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
50+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/>
51+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/>
52+
<actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/>
53+
<selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/>
54+
<fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/>
55+
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon"/>
56+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
57+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Percent of product price discount" stepKey="selectActionType"/>
58+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="100" stepKey="fillDiscountAmount"/>
59+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
60+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
61+
62+
<!--Proceed to store front and place an order with free shipping using created coupon-->
63+
<!--Add product to card-->
64+
<actionGroup ref="AddSimpleProductToCart" stepKey="AddProductToCard">
65+
<argument name="product" value="$$simpleproduct$$"/>
66+
</actionGroup>
67+
68+
<!--Proceed to shipment-->
69+
<click selector="{{ProductCardSection.showCard}}" stepKey="clickToOpenCard"/>
70+
<click selector="{{ProductCardSection.proceed}}" stepKey="clickToProceedToCheckout"/>
71+
<waitForPageLoad stepKey="waitForTheFormIsOpened"/>
72+
73+
<!--Fill shipping form-->
74+
<actionGroup ref="ShipmentFormFreeShippingActionGroup" stepKey="shipmentFormFreeShippingActionGroup"/>
75+
76+
<click selector="{{ProductCardSection.addCoupon}}" stepKey="clickToAddDiscount"/>
77+
<fillField selector="{{ProductCardSection.addCode}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/>
78+
<click selector="{{ProductCardSection.applyDiscount}}" stepKey="clickToApplyDiscount"/>
79+
<waitForPageLoad stepKey="WaitForDiscountToBeAdded"/>
80+
<see userInput="Your coupon was successfully applied." stepKey="verifyText"/>
81+
82+
<waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
83+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
84+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
85+
86+
<!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status-->
87+
<amOnPage url="/admin/sales/order/" stepKey="navigateToSalesOrderPage"/>
88+
<waitForPageLoad stepKey="waitForSalesOrderPageLoaded"/>
89+
90+
<!-- Open Order -->
91+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById">
92+
<argument name="orderId" value="$grabOrderNumber"/>
93+
</actionGroup>
94+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
95+
<waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/>
96+
97+
<!--Verify that Created order is in Processing status-->
98+
<see selector="{{AdminShipmentOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeShipmentOrderStatus"/>
99+
</test>
100+
</tests>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/>
2121
<element name="coupon" type="select" selector="select[name='coupon_type']"/>
2222
<element name="couponCode" type="input" selector="input[name='coupon_code']"/>
23+
<element name="userPerCoupon" type="input" selector="input[name='uses_per_coupon']"/>
2324
<element name="useAutoGeneration" type="checkbox" selector="input[name='use_auto_generation']"/>
2425

2526
<!-- Actions sub-form -->
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
9+
<entity name="PaymentMethodsSettingConfig" type="zero_subtotal_checkout_config_state">
10+
<requiredEntity type="active">active</requiredEntity>
11+
<requiredEntity type="order_status">orderStatus</requiredEntity>
12+
</entity>
13+
<entity name="active" type="active">
14+
<data key="value">1</data>
15+
</entity>
16+
<entity name="orderStatus" type="order_status">
17+
<data key="value">processing</data>
18+
</entity>
19+
20+
<entity name="DisablePaymentMethodsSettingConfig" type="use_system_value_config_state">
21+
<requiredEntity type="zeroSubEnable">zeroSubEnable</requiredEntity>
22+
<requiredEntity type="zeroSubOrderStatus">zeroSubOrderStatus</requiredEntity>
23+
</entity>
24+
<entity name="zeroSubEnable" type="zeroSubEnable">
25+
<data key="value">1</data>
26+
</entity>
27+
<entity name="zeroSubOrderStatus" type="zeroSubOrderStatus">
28+
<data key="value">1</data>
29+
</entity>
30+
</entities>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
9+
<entity name="FreeShippingMethodsSettingConfig" type="free_shipping_config_state">
10+
<requiredEntity type="active">active</requiredEntity>
11+
</entity>
12+
<entity name="active" type="active">
13+
<data key="value">1</data>
14+
</entity>
15+
16+
<!-- default configuration used to restore Magento config -->
17+
<entity name="DefaultShippingMethodsConfig" type="free_shipping_config_state">
18+
<requiredEntity type="active">DefaultFreeShipping</requiredEntity>
19+
</entity>
20+
<entity name="DefaultFreeShipping" type="active">
21+
<data key="value">0</data>
22+
</entity>
23+
24+
<entity name="DisableFreeShippingConfig" type="disable_free_shipping_config_state">
25+
<requiredEntity type="disableFreeShipping">disableFreeShipping</requiredEntity>
26+
</entity>
27+
<entity name="disableFreeShipping" type="disableFreeShipping">
28+
<data key="value">1</data>
29+
</entity>
30+
</entities>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
11+
<operation name="EnableZeroSubtotalCheckoutConfigState" dataType="zero_subtotal_checkout_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
12+
<object key="groups" dataType="zero_subtotal_checkout_config_state">
13+
<object key="free" dataType="zero_subtotal_checkout_config_state">
14+
<object key="fields" dataType="zero_subtotal_checkout_config_state">
15+
<object key="active" dataType="active">
16+
<field key="value">string</field>
17+
</object>
18+
<object key="order_status" dataType="order_status">
19+
<field key="value">string</field>
20+
</object>
21+
</object>
22+
</object>
23+
</object>
24+
</operation>
25+
26+
<operation name="DisablePaymentMethodsSettingConfig" dataType="use_system_value_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
27+
<object key="groups" dataType="use_system_value_config_state">
28+
<object key="free" dataType="use_system_value_config_state">
29+
<object key="fields" dataType="use_system_value_config_state">
30+
<object key="active" dataType="use_system_value_config_state">
31+
<object key="inherit" dataType="zeroSubEnable">
32+
<field key="value">integer</field>
33+
</object>
34+
</object>
35+
<object key="order_status" dataType="use_system_value_config_state">
36+
<object key="inherit" dataType="zeroSubOrderStatus">
37+
<field key="value">integer</field>
38+
</object>
39+
</object>
40+
</object>
41+
</object>
42+
</object>
43+
</operation>
44+
45+
</operations>
46+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
11+
<operation name="EnableFreeShippingConfigState" dataType="free_shipping_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/carriers/" method="POST">
12+
<object key="groups" dataType="free_shipping_config_state">
13+
<object key="freeshipping" dataType="free_shipping_config_state">
14+
<object key="fields" dataType="free_shipping_config_state">
15+
<object key="active" dataType="active">
16+
<field key="value">string</field>
17+
</object>
18+
</object>
19+
</object>
20+
</object>
21+
</operation>
22+
23+
<operation name="DisableFreeShippingConfigState" dataType="disable_free_shipping_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/carriers/" method="POST">
24+
<object key="groups" dataType="disable_free_shipping_config_state">
25+
<object key="freeshipping" dataType="disable_free_shipping_config_state">
26+
<object key="fields" dataType="disable_free_shipping_config_state">
27+
<object key="active" dataType="disable_free_shipping_config_state">
28+
<object key="inherit" dataType="disableFreeShipping">
29+
<field key="value">integer</field>
30+
</object>
31+
</object>
32+
</object>
33+
</object>
34+
</object>
35+
</operation>
36+
37+
</operations>
38+

0 commit comments

Comments
 (0)