Skip to content

Commit 098ca6c

Browse files
committed
MC-4534: Convert UpdateCustomerFrontendEntityTest to MFTF
1 parent 47d89b7 commit 098ca6c

9 files changed

+323
-9
lines changed

app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,23 @@
2424
<click stepKey="clickOnOk" selector="{{CustomersPageSection.ok}}"/>
2525
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/>
2626
</actionGroup>
27-
</actionGroups>
27+
<actionGroup name="DeleteCustomerByEmailActionGroup">
28+
<arguments>
29+
<argument name="email" type="string"/>
30+
</arguments>
31+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
32+
<waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/>
33+
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/>
34+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
35+
<waitForPageLoad stepKey="waitForClearFilters"/>
36+
<fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{email}}" stepKey="filterEmail"/>
37+
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>
38+
<waitForPageLoad stepKey="waitForPageToLoad"/>
39+
<click selector="{{AdminCustomerGridSection.selectFirstRow}}" stepKey="clickOnEditButton1"/>
40+
<click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/>
41+
<click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/>
42+
<waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/>
43+
<click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/>
44+
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/>
45+
</actionGroup>
46+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,86 @@
3939
<fillField stepKey="fillStreetAddress1" selector="{{StorefrontCustomerAddressSection.streetAddress1}}" userInput="{{Address.street[0]}}"/>
4040
<fillField stepKey="fillStreetAddress2" selector="{{StorefrontCustomerAddressSection.streetAddress2}}" userInput="{{Address.street[1]}}"/>
4141
<fillField stepKey="fillCityName" selector="{{StorefrontCustomerAddressSection.city}}" userInput="{{Address.city}}"/>
42+
<selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/>
4243
<selectOption stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvince}}" userInput="{{Address.state}}"/>
4344
<fillField stepKey="fillZip" selector="{{StorefrontCustomerAddressSection.zip}}" userInput="{{Address.postcode}}"/>
44-
<selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/>
45-
4645
<click stepKey="saveAddress" selector="{{StorefrontCustomerAddressSection.saveAddress}}"/>
4746
</actionGroup>
47+
<actionGroup name="VerifyCustomerBillingAddress">
48+
<arguments>
49+
<argument name="address"/>
50+
</arguments>
51+
<amOnPage url="customer/address/index/" stepKey="goToAddressPage"/>
52+
<waitForPageLoad stepKey="waitForAddressPageLoad"/>
53+
<!--Verify customer default billing address-->
54+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/>
55+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/>
56+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/>
57+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/>
58+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/>
59+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/>
60+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/>
61+
</actionGroup>
62+
<actionGroup name="VerifyCustomerShippingAddress">
63+
<arguments>
64+
<argument name="address"/>
65+
</arguments>
66+
<amOnPage url="customer/address/index/" stepKey="goToAddressPage"/>
67+
<waitForPageLoad stepKey="waitForAddressPageLoad"/>
68+
<!--Verify customer default shipping address-->
69+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/>
70+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/>
71+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/>
72+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/>
73+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/>
74+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/>
75+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/>
76+
</actionGroup>
77+
<actionGroup name="VerifyCustomerBillingAddressWithState">
78+
<arguments>
79+
<argument name="address"/>
80+
</arguments>
81+
<amOnPage url="customer/address/index/" stepKey="goToAddressPage"/>
82+
<waitForPageLoad stepKey="waitForAddressPageLoad"/>
83+
<!--Verify customer default billing address-->
84+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/>
85+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/>
86+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/>
87+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/>
88+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/>
89+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/>
90+
<see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/>
91+
</actionGroup>
92+
<actionGroup name="VerifyCustomerShippingAddressWithState">
93+
<arguments>
94+
<argument name="address"/>
95+
</arguments>
96+
<amOnPage url="customer/address/index/" stepKey="goToAddressPage"/>
97+
<waitForPageLoad stepKey="waitForAddressPageLoad"/>
98+
<!--Verify customer default shipping address-->
99+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/>
100+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/>
101+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/>
102+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/>
103+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/>
104+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/>
105+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/>
106+
</actionGroup>
107+
<actionGroup name="VerifyCustomerNameOnFrontend">
108+
<arguments>
109+
<argument name="customer"/>
110+
</arguments>
111+
<!--Verify customer name on frontend-->
112+
<amOnPage url="customer/account/edit/" stepKey="goToAddressPage"/>
113+
<waitForPageLoad stepKey="waitForAddressPageLoad"/>
114+
<click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Account Information')}}" stepKey="clickAccountInformationFromSidebarCurrentTab"/>
115+
<waitForPageLoad stepKey="waitForAccountInformationTabToOpen"/>
116+
<seeInField selector="{{StorefrontCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="seeAssertCustomerFirstName"/>
117+
<seeInField selector="{{StorefrontCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="seeAssertCustomerLastName"/>
118+
</actionGroup>
48119

