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 =" urn:magento:mftf:Test/etc/testSchema.xsd" >
11
+ <test name =" AdminCreateOrderToVerifyApplyAndRemoveCouponCodeTest" >
12
+ <annotations >
13
+ <stories value =" Create Order with offline payment methods" />
14
+ <title value =" Create Order to verify apply and remove coupon code test" />
15
+ <description value =" Create Order to verify apply and remove coupon code test" />
16
+ <severity value =" CRITICAL" />
17
+ <testCaseId value =" MC-37386" />
18
+ <group value =" sales" />
19
+ </annotations >
20
+ <before >
21
+ <!-- Login as admin -->
22
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" LoginAsAdmin" />
23
+
24
+ <!-- Create customer -->
25
+ <createData entity =" Simple_US_Customer" stepKey =" createCustomer" />
26
+
27
+ <!-- Create simple product -->
28
+ <createData entity =" SimpleProduct2" stepKey =" createSimpleProduct" >
29
+ <field key =" price" >10</field >
30
+ </createData >
31
+
32
+ <!-- Create sales rule with coupon -->
33
+ <createData entity =" SalesRuleSpecificCouponWithFixedDiscount" stepKey =" createCartPriceRule" />
34
+ <createData entity =" SimpleSalesRuleCoupon" stepKey =" createCouponForCartPriceRule" >
35
+ <requiredEntity createDataKey =" createCartPriceRule" />
36
+ </createData >
37
+
38
+ <!-- Enable Bank Transfer payment -->
39
+ <magentoCLI command =" config:set {{EnablePaymentBankTransferConfigData.path}} {{EnablePaymentBankTransferConfigData.value}}" stepKey =" enableBankTransferPayment" />
40
+
41
+ <!-- Set default flat rate shipping method settings-->
42
+ <magentoCLI command =" config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey =" enableFlatRate" />
43
+ </before >
44
+ <after >
45
+ <!-- Disable Bank Transfer payment -->
46
+ <magentoCLI command =" config:set {{DisablePaymentBankTransferConfigData.path}} {{DisablePaymentBankTransferConfigData.value}}" stepKey =" disableBankTransferPayment" />
47
+
48
+ <!-- Delete sales rule -->
49
+ <deleteData createDataKey =" createCartPriceRule" stepKey =" deleteCartPriceRule" />
50
+
51
+ <!-- Delete customer -->
52
+ <deleteData createDataKey =" createCustomer" stepKey =" deleteCustomer" />
53
+
54
+ <!-- Delete product -->
55
+ <deleteData createDataKey =" createSimpleProduct" stepKey =" deleteSimpleProduct" />
56
+
57
+ <!-- Log out -->
58
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logout" />
59
+ </after >
60
+
61
+ <!-- Create order -->
62
+ <actionGroup ref =" NavigateToNewOrderPageExistingCustomerActionGroup" stepKey =" goToCreateOrderPage" >
63
+ <argument name =" customer" value =" $$createCustomer$$" />
64
+ </actionGroup >
65
+
66
+ <!-- Add product to order -->
67
+ <actionGroup ref =" AddSimpleProductToOrderActionGroup" stepKey =" addProductToOrder" >
68
+ <argument name =" product" value =" $$createSimpleProduct$$" />
69
+ </actionGroup >
70
+
71
+ <!-- Apply coupon to the order -->
72
+ <actionGroup ref =" AdminApplyCouponToOrderActionGroup" stepKey =" applyCoupon" >
73
+ <argument name =" couponCode" value =" $$createCouponForCartPriceRule.code$$" />
74
+ </actionGroup >
75
+
76
+ <!-- Remove coupon from the order -->
77
+ <actionGroup ref =" AdminRemoveCouponFromOrderActionGroup" stepKey =" removeCoupon" />
78
+
79
+ <!-- Select FlatRate shipping method-->
80
+ <actionGroup ref =" AdminSelectFlatRateShippingMethodActionGroup" stepKey =" selectFlatRateShippingMethod" />
81
+
82
+ <!-- Select bank Transfer payment method -->
83
+ <waitForElementVisible selector =" {{AdminOrderFormPaymentSection.paymentBlock}}" stepKey =" waitForPaymentOptions" />
84
+ <conditionalClick selector =" {{AdminOrderFormPaymentSection.bankTransferOption}}" dependentSelector =" {{AdminOrderFormPaymentSection.bankTransferOption}}" visible =" true" stepKey =" checkBankTransferOption" />
85
+
86
+ <!-- Submit order -->
87
+ <actionGroup ref =" AdminSubmitOrderActionGroup" stepKey =" submitOrder" />
88
+
89
+ <!-- Grab order id -->
90
+ <grabTextFrom selector =" |Order # (\d+)|" stepKey =" getOrderId" />
91
+
92
+ <!-- Open created order -->
93
+ <amOnPage url =" {{AdminOrdersPage.url}}" stepKey =" goToOrdersPage" />
94
+ <waitForPageLoad stepKey =" waitForOrdersPageLoad" />
95
+ <actionGroup ref =" FilterOrderGridByIdActionGroup" stepKey =" filterOrdersGridById" >
96
+ <argument name =" orderId" value =" $getOrderId" />
97
+ </actionGroup >
98
+ <click selector =" {{AdminDataGridTableSection.firstRow}}" stepKey =" clickCreatedOrderInGrid" />
99
+ </test >
100
+ </tests >
0 commit comments