Skip to content

Commit fbb5eac

Browse files
committed
Convert EditShippingAddressOnePageCheckoutTest to MFTF
1 parent 10f900e commit fbb5eac

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,4 +729,21 @@
729729
<data key="attributeGroupId">13</data>
730730
<data key="sortOrder">0</data>
731731
</entity>
732+
<entity name="simpleProductDefault" type="product">
733+
<data key="sku" unique="suffix">sku_simple_product_</data>
734+
<data key="type_id">simple</data>
735+
<data key="attribute_set_id">4</data>
736+
<data key="visibility">4</data>
737+
<data key="name" unique="suffix">Simple Product </data>
738+
<data key="price">560</data>
739+
<data key="urlKey" unique="suffix">simple-product-</data>
740+
<data key="status">1</data>
741+
<data key="quantity">25</data>
742+
<data key="weight">1</data>
743+
<data key="product_has_weight">1</data>
744+
<data key="is_in_stock">1</data>
745+
<data key="tax_class_id">2</data>
746+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
747+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
748+
</entity>
732749
</entities>

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,27 @@
2020
<fillField stepKey="fillPostCode" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{address.postcode}}"/>
2121
<waitForPageLoad stepKey="waitForFormUpdate"/>
2222
</actionGroup>
23+
<actionGroup name="FillShippingAddressOneStreetActionGroup">
24+
<arguments>
25+
<argument name="Address"/>
26+
</arguments>
27+
<fillField stepKey="fillFirstName" selector="{{CheckoutShippingSection.firstName}}" userInput="{{Address.firstname}}"/>
28+
<fillField stepKey="fillLastName" selector="{{CheckoutShippingSection.lastName}}" userInput="{{Address.lastname}}"/>
29+
<fillField stepKey="fillCompany" selector="{{CheckoutShippingSection.company}}" userInput="{{Address.company}}"/>
30+
<fillField stepKey="fillPhoneNumber" selector="{{CheckoutShippingSection.telephone}}" userInput="{{Address.telephone}}"/>
31+
<fillField stepKey="fillStreetAddress" selector="{{CheckoutShippingSection.street}}" userInput="{{Address.street[0]}}"/>
32+
<fillField stepKey="fillCityName" selector="{{CheckoutShippingSection.city}}" userInput="{{Address.city}}"/>
33+
<selectOption stepKey="selectCounty" selector="{{CheckoutShippingSection.country}}" userInput="{{Address.country_id}}"/>
34+
<fillField stepKey="fillZip" selector="{{CheckoutShippingSection.postcode}}" userInput="{{Address.postcode}}"/>
35+
</actionGroup>
36+
<actionGroup name="clearShippingAddressActionGroup">
37+
<clearField selector="{{CheckoutShippingSection.firstName}}" stepKey="clearFieldFirstName"/>
38+
<clearField selector="{{CheckoutShippingSection.company}}" stepKey="clearFieldCompany"/>
39+
<clearField selector="{{CheckoutShippingSection.street}}" stepKey="clearFieldStreetAddress"/>
40+
<clearField selector="{{CheckoutShippingSection.city}}" stepKey="clearFieldCityName"/>
41+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="" stepKey="clearFieldRegion"/>
42+
<clearField selector="{{CheckoutShippingSection.postcode}}" stepKey="clearFieldZip"/>
43+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="" stepKey="clearFieldCounty"/>
44+
<clearField selector="{{CheckoutShippingSection.telephone}}" stepKey="clearFieldPhoneNumber"/>
45+
</actionGroup>
2346
</actionGroups>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,14 @@
112112
<fillField stepKey="fillZip" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{taxCode.zip}}"/>
113113
<waitForPageLoad stepKey="waitForFormUpdate"/>
114114
</actionGroup>
115+
<!-- Add Product to Cart from the category page and check message -->
116+
<actionGroup name="StorefrontAddCategorySimpleProductToCartActionGroup">
117+
<arguments>
118+
<argument name="product"/>
119+
</arguments>
120+
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct" />
121+
<click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart" />
122+
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage" />
123+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/>
124+
</actionGroup>
115125
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<element name="country" type="select" selector="select[name=country_id]"/>
2828
<element name="telephone" type="input" selector="input[name=telephone]"/>
2929
<element name="saveAddress" type="button" selector=".action-save-address"/>
30+
<element name="cancelChangeAddress" type="button" selector=".action-hide-popup"/>
3031
<element name="updateAddress" type="button" selector=".action-update"/>
3132
<element name="next" type="button" selector="button.button.action.continue.primary" timeout="30"/>
3233
<element name="firstShippingMethod" type="radio" selector="//*[@id='checkout-shipping-method-load']//input[@class='radio']"/>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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="EditShippingAddressOnePageCheckoutTestVariation1">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Edit Shipping Address"/>
15+
<title value="Edit Shipping Address on Checkout Page."/>
16+
<description value="Edit Shipping Address on Checkout Page."/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-67837"/>
19+
<group value="shoppingCart"/>
20+
<group value="mtf_migrated"/>
21+
</annotations>
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
<createData entity="simpleProductDefault" stepKey="createProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
<createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
33+
</after>
34+
35+
<!-- Go to Frontend as Customer -->
36+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
37+
<argument name="Customer" value="$$createCustomer$$" />
38+
</actionGroup>
39+
40+
<!-- Add product to cart -->
41+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
42+
<actionGroup ref="StorefrontAddCategorySimpleProductToCartActionGroup" stepKey="addProductToCart">
43+
<argument name="product" value="$$createProduct$$"/>
44+
</actionGroup>
45+
46+
<!-- Go to checkout page -->
47+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="customerGoToCheckoutFromMinicart" />
48+
49+
<!-- *New Address* button on 1st checkout step -->
50+
<click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="addNewAddress"/>
51+
52+
<!--Fill in required fields and click *Save address* button-->
53+
<actionGroup ref="FillShippingAddressOneStreetActionGroup" stepKey="changeAddress">
54+
<argument name="Address" value="UK_Not_Default_Address"/>
55+
</actionGroup>
56+
<click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="saveNewAddress"/>
57+
58+
<!--Select Shipping Rate-->
59+
<scrollTo selector="{{CheckoutShippingMethodsSection.next}}" stepKey="scrollToShippingRate"/>
60+
<click selector="{{CheckoutShippingMethodsSection.shippingMethodFlatRate}}" stepKey="selectShippingMethod"/>
61+
62+
<!-- Click *Edit* button for the new address -->
63+
<click selector="{{CheckoutShippingSection.editActiveAddress}}" stepKey="editNewAddress"/>
64+
65+
<!--Remove values from required fields and click *Cancel* button -->
66+
<actionGroup ref="clearShippingAddressActionGroup" stepKey="clearRequiredFields"/>
67+
<click selector="{{CheckoutShippingSection.cancelChangeAddress}}" stepKey="cancelEditAddress"/>
68+
69+
<!-- Go to *Next* -->
70+
<scrollTo selector="{{CheckoutShippingMethodsSection.next}}" stepKey="scrollToButtonNext"/>
71+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="goNext"/>
72+
73+
<!-- Select payment solution -->
74+
<checkOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="selectPaymentSolution" />
75+
76+
<!--Refresh Page and Place Order-->
77+
<reloadPage stepKey="reloadPage"/>
78+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
79+
</test>
80+
</tests>

dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/EditShippingAddressOnePageCheckoutTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Checkout\Test\TestCase\EditShippingAddressOnePageCheckoutTest" summary="Customer can place order with new addresses that was edited during checkout with several conditions" ticketId="MAGETWO-67837">
1010
<variation name="EditShippingAddressOnePageCheckoutTestVariation1">
11+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
1112
<data name="tag" xsi:type="string">severity:S1</data>
1213
<data name="customer/dataset" xsi:type="string">johndoe_with_addresses</data>
1314
<data name="shippingAddress/dataset" xsi:type="string">UK_address_without_email</data>

0 commit comments

Comments
 (0)