Skip to content

Commit a4ebe74

Browse files
committed
ACP2E-675: Telephone required on all websites when set to be optional on some
1 parent 1207e1f commit a4ebe74

8 files changed

+216
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="AdminCustomerShowTelephoneActionGroup">
12+
<annotations>
13+
<description>Goes to the customer configuration. Set "Show Telephone" with provided value.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string" defaultValue="{{ShowTelephone.optional}}"/>
17+
</arguments>
18+
<scrollTo selector="{{AdminCustomerConfigSection.showTelephone}}" x="0" y="-100" stepKey="scrollToShowTelephone"/>
19+
<uncheckOption selector="{{AdminCustomerConfigSection.showTelephoneInherit}}" stepKey="uncheckUseSystem"/>
20+
<selectOption selector="{{AdminCustomerConfigSection.showTelephone}}" userInput="{{value}}" stepKey="fillShowTelephone"/>
21+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
22+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminCustomerShowTelephoneUseDefaultActionGroup">
12+
<annotations>
13+
<description>Goes to the customer configuration. Check "Use system value" or "Use Default".</description>
14+
</annotations>
15+
<scrollTo selector="{{AdminCustomerConfigSection.showTelephone}}" x="0" y="-100" stepKey="scrollToShowTelephone"/>
16+
<checkOption selector="{{AdminCustomerConfigSection.showTelephoneInherit}}" stepKey="uncheckUseSystem"/>
17+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
18+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminNavigateToCustomerConfigurationActionGroup">
12+
<annotations>
13+
<description>Navigate to customer configuration.</description>
14+
</annotations>
15+
<amOnPage url="{{AdminCustomerConfigPage.url('')}}" stepKey="openCustomerConfigPage"/>
16+
<waitForPageLoad stepKey="waitCustomerConfigPage"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AssertAdminCustomerAddressInAddressGridActionGroup">
12+
<annotations>
13+
<description>Assert customer address is in addresses grid</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="text" type="string"/>
17+
</arguments>
18+
<see selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" userInput="{{text}}" stepKey="seeText"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
<data key="telephone">512-345-6789</data>
6767
<requiredEntity type="region">RegionTX</requiredEntity>
6868
</entity>
69+
<entity name="US_Address_TX_Without_Default_And_Telephone" extends="US_Address_TX_Without_Default">
70+
<data key="telephone"></data>
71+
</entity>
6972
<entity name="US_Address_TX_Default_Billing" type="address">
7073
<data key="firstname">John</data>
7174
<data key="lastname">Doe</data>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,14 @@
1313
<data key="optional">Optional</data>
1414
<data key="required">Required</data>
1515
</entity>
16+
<entity name="ShowTelephone">
17+
<data key="no">No</data>
18+
<data key="optional">Optional</data>
19+
<data key="required">Required</data>
20+
</entity>
21+
<entity name="CustomerConfigurationSectionNameAndAddressOptions">
22+
<data key="id">customer_address-head</data>
23+
<data key="title">Name and Address Options</data>
24+
<data key="link">#customer_address-link</data>
25+
</entity>
1626
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
<element name="shareCustomerAccount" type="select" selector="#customer_account_share_scope"/>
1414
<element name="showDateOfBirth" type="select" selector="#customer_address_dob_show"/>
1515
<element name="showDateOfBirthInherit" type="select" selector="#customer_address_dob_show_inherit"/>
16+
<element name="showTelephone" type="select" selector="#customer_address_telephone_show"/>
17+
<element name="showTelephoneInherit" type="checkbox" selector="#customer_address_telephone_show_inherit"/>
1618
</section>
1719
</sections>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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="AdminCustomerAddressAttributeWebsiteScopeTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<stories value="Customer and multiple website setup"/>
15+
<title value="Admin should be able to configure different address attributes requirement settings for each website"/>
16+
<description value="Admin should be able to configure different address attributes requirement settings for each website"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="AC-2708"/>
19+
<useCaseId value="ACP2E-675"/>
20+
<group value="customer"/>
21+
</annotations>
22+
<before>
23+
<!-- Login to admin -->
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
25+
<!-- Create a second website -->
26+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
27+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
28+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
29+
</actionGroup>
30+
<!-- Create a store group and assign to second website -->
31+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
32+
<argument name="website" value="{{customWebsite.name}}"/>
33+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
34+
<argument name="storeGroupCode" value="{{customStoreGroup.code}}"/>
35+
</actionGroup>
36+
<!-- Create a store view and assign to new store group -->
37+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
38+
<argument name="StoreGroup" value="customStoreGroup"/>
39+
<argument name="customStore" value="customStore"/>
40+
</actionGroup>
41+
<!-- Navigate to the new website page -->
42+
<actionGroup ref="AdminGoCreatedWebsitePageActionGroup" stepKey="openWebsiteToGetId">
43+
<argument name="websiteName" value="{{customWebsite.name}}"/>
44+
</actionGroup>
45+
<!-- Get the website ID -->
46+
<grabFromCurrentUrl regex="~/website_id/(\d+)/~" stepKey="grabWebsiteIdFromURL"/>
47+
<!-- Navigate to customer configuration page -->
48+
<actionGroup ref="AdminNavigateToCustomerConfigurationActionGroup" stepKey="gotoCustomerConfiguration"/>
49+
<!-- Expand "Name and Address Option" section -->
50+
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionDefaultScope">
51+
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
52+
</actionGroup>
53+
<!-- Set "Show Telephone" to Optional and save in default config scope -->
54+
<actionGroup ref="AdminCustomerShowTelephoneActionGroup" stepKey="setShowTelephoneOptionalDefaultScope">
55+
<argument name="value" value="{{ShowTelephone.no}}"/>
56+
</actionGroup>
57+
<!-- Change scope to main website -->
58+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView">
59+
<argument name="website" value="_defaultWebsite"/>
60+
</actionGroup>
61+
<!-- Expand "Name and Address Option" section -->
62+
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionMainWebsite">
63+
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
64+
</actionGroup>
65+
<!-- Set "Show Telephone" to Required and save in main website scope -->
66+
<actionGroup ref="AdminCustomerShowTelephoneActionGroup" stepKey="setShowTelephoneRequiredMainWebsite">
67+
<argument name="value" value="{{ShowTelephone.required}}"/>
68+
</actionGroup>
69+
<!-- Create a customer and assign it to new website -->
70+
<createData entity="Simple_Customer_Without_Address" stepKey="createCustomer">
71+
<field key="website_id">$grabWebsiteIdFromURL</field>
72+
</createData>
73+
</before>
74+
<after>
75+
<!-- Navigate to customer configuration page -->
76+
<actionGroup ref="AdminNavigateToCustomerConfigurationActionGroup" stepKey="gotoCustomerConfiguration"/>
77+
<!-- Expand "Name and Address Option" section -->
78+
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionDefaultScope">
79+
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
80+
</actionGroup>
81+
<!-- Check "use system" near "Show Telephone" and save in default config scope -->
82+
<actionGroup ref="AdminCustomerShowTelephoneUseDefaultActionGroup" stepKey="checkUseSystemDefaultScope"/>
83+
<!-- Change scope to main website -->
84+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView">
85+
<argument name="website" value="_defaultWebsite"/>
86+
</actionGroup>
87+
<!-- Expand "Name and Address Option" section -->
88+
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandConfigSectionMainWebsite">
89+
<argument name="sectionName" value="{{CustomerConfigurationSectionNameAndAddressOptions.title}}"/>
90+
</actionGroup>
91+
<!-- Check "use default" near "Show Telephone" and save in main website scope -->
92+
<actionGroup ref="AdminCustomerShowTelephoneUseDefaultActionGroup" stepKey="checkUseDefaultMainWebsite"/>
93+
<!-- Delete customer -->
94+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
95+
<!-- Delete the new website -->
96+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite">
97+
<argument name="websiteName" value="{{customWebsite.name}}"/>
98+
</actionGroup>
99+
<!-- Logout from admin -->
100+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
101+
</after>
102+
<!-- Open the customer edit page -->
103+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="goToCustomerEditPage">
104+
<argument name="customerId" value="$createCustomer.id$"/>
105+
</actionGroup>
106+
<!-- Switch the addresses tab -->
107+
<actionGroup ref="AdminOpenAddressesTabFromCustomerEditPageActionGroup" stepKey="openAddressesTab"/>
108+
<!-- Click "Add New Address" -->
109+
<actionGroup ref="AdminClickAddNewAddressButtonOnCustomerAddressesTabActionGroup" stepKey="clickAddNewAddressButton"/>
110+
<!-- Fill the address without telephone and save the address -->
111+
<actionGroup ref="AdminFillAndSaveCustomerAddressInformationActionGroup" stepKey="fillAndSaveCustomerAddressInformationActionGroup">
112+
<argument name="address" value="US_Address_TX_Without_Default_And_Telephone"/>
113+
</actionGroup>
114+
<!-- Assert that the address is successfully added -->
115+
<actionGroup ref="AssertAdminCustomerAddressInAddressGridActionGroup" stepKey="assertThatAddressIsAdded">
116+
<argument name="text" value="{{US_Address_TX_Without_Default_And_Telephone.street[0]}}"/>
117+
</actionGroup>
118+
</test>
119+
</tests>

0 commit comments

Comments
 (0)