/
StorefrontCheckoutWithSpecialPriceProductsTest.xml
174 lines (154 loc) · 10.2 KB
/
StorefrontCheckoutWithSpecialPriceProductsTest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCheckoutWithSpecialPriceProductsTest">
<annotations>
<stories value="Checkout"/>
<title value="Verify customer checkout with special price simple and configurable products"/>
<description value="Create simple and configurable product with special prices and verify customer checkout"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-14708"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<createData entity="defaultSimpleProduct" stepKey="simpleProduct">
<field key="price">10.00</field>
</createData>
<actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct">
<argument name="productSku" value="$$simpleProduct.sku$$"/>
</actionGroup>
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceTopTheProduct">
<argument name="price" value="9"/>
</actionGroup>
<click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/>
<waitForPageLoad time='60' stepKey="waitForProducrSaved"/>
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessage"/>
<!-- Create the configurable product with product Attribute options-->
<createData entity="ApiCategory" stepKey="createCategory"/>
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<createData entity="AddToDefaultSet" stepKey="delete">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
<field key="price">20.00</field>
</createData>
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
<field key="price">10.00</field>
</createData>
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct1"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct2"/>
</createData>
<actionGroup ref="filterAndSelectProduct" stepKey="filterAndSelectTheProduct2">
<argument name="productSku" value="$$createConfigChildProduct2.sku$$"/>
</actionGroup>
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceTopTheProduct2">
<argument name="price" value="9"/>
</actionGroup>
<click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct1"/>
<waitForPageLoad time='60' stepKey="waitForSpecialPriceProductSaved"/>
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessage1"/>
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
<magentoCLI command="cache:flush" stepKey="flushCache"/>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigProduct1"/>
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigProduct2"/>
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<actionGroup ref="logout" stepKey="logout"/>
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
</after>
<!--Open Product page in StoreFront and assert product and price range -->
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct">
<argument name="product" value="$$simpleProduct$$"/>
</actionGroup>
<!--Add product to the cart -->
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="addProductToTheCart">
<argument name="productQty" value="1"/>
</actionGroup>
<!-- Add Configurable Product to the cart -->
<actionGroup ref="StorefrontAddConfigurableProductToTheCartActionGroup" stepKey="addConfigurableProductToCart">
<argument name="urlKey" value="$$createConfigProduct.custom_attributes[url_key]$$" />
<argument name="productAttribute" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="productOption" value="$$getConfigAttributeOption2.label$$"/>
<argument name="qty" value="1"/>
</actionGroup>
<!--Open View and edit -->
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart"/>
<!-- Fill the Estimate Shipping and Tax section -->
<actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/>
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<!-- Sign in using already existed customer details -->
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="$$createCustomer.email$$" stepKey="fillEmailAddress"/>
<waitForElementVisible selector="{{CheckoutShippingSection.password}}" stepKey="waitForPasswordFieldToBeVisible"/>
<fillField selector="{{CheckoutShippingSection.password}}" userInput="$$createCustomer.password$$" stepKey="fillPassword"/>
<click selector="{{CheckoutShippingSection.loginButton}}" stepKey="clickLoginButton"/>
<waitForPageLoad stepKey="waitForLoginPageToLoad"/>
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.next}}" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickOnNextButton"/>
<!-- Place order and Assert success message -->
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/>
<!-- Assert empty Mini Cart -->
<seeElement selector="{{StorefrontMiniCartSection.emptyMiniCart}}" stepKey="assertEmptyCart" />
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="orderId"/>
<!-- Open Order Index Page -->
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/>
<waitForPageLoad stepKey="waitForPageLoad5"/>
<!-- Filter Order using orderId and assert order-->
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById">
<argument name="orderId" value="$orderId"/>
</actionGroup>
<click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/>
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
<!-- Assert Grand Total -->
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$28.00" stepKey="seeGrandTotal"/>
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderStatus"/>
<!-- Ship the order and assert the status -->
<actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/>
<!-- Assert order buttons -->
<actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/>
</test>
</tests>