Skip to content

Commit d013abf

Browse files
committed
MC-38913: Associate to Website Functionality
- Fix customer associated website should be editable in customer information page
1 parent 5602710 commit d013abf

File tree

5 files changed

+40
-32
lines changed

5 files changed

+40
-32
lines changed
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="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup">
12+
<annotations>
13+
<description>Update customer website in customer information page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="websiteName" defaultValue="{{_defaultWebsite.name}}" type="string"/>
17+
</arguments>
18+
<selectOption selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{websiteName}}" stepKey="changeWebsite"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,5 @@
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"/>
1714
</section>
1815
</sections>

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

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
<test name="AdminChangeCustomerAssociatedWebsiteTest">
1212
<annotations>
1313
<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"/>
14+
<title value="Admin should be able to change customer associated website ID"/>
15+
<description value="Admin should be able to change customer associated website ID"/>
1616
<severity value="AVERAGE"/>
1717
<useCaseId value="MC-38913"/>
1818
<testCaseId value="MC-39764"/>
1919
<stories value="Customer Edit"/>
2020
<group value="customer"/>
2121
</annotations>
22-
2322
<before>
2423
<!--Login to admin-->
2524
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
@@ -45,41 +44,34 @@
4544
<after>
4645
<!--Delete customer-->
4746
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
48-
<!--Reset customer grid filter-->
49-
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomersPage"/>
50-
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomersGridFilter"/>
5147
<!--Delete custom website-->
5248
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
5349
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
5450
</actionGroup>
5551
<!--Logout from admin-->
5652
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
5753
</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"/>
7254
<!--Open customer edit page-->
7355
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
7456
<argument name="customerId" value="$createCustomer.id$"/>
7557
</actionGroup>
7658
<!--Navigate to "Account Information" tab-->
7759
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage"/>
78-
<!--Assert that "Main Website" is selected in website selector-->
60+
<!--Verify that "Main Website" is selected in website selector-->
7961
<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>
62+
<!--Change customer website to "Second Website"-->
63+
<actionGroup ref="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup" stepKey="updateCustomerWebsite">
64+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
65+
</actionGroup>
66+
<!--Verify that changes are saved successfully-->
67+
<actionGroup ref="AdminSaveCustomerAndAssertSuccessMessage" stepKey="assertThatChangesAreSavedSuccessfully"/>
68+
<!--Open customer edit page-->
69+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage2">
70+
<argument name="customerId" value="$createCustomer.id$"/>
71+
</actionGroup>
72+
<!--Navigate to "Account Information" tab-->
73+
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage2"/>
74+
<!--Verify that "Second Website" is selected in website selector-->
75+
<seeOptionIsSelected selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{NewWebSiteData.name}}" stepKey="assertThatSecondWebsiteIsSelected"/>
8476
</test>
8577
</tests>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@
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>
193196
<dataType>select</dataType>
194197
<label translate="true">Web Site</label>
195198
</settings>

app/code/Magento/Ui/view/base/web/js/form/element/website.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ define([
2626
initialize: function () {
2727
this._super();
2828

29-
if (this.customerId || this.isGlobalScope) {
30-
this.disable(true);
31-
}
32-
3329
return this;
3430
}
3531
});

0 commit comments

Comments
 (0)