Skip to content

Commit 32c9948

Browse files
AC-6748::Customer attribute and customer address attribute alway require when select 'Use Default' in config - fixed mftf
1 parent d917430 commit 32c9948

File tree

5 files changed

+75
-15
lines changed

5 files changed

+75
-15
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCustomerShowCompanyActionGroup">
12+
<annotations>
13+
<description>Goes to the customer configuration. Set "Show Company" with provided value.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string" defaultValue="{{ShowCompany.optional}}"/>
17+
</arguments>
18+
<amOnPage url="{{AdminCustomerConfigPage.url('#customer_address-link')}}" stepKey="openCustomerConfigPage"/>
19+
<waitForPageLoad stepKey="waitCustomerConfigPage"/>
20+
<scrollTo selector="{{AdminCustomerConfigSection.showCompany}}" x="0" y="-100" stepKey="scrollToShowCompany"/>
21+
<uncheckOption selector="{{AdminCustomerConfigSection.showCompanyInherit}}" stepKey="uncheckUseSystem"/>
22+
<selectOption selector="{{AdminCustomerConfigSection.showCompany}}" userInput="{{value}}" stepKey="fillShowCompany"/>
23+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
24+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
25+
</actionGroup>
26+
</actionGroups>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,24 @@
248248
<data key="default_shipping">true</data>
249249
<data key="default_billing">true</data>
250250
</entity>
251+
<entity name="addressNoCompany" type="address">
252+
<data key="company"/>
253+
<data key="firstname">Fn</data>
254+
<data key="lastname">Ln</data>
255+
<array key="street">
256+
<item>7700 West Parmer Lane</item>
257+
</array>
258+
<data key="city">Austin</data>
259+
<data key="state">Texas</data>
260+
<data key="country_id">US</data>
261+
<data key="country">United States</data>
262+
<data key="postcode">78729</data>
263+
<data key="telephone">512-345-6789</data>
264+
<data key="vat_id">47458714</data>
265+
<data key="default_billing">Yes</data>
266+
<data key="default_shipping">Yes</data>
267+
<requiredEntity type="region">RegionTX</requiredEntity>
268+
</entity>
251269
<entity name="updateCustomerUKAddress" type="address">
252270
<data key="firstname">John</data>
253271
<data key="lastname">Doe</data>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<data key="optional">Optional</data>
1919
<data key="required">Required</data>
2020
</entity>
21+
<entity name="ShowCompany">
22+
<data key="no">No</data>
23+
<data key="optional">Optional</data>
24+
<data key="required">Required</data>
25+
</entity>
2126
<entity name="CustomerConfigurationSectionNameAndAddressOptions">
2227
<data key="id">customer_address-head</data>
2328
<data key="title">Name and Address Options</data>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
<element name="showDateOfBirthInherit" type="select" selector="#customer_address_dob_show_inherit"/>
1616
<element name="showTelephone" type="select" selector="#customer_address_telephone_show"/>
1717
<element name="showTelephoneInherit" type="checkbox" selector="#customer_address_telephone_show_inherit"/>
18+
<element name="showCompany" type="select" selector="#customer_address_company_show"/>
19+
<element name="showCompanyInherit" type="select" selector="#customer_address_company_show_inherit"/>
1820
</section>
1921
</sections>

app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerAttributeChangeUpdateFromRequiredToNoDefaultScopeTest.xml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<!-- Set "Show Date of Birth" to Required and save in default config scope -->
3636
<actionGroup ref="AdminCheckUseSystemValueActionGroup" stepKey="checkUseSystemValue">
37-
<argument name="rowId" value="row_customer_address_dob_show"/>
37+
<argument name="rowId" value="row_customer_address_company_show"/>
3838
</actionGroup>
3939
<click selector="{{StoreConfigSection.Save}}" stepKey="saveConfig"/>
4040

