Skip to content

Commit ac05cbb

Browse files
committed
MAGETWO-96850: [2.3.x] One page Checkout resets Customer data if Product Qty was changed
- Add automated test script
1 parent ff5436f commit ac05cbb

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
<element name="nthBundleOptionName" type="text" selector=".product-item-details .item-options:nth-of-type({{numOption}}) dt" parameterized="true"/>
3232
<element name="productSubtotalByName" type="input" selector="//main//table[@id='shopping-cart-table']//tbody//tr[..//strong[contains(@class, 'product-item-name')]//a/text()='{{var1}}'][1]//td[contains(@class, 'subtotal')]//span[@class='price']" parameterized="true"/>
3333
<element name="updateShoppingCartButton" type="button" selector="#form-validate button[type='submit'].update" timeout="30"/>
34+
<element name="qty" type="input" selector="//input[@data-cart-item-id='{{var}}'][@title='Qty']" parameterized="true"/>
3435
</section>
3536
</sections>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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="StorefrontOnePageCheckoutDataWhenChangeQtyTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<title value="One page Checkout Customer data when changing Product Qty"/>
15+
<description value="One page Checkout Customer data when changing Product Qty"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-96960"/>
18+
<useCaseId value="MAGETWO-96850"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!--Create a product-->
23+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
24+
</before>
25+
<after>
26+
<!--Delete created data-->
27+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
28+
</after>
29+
30+
<!--Add product to cart and checkout-->
31+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="amOnSimpleProductPage"/>
32+
<waitForPageLoad stepKey="waitForPageLoad"/>
33+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
34+
<argument name="productName" value="$createProduct.name$$"/>
35+
</actionGroup>
36+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
37+
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
38+
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
39+
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
40+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
41+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/>
42+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/>
43+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/>
44+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/>
45+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
46+
47+
<!--Grab customer data to check it-->
48+
<grabValueFrom selector="{{CheckoutShippingSection.email}}" stepKey="grabEmail"/>
49+
<grabValueFrom selector="{{CheckoutShippingSection.firstName}}" stepKey="grabFirstName"/>
50+
<grabValueFrom selector="{{CheckoutShippingSection.lastName}}" stepKey="grabLastName"/>
51+
<grabValueFrom selector="{{CheckoutShippingSection.street}}" stepKey="grabStreet"/>
52+
<grabValueFrom selector="{{CheckoutShippingSection.city}}" stepKey="grabCity"/>
53+
<grabTextFrom selector="{{CheckoutShippingSection.region}}" stepKey="grabRegion"/>
54+
<grabValueFrom selector="{{CheckoutShippingSection.postcode}}" stepKey="grabPostcode"/>
55+
<grabValueFrom selector="{{CheckoutShippingSection.telephone}}" stepKey="grabTelephone"/>
56+
57+
<!--Select shipping method and finalize checkout-->
58+
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
59+
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
60+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
61+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
62+
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
63+
64+
<!--Go to cart page, update qty and proceed to checkout-->
65+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
66+
<waitForPageLoad stepKey="waitForCartPageLoad"/>
67+
<see userInput="Shopping Cart" stepKey="seeCartPageIsOpened"/>
68+
<fillField selector="{{CheckoutCartProductSection.qty($$createProduct.name$$)}}" userInput="2" stepKey="updateProductQty"/>
69+
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickUpdateShoppingCart"/>
70+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
71+
<grabValueFrom selector="{{CheckoutCartProductSection.qty($$createProduct.name$$)}}" stepKey="grabQty"/>
72+
<assertEquals expected="2" actual="$grabQty" stepKey="assertQty"/>
73+
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/>
74+
75+
<!--Check that form is filled with customer data-->
76+
<grabValueFrom selector="{{CheckoutShippingSection.email}}" stepKey="grabEmail1"/>
77+
<grabValueFrom selector="{{CheckoutShippingSection.firstName}}" stepKey="grabFirstName1"/>
78+
<grabValueFrom selector="{{CheckoutShippingSection.lastName}}" stepKey="grabLastName1"/>
79+
<grabValueFrom selector="{{CheckoutShippingSection.street}}" stepKey="grabStreet1"/>
80+
<grabValueFrom selector="{{CheckoutShippingSection.city}}" stepKey="grabCity1"/>
81+
<grabTextFrom selector="{{CheckoutShippingSection.region}}" stepKey="grabRegion1"/>
82+
<grabValueFrom selector="{{CheckoutShippingSection.postcode}}" stepKey="grabPostcode1"/>
83+
<grabValueFrom selector="{{CheckoutShippingSection.telephone}}" stepKey="grabTelephone1"/>
84+
85+
<assertEquals expected="$grabEmail" actual="$grabEmail1" stepKey="assertEmail"/>
86+
<assertEquals expected="$grabFirstName" actual="$grabFirstName1" stepKey="assertFirstName"/>
87+
<assertEquals expected="$grabLastName" actual="$grabLastName1" stepKey="assertLastName"/>
88+
<assertEquals expected="$grabStreet" actual="$grabStreet1" stepKey="assertStreet"/>
89+
<assertEquals expected="$grabCity" actual="$grabCity1" stepKey="assertCity"/>
90+
<assertEquals expected="$grabRegion" actual="$grabRegion1" stepKey="assertRegion"/>
91+
<assertEquals expected="$grabPostcode" actual="$grabPostcode1" stepKey="assertPostcode"/>
92+
<assertEquals expected="$grabTelephone" actual="$grabTelephone1" stepKey="assertTelephone"/>
93+
</test>
94+
</tests>

0 commit comments

Comments
 (0)