49120
<actionGroup name="SignUpNewCustomerStorefrontActionGroup" extends="SignUpNewUserFromStorefrontActionGroup">
50121
<waitForPageLoad stepKey="waitForRegistered" after="clickCreateAccountButton"/>
51-
<remove keyForRemoval="seeThankYouMessage" after="waitForRegistered"/>
122+
<remove keyForRemoval="seeThankYouMessage"/>
52123
</actionGroup>
53124
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,50 @@
191191
<data key="default_billing">true</data>
192192
<data key="default_shipping">false</data>
193193
</entity>
194-
</entities>
194+
<entity name="updateCustomerUKAddress" type="address">
195+
<data key="firstname">John</data>
196+
<data key="lastname">Doe</data>
197+
<data key="company">Magento</data>
198+
<data key="telephone">0123456789-02134567</data>
199+
<array key="street">
200+
<item>172, Westminster Bridge Rd</item>
201+
<item>7700 xyz street</item>
202+
</array>
203+
<data key="country_id">GB</data>
204+
<data key="country">United Kingdom</data>
205+
<data key="city">London</data>
206+
<!-- State not required for UK address on frontend-->
207+
<data key="state"> </data>
208+
<data key="postcode">12345</data>
209+
</entity>
210+
<entity name="updateCustomerFranceAddress" type="address">
211+
<data key="firstname">Jaen</data>
212+
<data key="lastname">Reno</data>
213+
<data key="company">Magento</data>
214+
<data key="telephone">555-888-111-999</data>
215+
<array key="street">
216+
<item>18-20 Rue Maréchal Lecler</item>
217+
<item>18-20 Rue Maréchal Lecler</item>
218+
</array>
219+
<data key="country_id">FR</data>
220+
<data key="country">France</data>
221+
<data key="city">Quintin</data>
222+
<data key="state">Côtes-d'Armor</data>
223+
<data key="postcode">12345</data>
224+
</entity>
225+
<entity name="updateCustomerNoXSSInjection" type="address">
226+
<data key="firstname">Jany</data>
227+
<data key="lastname">Doe</data>
228+
<data key="company">Magento</data>
229+
<data key="telephone">555-888-111-999</data>
230+
<array key="street">
231+
<item>7700 West Parmer Lane</item>
232+
<item>7700 West Parmer Lane</item>
233+
</array>
234+
<data key="country_id">US</data>
235+
<data key="country">United States</data>
236+
<data key="city">Denver</data>
237+
<data key="state">Colorado</data>
238+
<data key="postcode">12345</data>
239+
</entity>
240+
</entities>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,15 @@
178178
<requiredEntity type="address">US_Default_Billing_Address_TX</requiredEntity>
179179
<requiredEntity type="address">US_Default_Shipping_Address_CA</requiredEntity>
180180
</entity>
181-
</entities>
181+
<entity name="Colorado_US_Customer" type="customer">
182+
<data key="group_id">1</data>
183+
<data key="default_billing">true</data>
184+
<data key="default_shipping">true</data>
185+
<data key="email" unique="prefix">[email protected]</data>
186+
<data key="firstname">Patrick&lt;/title&gt;&lt;/head&gt;&lt;svg/onload=alert(&#39;XSS&#39;)&gt;</data>
187+
<data key="lastname">&lt;script&gt;alert(&#39;Last name&#39;)&lt;/script&gt;</data>
188+
<data key="password">123123^q</data>
189+
<data key="store_id">0</data>
190+
<data key="website_id">0</data>
191+
</entity>
192+
</entities>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerGridSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="AdminCustomerGridSection">
1212
<element name="customerGrid" type="text" selector="table[data-role='grid']"/>
1313
<element name="firstRowEditLink" type="text" selector="tr[data-repeat-index='0'] .action-menu-item" timeout="30"/>
14+
<element name="selectFirstRow" type="checkbox" selector="//td[@class='data-grid-checkbox-cell']"/>
1415
</section>
15-
</sections>
16+
</sections>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSidebarSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontCustomerSidebarSection">
1212
<element name="sidebarTab" type="text" selector="//div[@id='block-collapsible-nav']//a[text()='{{var1}}']" parameterized="true"/>
13-
<element name="sidebarCurrentTab" type="text" selector="//div[@id='block-collapsible-nav']//strong[contains(text(), '{{var}}')]" parameterized="true"/>
13+
<element name="sidebarCurrentTab" type="text" selector="//div[@id='block-collapsible-nav']//*[contains(text(), '{{var}}')]" parameterized="true"/>
1414
</section>
15-
</sections>
15+
</sections>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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="StorefrontUpdateCustomerAddressFranceTest">
12+
<annotations>
13+
<stories value="Update Customer Address"/>
14+
<title value="Update Customer Address (France) in Storefront"/>
15+
<description value="Test log in to Storefront and Update Customer Address (France) in Storefront"/>
16+
<testCaseId value="MC-10912"/>
17+
<severity value="CRITICAL"/>
18+
<group value="customer"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser">
25+
<argument name="Customer" value="CustomerEntityOne"/>
26+
</actionGroup>
27+
</before>
28+
<after>
29+
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser">
30+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
31+
</actionGroup>
32+
<actionGroup ref="logout" stepKey="logout"/>
33+
</after>
34+
35+
<!--Update customer address France in storefront-->
36+
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress">
37+
<argument name="Address" value="updateCustomerFranceAddress"/>
38+
</actionGroup>
39+
<!--Verify customer address save success message-->
40+
<see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/>
41+
42+
<!--Verify customer default billing address-->
43+
<actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress">
44+
<argument name="address" value="updateCustomerFranceAddress"/>
45+
</actionGroup>
46+
47+
<!--Verify customer default shipping address-->
48+
<actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress">
49+
<argument name="address" value="updateCustomerFranceAddress"/>
50+
</actionGroup>
51+
</test>
52+
</tests>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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="StorefrontUpdateCustomerAddressUKTest">
12+
<annotations>
13+
<stories value="Update Customer Address"/>
14+
<title value="Update Customer Address (UK) in Storefront"/>
15+
<description value="Test log in to Storefront and Update Customer Address (UK) in Storefront"/>
16+
<testCaseId value="MC-10911"/>
17+
<severity value="CRITICAL"/>
18+
<group value="customer"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser">
25+
<argument name="Customer" value="CustomerEntityOne"/>
26+
</actionGroup>
27+
</before>
28+
<after>
29+
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser">
30+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
31+
</actionGroup>
32+
<actionGroup ref="logout" stepKey="logout"/>
33+
</after>
34+
35+
<!--Update customer address UK in storefront-->
36+
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress">
37+
<argument name="Address" value="updateCustomerUKAddress"/>
38+
</actionGroup>
39+
<!--Verify customer address save success message-->
40+
<see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/>
41+
42+
<!--Verify customer default billing address-->
43+
<actionGroup ref="VerifyCustomerBillingAddress" stepKey="verifyBillingAddress">
44+
<argument name="address" value="updateCustomerUKAddress"/>
45+
</actionGroup>
46+
47+
<!--Verify customer default shipping address-->
48+
<actionGroup ref="VerifyCustomerShippingAddress" stepKey="verifyShippingAddress">
49+
<argument name="address" value="updateCustomerUKAddress"/>
50+
</actionGroup>
51+
52+
<!--Verify customer name on frontend-->
53+
<actionGroup ref="VerifyCustomerNameOnFrontend" stepKey="verifyVerifyCustomerName">
54+
<argument name="customer" value="CustomerEntityOne"/>
55+
</actionGroup>
56+
</test>
57+
</tests>

0 commit comments

Comments
 (0)