@@ -50,19 +50,23 @@
5050
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionDefaultScope">
5151
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
5252
</actionGroup>
53-
<!-- Set "Show Date of Birth" to Required and save in default config scope -->
54-
<actionGroup ref="AdminCustomerShowDateOfBirthActionGroup" stepKey="setShowDateOfBirthRequiredDefaultScope">
55-
<argument name="value" value="{{ShowDateOfBirth.required}}"/>
53+
<!-- Set "Show Company" to Required and save in default config scope -->
54+
<actionGroup ref="AdminCustomerShowCompanyActionGroup" stepKey="setShowCompanyRequiredDefaultScope">
55+
<argument name="value" value="{{ShowCompany.required}}"/>
5656
</actionGroup>
5757

5858
<!-- Open the customer edit page -->
5959
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="goToCustomerEditPage">
6060
<argument name="customerId" value="$createCustomer.id$"/>
6161
</actionGroup>
62-
<!-- Switch the information tab -->
63-
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openInformationTab"/>
64-
<!-- Fill the dob -->
65-
<fillField userInput="{{CustomerEntityOne.dob}}" selector="{{AdminCustomerAccountInformationSection.dateOfBirth}}" stepKey="fillDateOfBirth"/>
62+
<!-- Switch the addresses tab -->
63+
<actionGroup ref="AdminOpenAddressesTabFromCustomerEditPageActionGroup" stepKey="openAddressesTab"/>
64+
<!-- Click "Add New Address" -->
65+
<actionGroup ref="AdminClickAddNewAddressButtonOnCustomerAddressesTabActionGroup" stepKey="clickAddNewAddressButton"/>
66+
<!-- Fill address -->
67+
<actionGroup ref="AdminFillAndSaveCustomerAddressInformationActionGroup" stepKey="fillAndSaveCustomerAddressInformationActionGroup">
68+
<argument name="address" value="US_Address_TX"/>
69+
</actionGroup>
6670
<!-- Assert that the address is successfully added -->
6771
<actionGroup stepKey="saveAndContinue" ref="AdminCustomerSaveAndContinue"/>
6872

@@ -72,19 +76,24 @@
7276
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionDefaultScopeAgain">
7377
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
7478
</actionGroup>
75-
<!-- Set "Show Date of Birth" to Required and save in default config scope -->
76-
<actionGroup ref="AdminCheckUseSystemValueActionGroup" stepKey="checkUseSystemValue">
77-
<argument name="rowId" value="row_customer_address_dob_show"/>
79+
<!-- Set "Show Company" to Required and save in default config scope -->
80+
<actionGroup ref="AdminCheckUseSystemValueActionGroup" stepKey="checkCompanyUseSystemValue">
81+
<argument name="rowId" value="row_customer_address_company_show"/>
7882
</actionGroup>
83+
7984
<click selector="{{StoreConfigSection.Save}}" stepKey="saveConfig"/>
8085
<!-- Open the customer edit page -->
8186
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="goToCustomerEditPageAgain">
8287
<argument name="customerId" value="$createCustomer.id$"/>
8388
</actionGroup>
84-
<!-- Switch the information tab -->
85-
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openInformationTabAgain"/>
86-
<!-- Fill the dob -->
87-
<fillField userInput="" selector="{{AdminCustomerAccountInformationSection.dateOfBirth}}" stepKey="fillDateOfBirthAgain"/>
89+
<!-- Switch the addresses tab -->
90+
<actionGroup ref="AdminOpenAddressesTabFromCustomerEditPageActionGroup" stepKey="openAddressesTabAgain"/>
91+
<!-- Click "Add New Address" -->
92+
<actionGroup ref="AdminClickAddNewAddressButtonOnCustomerAddressesTabActionGroup" stepKey="clickAddNewAddressButtonAgain"/>
93+
<!-- Fill address -->
94+
<actionGroup ref="AdminFillAndSaveCustomerAddressInformationActionGroup" stepKey="fillAndSaveCustomerAddressInformationActionGroupAgain">
95+
<argument name="address" value="addressNoCompany"/>
96+
</actionGroup>
8897
<!-- Assert that the address is successfully added -->
8998
<actionGroup stepKey="saveAndContinueAgain" ref="AdminCustomerSaveAndContinue"/>
9099
</test>

0 commit comments

Comments
 (0)