Skip to content

Commit 7beddfe

Browse files
committed
MAGETWO-90303: Extend MFTF tests to check Checkout Success page
1 parent aa6b899 commit 7beddfe

File tree

9 files changed

+247
-18
lines changed

9 files changed

+247
-18
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,6 @@
123123
<data key="status">1</data>
124124
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
125125
</entity>
126-
<entity name="VirtualProduct" type="product">
127-
<data key="sku" unique="suffix">virtualproduct</data>
128-
<data key="type_id">virtual</data>
129-
<data key="attribute_set_id">4</data>
130-
<data key="name" unique="suffix">VirtualProduct</data>
131-
<data key="price">99.99</data>
132-
<data key="quantity">250</data>
133-
<data key="weight">0</data>
134-
<data key="status">1</data>
135-
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
136-
</entity>
137126
<entity name="SimpleProductWithNewFromDate" type="product">
138127
<data key="sku" unique="suffix">SimpleProduct</data>
139128
<data key="type_id">simple</data>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillingShippingSectionActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
2929
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
3030
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
31+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
3132
</actionGroup>
3233
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Page/CheckoutSuccessPage.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="CheckoutSuccessPage" url="/checkout/onepage/success/" area="storefront" module="Checkout">
11+
<page name="CheckoutSuccessPage" url="/checkout/onepage/success/" area="storefront" module="Magento_Checkout">
1212
<section name="CheckoutSuccessMainSection"/>
13+
<section name="CheckoutSuccessRegisterSection"/>
1314
</page>
1415
</pages>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutSuccessMainSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="CheckoutSuccessMainSection">
12+
<element name="successTitle" type="text" selector=".page-title"/>
1213
<element name="success" type="text" selector="div.checkout-success"/>
1314
<element name="orderNumber" type="text" selector="div.checkout-success > p:nth-child(1) > span"/>
1415
<element name="orderNumberLink" type="text" selector="div.checkout-success > p:nth-child(1) > a"/>
1516
<element name="orderNumber22" type="text" selector=".order-number>strong"/>
1617
<element name="orderLink" type="text" selector="a[href*=order_id].order-number"/>
18+
<element name="orderNumberText" type="text" selector=".checkout-success > p:nth-child(1)"/>
19+
<element name="continueShoppingButton" type="button" selector=".action.primary.continue"/>
20+
<element name="printLink" type="button" selector=".print"/>
1721
</section>
1822
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="CheckoutSuccessRegisterSection">
12+
<element name="registerMessage" type="text" selector="#registration p:nth-child(1)"/>
13+
<element name="customerEmail" type="text" selector="#registration p:nth-child(2)"/>
14+
<element name="createAccountButton" type="button" selector="#registration form input[type='submit']"/>
15+
</section>
16+
</sections>
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="CheckCheckoutSuccessPageAsRegisterCustomer">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Success page elements are presented for placed order as Customer"/>
15+
<title value="Customer Checkout"/>
16+
<description value="To be sure that other elements of Success page are shown for placed order as registered Customer."/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-77616"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="SimpleOne" stepKey="createSimpleProduct"/>
24+
<createData entity="Simple_US_Customer" stepKey="createSimpleUsCustomer">
25+
<field key="group_id">1</field>
26+
</createData>
27+
</before>
28+
29+
<after>
30+
<!--Logout from customer account-->
31+
<amOnPage url="customer/account/logout/" stepKey="logoutCustomerOne"/>
32+
<waitForPageLoad stepKey="waitLogoutCustomerOne"/>
33+
<actionGroup ref="logout" stepKey="logoutAdminUserAfterTest"/>
34+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
35+
<deleteData createDataKey="createSimpleUsCustomer" stepKey="deleteCustomer"/>
36+
</after>
37+
38+
<!--Log in to Storefront as Customer-->
39+
<actionGroup ref="CustomerLoginOnStorefront" stepKey="signUpNewUser">
40+
<argument name="customer" value="$$createSimpleUsCustomer$$"/>
41+
</actionGroup>
42+
43+
<!--Go to product page-->
44+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
45+
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
46+
47+
<!--Add Product to Shopping Cart-->
48+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
49+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
50+
</actionGroup>
51+
52+
<!--Go to Checkout-->
53+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
54+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
55+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/>
56+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
57+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
58+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest3"/>
59+
60+
<!--Click Place Order button-->
61+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear2"/>
62+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
63+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
64+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
65+
<see selector="{{CheckoutSuccessMainSection.success}}" userInput="We'll email you an order confirmation with details and tracking info." stepKey="seeSuccessNotify"/>
66+
67+
<click selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="clickOrderLink"/>
68+
<waitForPageLoad stepKey="waitPageOrder"/>
69+
<seeInCurrentUrl url="{{OrderDetailsPage.url}}" stepKey="seeMyOrderPage"/>
70+
71+
<!--Go to product page-->
72+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage2"/>
73+
<waitForPageLoad stepKey="waitForCatalogPageLoad2"/>
74+
75+
<!--Add Product to Shopping Cart-->
76+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2">
77+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
78+
</actionGroup>
79+
80+
<!--Go to Checkout-->
81+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart2"/>
82+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod2"/>
83+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/>
84+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton2"/>
85+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext2"/>
86+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest4"/>
87+
88+
<!--Click Place Order button-->
89+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
90+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder2"/>
91+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle2"/>
92+
<click selector="{{CheckoutSuccessMainSection.continueShoppingButton}}" stepKey="clickContinueShoppingButton"/>
93+
<waitForPageLoad stepKey="waitHomePage"/>
94+
<see userInput="Home Page" selector="{{StorefrontHeaderSection.mainTitle}}" stepKey="seeHomePageTitle"/>
95+
<seeCurrentUrlEquals url="{{_ENV.MAGENTO_BASE_URL}}" stepKey="seeHomePageUrl"/>
96+
97+
<!--Go to product page-->
98+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage3"/>
99+
<waitForPageLoad stepKey="waitForCatalogPageLoad3"/>
100+
101+
<!--Add Product to Shopping Cart-->
102+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage3">
103+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
104+
</actionGroup>
105+
106+
<!--Go to Checkout-->
107+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart3"/>
108+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod3"/>
109+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
110+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton3"/>
111+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext3"/>
112+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest5"/>
113+
114+
<!--Click Place Order button-->
115+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear3"/>
116+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder3"/>
117+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle3"/>
118+
119+
<!--Check "Print Receipt" button is presented (desktop only)-->
120+
<seeElement selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="seeVisiblePrint"/>
121+
<resizeWindow width="600" height="800" stepKey="resizeWindow"/>
122+
<waitForElementNotVisible selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="waitInvisiblePrint"/>
123+
<dontSeeElement selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="seeInvisiblePrint"/>
124+
<resizeWindow width="1360" height="1020" stepKey="maximizeWindowKey1"/>
125+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="waitVisiblePrint"/>
126+
<seeElement selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="seeVisiblePrint2" />
127+
128+
<!--See print page-->
129+
<click selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="clickPrintLink"/>
130+
<waitForPageLoad stepKey="waitPrintPage"/>
131+
<switchToWindow stepKey="switchToWindow"/>
132+
<switchToNextTab stepKey="switchToTab"/>
133+
<seeInCurrentUrl url="sales/order/print/order_id" stepKey="seePrintPage"/>
134+
<seeElement selector="{{StorefrontCustomerOrderViewSection.orderTitle}}" stepKey="seeOrderTitleOnPrint"/>
135+
<switchToWindow stepKey="switchToWindow2"/>
136+
</test>
137+
<test name="CheckCheckoutSuccessPageAsGuest">
138+
<annotations>
139+
<features value="Checkout"/>
140+
<stories value="Success page elements are presented for placed order as Guest"/>
141+
<title value="Customer Checkout"/>
142+
<description value="To be sure that other elements of Success page are presented for placed order as Guest."/>
143+
<severity value="CRITICAL"/>
144+
<testCaseId value="MAGETWO-77614"/>
145+
<group value="checkout"/>
146+
</annotations>
147+
148+
<before>
149+
<createData entity="SimpleOne" stepKey="createSimpleProduct"/>
150+
</before>
151+
152+
<after>
153+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
154+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
155+
</after>
156+
157+
<!--Go to product page-->
158+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
159+
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
160+
161+
<!--Add Product to Shopping Cart-->
162+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
163+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
164+
</actionGroup>
165+
166+
<!--Go to Checkout-->
167+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
168+
169+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
170+
<argument name="customerVar" value="CustomerEntityOne" />
171+
<argument name="customerAddressVar" value="CustomerAddressSimple" />
172+
</actionGroup>
173+
174+
<!--Click Place Order button-->
175+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
176+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/>
177+
178+
<!--See success messages-->
179+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
180+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order # is: " stepKey="seeOrderNumber"/>
181+
182+
<!--Check register section-->
183+
<see selector="{{CheckoutSuccessMainSection.success}}" userInput="We'll email you an order confirmation with details and tracking info." stepKey="seeSuccessNotify"/>
184+
<see selector="{{CheckoutSuccessRegisterSection.registerMessage}}" userInput="You can track your order status by creating an account." stepKey="seeRegisterMessage"/>
185+
<see selector="{{CheckoutSuccessRegisterSection.customerEmail}}" userInput="Email Address: {{CustomerEntityOne.email}}" stepKey="seeCustomerEmail"/>
186+
<seeElement selector="{{CheckoutSuccessRegisterSection.createAccountButton}}" stepKey="seeVisibleCreateAccountButton"/>
187+
<click selector="{{CheckoutSuccessRegisterSection.createAccountButton}}" stepKey="clickCreateAccountButton"/>
188+
<waitForPageLoad stepKey="waitAccountPage"/>
189+
<seeInCurrentUrl url="{{StorefrontCustomerCreatePage.url}}" stepKey="seeHomePageUrl"/>
190+
<see userInput="Create New Customer Account" selector="{{StorefrontHeaderSection.mainTitle}}" stepKey="seeHomePageTitle"/>
191+
192+
<!--Go to product page-->
193+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage2"/>
194+
<waitForPageLoad stepKey="waitForCatalogPageLoad2"/>
195+
196+
<!--Add Product to Shopping Cart-->
197+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2">
198+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
199+
</actionGroup>
200+
201+
<!--Go to Checkout-->
202+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart2"/>
203+
204+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection2">
205+
<argument name="customerVar" value="CustomerEntityOne" />
206+
<argument name="customerAddressVar" value="CustomerAddressSimple" />
207+
</actionGroup>
208+
209+
<!--Click Place Order button-->
210+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder2"/>
211+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle2"/>
212+
<click selector="{{CheckoutSuccessMainSection.continueShoppingButton}}" stepKey="clickContinueShoppingButton2"/>
213+
<waitForPageLoad stepKey="waitHomePage2"/>
214+
<seeCurrentUrlEquals url="{{_ENV.MAGENTO_BASE_URL}}" stepKey="seeHomePageUrl2"/>
215+
<see userInput="Home Page" selector="{{StorefrontHeaderSection.mainTitle}}" stepKey="seeHomePageTitle2"/>
216+
</test>
217+
</tests>

