Skip to content

Commit 5602710

Browse files
committed
MC-38913: Associate to Website Functionality
- Fix customer associated website should not be editable in customer grid
1 parent e00d2fc commit 5602710

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<section name="AdminCustomerGridInlineEditorSection">
1212
<element name="customerGenderEditor" type="select" selector="tr.data-grid-editable-row:not([style*='display: none']) [name='gender']"/>
1313
<element name="saveInGrid" type="button" selector="tr.data-grid-editable-row-actions button.action-primary" timeout="30"/>
14+
<element name="customerEmailEditor" type="select" selector="tr.data-grid-editable-row:not([style*='display: none']) input[name='email']"/>
15+
<element name="customerWebsiteEditor" type="select" selector="tr.data-grid-editable-row:not([style*='display: none']) select[name='website_id']"/>
16+
<element name="cellContent" type="select" selector="//tr[@class='data-grid-editable-row' and not(contains(@style,'display:none'))]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{col}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
1417
</section>
1518
</sections>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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="AdminChangeCustomerAssociatedWebsiteTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<title value="Admin should not be able to change customer assigned website ID"/>
15+
<description value="Admin should not be able to change customer assigned website ID"/>
16+
<severity value="AVERAGE"/>
17+
<useCaseId value="MC-38913"/>
18+
<testCaseId value="MC-39764"/>
19+
<stories value="Customer Edit"/>
20+
<group value="customer"/>
21+
</annotations>
22+
23+
<before>
24+
<!--Login to admin-->
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
<!--Create second website-->
27+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
28+
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
29+
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
30+
</actionGroup>
31+
<!--Create store group and associate it to second website-->
32+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
33+
<argument name="website" value="{{NewWebSiteData.name}}"/>
34+
<argument name="storeGroupName" value="{{NewStoreData.name}}"/>
35+
<argument name="storeGroupCode" value="{{NewStoreData.code}}"/>
36+
</actionGroup>
37+
<!--Create store view and associate it to second store group-->
38+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
39+
<argument name="StoreGroup" value="NewStoreData"/>
40+
<argument name="customStore" value="NewStoreViewData"/>
41+
</actionGroup>
42+
<!--Create customer-->
43+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
44+
</before>
45+
<after>
46+
<!--Delete customer-->
47+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
48+
<!--Reset customer grid filter-->
49+
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomersPage"/>
50+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomersGridFilter"/>
51+
<!--Delete custom website-->
52+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
53+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
54+
</actionGroup>
55+
<!--Logout from admin-->
56+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
57+
</after>
58+
<!--Open customer grid-->
59+
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomersPage"/>
60+
<!--Filter customers grid by email-->
61+
<actionGroup ref="AdminFilterCustomerGridByEmail" stepKey="filterCustomer">
62+
<argument name="email" value="$createCustomer.email$"/>
63+
</actionGroup>
64+
<!--Click on customer row to open inline editor-->
65+
<click selector="{{AdminDataGridTableSection.rowTemplate($createCustomer.email$)}}" stepKey="clickCustomersGridRow"/>
66+
<!--Wait for inline editor to open-->
67+
<waitForElementVisible selector="{{AdminCustomerGridInlineEditorSection.customerEmailEditor}}" stepKey="waitForEditor"/>
68+
<!--Assert that website is not editable-->
69+
<dontSeeElement selector="{{AdminCustomerGridInlineEditorSection.customerWebsiteEditor}}" stepKey="dontSeeWebsiteEditor"/>
70+
<!--Assert that "Main Website" is displayed in website cell-->
71+
<see selector="{{AdminCustomerGridInlineEditorSection.cellContent('Web Site')}}" userInput="{{_defaultWebsite.name}}" stepKey="assertThatMainWebsiteIsDisplayedInWebsiteCell"/>
72+
<!--Open customer edit page-->
73+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
74+
<argument name="customerId" value="$createCustomer.id$"/>
75+
</actionGroup>
76+
<!--Navigate to "Account Information" tab-->
77+
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage"/>
78+
<!--Assert that "Main Website" is selected in website selector-->
79+
<seeOptionIsSelected selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{_defaultWebsite.name}}" stepKey="assertThatMainWebsiteIsSelected"/>
80+
<!--Assert that website selector is disabled-->
81+
<assertElementContainsAttribute stepKey="assertThatWebsiteSelectorIsDisabled">
82+
<expectedResult selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" attribute="disabled" type="string"/>
83+
</assertElementContainsAttribute>
84+
</test>
85+
</tests>

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,6 @@
190190
<column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites" component="Magento_Ui/js/grid/columns/select" sortOrder="110">
191191
<settings>
192192
<filter>select</filter>
193-
<editor>
194-
<editorType>select</editorType>
195-
</editor>
196193
<dataType>select</dataType>
197194
<label translate="true">Web Site</label>
198195
</settings>

0 commit comments

Comments
 (0)