app/code/Magento/Sales/Test/Mftf/Page/AdminOrderDetailsPage.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1111
<page name="AdminOrderDetailsPage" url="sales/order/view/order_id/" area="admin" module="Magento_Sales">
1212
<section name="AdminOrderFormTotalSection"/>
13+
<section name="OrderDetailsMainActionsSection"/>
14+
<section name="OrderDetailsInformationSection"/>
15+
<section name="OrderDetailsMessagesSection"/>
16+
<section name="AdminOrderItemsOrderedSection"/>
17+
<section name="AdminOrderTotalSection" />
1318
</page>
1419
</pages>

app/code/Magento/Sales/Test/Mftf/Page/OrderDetailsPage.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="OrderDetailsPage" url="/sales/order/view/order_id/" area="admin" module="Magento_Sales">
12-
<section name="OrderDetailsMainActionsSection"/>
13-
<section name="OrderDetailsInformationSection"/>
14-
<section name="OrderDetailsMessagesSection"/>
15-
<section name="AdminOrderItemsOrderedSection"/>
16-
<section name="AdminOrderTotalSection" />
11+
<page name="OrderDetailsPage" url="/sales/order/view/order_id/" area="storefront" module="Magento_Sales">
1712
</page>
1813
</pages>

app/code/Magento/Store/Test/Mftf/Section/StorefrontHeaderSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<element name="storeViewSwitcher" type="button" selector="#switcher-language-trigger"/>
1212
<element name="storeViewDropdown" type="button" selector="ul.switcher-dropdown"/>
1313
<element name="storeViewOption" type="button" selector="li.view-{{var1}}>a" parameterized="true"/>
14+
<element name="mainTitle" type="text" selector="#maincontent .page-title"/>
1415
</section>
1516
</sections>

0 commit comments

Comments
 (0)