Skip to content

Commit 95760d5

Browse files
author
Davit_Zakharyan
committed
MAGETWO-91523: [2.3] Allowed countries restriction for a default website is applied to backend customer grid
- Updated automated test script.
1 parent 776344f commit 95760d5

11 files changed

+65
-53
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="SetMainWebsiteCountryOptionsToDefaultActionGroup">
11+
<actionGroup name="SetWebsiteCountryOptionsToDefaultActionGroup">
1212
<conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation3"/>
1313
<waitForElementVisible selector="{{CountryOptionsSection.topDestinations}}" stepKey="waitCheckboxToBeVisible3"/>
1414
<checkOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="setToDefault1"/>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="CountryOptionsSection">
12+
<element name="allowedCountries" type="select" selector="#general_country_allow"/>
13+
<element name="notAllowedCountry" type="button" selector="#general_country_allow option:not([selected])"/>
14+
<element name="generalCountryAllowInherit" type="checkbox" selector="#general_country_allow_inherit"/>
15+
<element name="generalCountryDefaultInherit" type="checkbox" selector="#general_country_default_inherit"/>
16+
<element name="generalCountryDefault" type="select" selector="#general_country_default"/>
17+
</section>
18+
</sections>

app/code/Magento/Config/Test/Mftf/ActionGroup/SetAccountSharingOptionActionGroup.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/Config/Test/Mftf/Section/AdminStoresCustomerConfigurationSection.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@
1010
<element name="createNewAccOpt" type="button" selector="#customer_create_account-head"/>
1111
<element name="enableAutoAssignCustomerGroup" type="button" selector="#customer_create_account_auto_group_assign"/>
1212
<element name="groupForValidVATIdIntraUnion" type="select" selector="#customer_create_account_viv_intra_union_group"/>
13-
<element name="accountSharingOptionsTab" type="button" selector="#customer_account_share-head"/>
14-
<element name="shareCustomerAccountInherit" type="checkbox" selector="#customer_account_share_scope_inherit"/>
15-
<element name="shareCustomerAccount" type="select" selector="#customer_account_share_scope"/>
1613
</section>
1714
</sections>

app/code/Magento/Config/Test/Mftf/Section/GeneralSection.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
<element name="countryOptions" type="button" selector="#general_country-head"/>
3939
<element name="countryOptionsOpen" type="button" selector="#general_country-head.open"/>
4040
<element name="topDestinations" type="select" selector="#general_country_destinations"/>
41-
<element name="allowedCountries" type="select" selector="#general_country_allow"/>
42-
<element name="notAllowedCountry" type="button" selector="#general_country_allow option:not([selected])"/>
43-
<element name="generalCountryAllowInherit" type="checkbox" selector="#general_country_allow_inherit"/>
44-
<element name="generalCountryDefaultInherit" type="checkbox" selector="#general_country_default_inherit"/>
45-
<element name="generalCountryDefault" type="select" selector="#general_country_default"/>
4641
</section>
4742
<section name="StateOptionsSection">
4843
<element name="stateOptions" type="button" selector="#general_region-head"/>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@
2121
<entity name="GlobalCustomerAccountSharing" type="account_share_scope_value">
2222
<data key="value">0</data>
2323
</entity>
24+
25+
<entity name="CustomerAccountSharingSystemValue" type="customer_account_sharing_config_inherit">
26+
<requiredEntity type="account_share_scope_inherit">CustomerAccountSharingInherit</requiredEntity>
27+
</entity>
28+
<entity name="CustomerAccountSharingInherit" type="account_share_scope_inherit">
29+
<data key="inherit">true</data>
30+
</entity>
2431
</entities>

app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@
1818
</object>
1919
</object>
2020
</operation>
21+
<operation name="CustomerAccountShareConfigInherit" dataType="customer_account_sharing_config_inherit" type="create" auth="adminFormKey" url="/admin/system_config/save/section/customer/"
22+
method="POST">
23+
<object key="groups" dataType="customer_account_sharing_config_inherit">
24+
<object key="account_share" dataType="customer_account_sharing_config_inherit">
25+
<object key="fields" dataType="customer_account_sharing_config_inherit">
26+
<object key="scope" dataType="account_share_scope_inherit">
27+
<field key="inherit">boolean</field>
28+
</object>
29+
</object>
30+
</object>
31+
</object>
32+
</operation>
2133
</operations>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
99
<section name="AdminCustomerConfigSection">
1010
<element name="customerDataLifetime" type="input" selector="#customer_online_customers_section_data_lifetime"/>
11+
<element name="accountSharingOptionsTab" type="button" selector="#customer_account_share-head"/>
12+
<element name="shareCustomerAccountInherit" type="checkbox" selector="#customer_account_share_scope_inherit"/>
13+
<element name="shareCustomerAccount" type="select" selector="#customer_account_share_scope"/>
1114
</section>
1215
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
<element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear" timeout="30"/>
1919
<element name="viewDropdown" type="button" selector=".admin__data-grid-action-bookmarks button.admin__action-dropdown"/>
2020
<element name="viewBookmark" type="button" selector="//div[contains(@class, 'admin__data-grid-action-bookmarks')]/ul/li/div/a[text() = '{{label}}']" parameterized="true" timeout="30"/>
21+
<element name="countryOptions" type="button" selector=".admin__data-grid-filters select[name=billing_country_id] option"/>
2122
</section>
2223
</sections>

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

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<annotations>
1212
<title value="Country filter on Customers page when allowed countries restriction for a default website is applied"/>
1313
<description value="Country filter on Customers page when allowed countries restriction for a default website is applied"/>
14-
<features value="Module/ Customer"/>
14+
<features value="Customer"/>
1515
<severity value="MAJOR"/>
1616
<testCaseId value="MC-6441"/>
1717
<useCaseId value="MAGETWO-91523"/>
@@ -23,27 +23,29 @@
2323
<requiredEntity createDataKey="createCategory"/>
2424
</createData>
2525
<actionGroup ref="LoginActionGroup" stepKey="login"/>
26-
2726
<!--Create new website,store and store view-->
27+
<comment userInput="Create new website,store and store view" stepKey="createWebsite"/>
2828
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="goToAdminSystemStorePage"/>
29-
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="AdminCreateNewWebsite">
29+
<actionGroup ref="AdminCreateWebsite" stepKey="AdminCreateNewWebsite">
3030
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
3131
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
3232
</actionGroup>
33-
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="AdminCreateNewStore">
33+
<actionGroup ref="AdminCreateNewStore" stepKey="AdminCreateNewStore">
3434
<argument name="website" value="{{NewWebSiteData.name}}"/>
3535
<argument name="storeGroupName" value="{{NewStoreData.name}}"/>
3636
<argument name="storeGroupCode" value="{{NewStoreData.code}}"/>
3737
</actionGroup>
38-
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="AdminCreateNewStoreView">
38+
<actionGroup ref="AdminCreateStoreView" stepKey="AdminCreateNewStoreView">
3939
<argument name="StoreGroup" value="NewStoreData"/>
4040
</actionGroup>
4141
<!--Set account sharing option - Default value is 'Per Website'-->
42-
<actionGroup ref="SetAccountSharingOptionActionGroup" stepKey="setAccountSharingOptionToDefault"/>
42+
<comment userInput="Set account sharing option - Default value is 'Per Website'" stepKey="setAccountSharingOption"/>
43+
<createData entity="CustomerAccountSharingDefault" stepKey="setToAccountSharingToDefault"/>
4344
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
4445
</before>
4546
<after>
4647
<!--delete all created data and set main website country options to default-->
48+
<comment userInput="Delete all created data and set main website country options to default" stepKey="resetConfigToDefault"/>
4749
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
4850
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
4951
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
@@ -54,22 +56,22 @@
5456
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup">
5557
<argument name="website" value="_defaultWebsite"/>
5658
</actionGroup>
57-
<actionGroup ref="SetMainWebsiteCountryOptionsToDefaultActionGroup" stepKey="setCountryOptionsToDefault"/>
59+
<actionGroup ref="SetWebsiteCountryOptionsToDefaultActionGroup" stepKey="setCountryOptionsToDefault"/>
60+
<createData entity="CustomerAccountSharingSystemValue" stepKey="setAccountSharingToSystemValue"/>
5861
<actionGroup ref="logout" stepKey="logout"/>
62+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
63+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
5964
</after>
6065
<!--Check that all countries are allowed initially and get amount-->
66+
<comment userInput="Check that all countries are allowed initially and get amount" stepKey="checkAllCountriesAreAllowed"/>
6167
<actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage"/>
62-
<conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation"/>
63-
<waitForElementVisible selector="{{CountryOptionsSection.allowedCountries}}" stepKey="waitTabToExpand"/>
64-
<executeJS function="return document.querySelectorAll('{{CountryOptionsSection.allowedCountries}} option').length" stepKey="CountriesAmount"/>
65-
<checkOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="markAllCountriesAsAvailable"/>
66-
<click selector="{{CountryOptionsSection.countryOptions}}" stepKey="collapseTab"/>
67-
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/>
68-
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
69-
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
68+
<createData entity="DisableAdminAccountAllowCountry" stepKey="setDefaultValueForAllowCountries"/>
69+
<executeJS function="return document.querySelectorAll('{{CountryOptionsSection.allowedCountries}} option').length" stepKey="countriesAmount"/>
7070
<!-- Create customer for US -->
71+
<comment userInput="Create customer for US" stepKey="createUSCustomer"/>
7172
<createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/>
72-
<!-- Switch to first website, allow only Canada and set Canada as default country-->
73+
<!-- Switch to first website, allow only Canada and set Canada as default country -->
74+
<comment userInput="Switch to first website, allow only Canada and set Canada as default country" stepKey="setCanadaAsDefaultCountry"/>
7375
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup">
7476
<argument name="website" value="_defaultWebsite"/>
7577
</actionGroup>
@@ -82,6 +84,7 @@
8284
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig2"/>
8385
<waitForPageLoad stepKey="waitForSavingSystemConfiguration2"/>
8486
<!--Switch to second website and allow all countries except Canada-->
87+
<comment userInput="Switch to second website and allow all countries except Canada" stepKey="switchToWebsiteAndAllowOnlyCanada"/>
8588
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup2">
8689
<argument name="website" value="NewWebSiteData"/>
8790
</actionGroup>
@@ -94,6 +97,7 @@
9497
<amOnPage url="{{AdminEditCustomerPage.url($$createCustomer.id$$)}}" stepKey="goToCustomerEditPage"/>
9598
<waitForPageLoad stepKey="waitPageToLoad"/>
9699
<!--Open created customer details page and change US address to Canada address-->
100+
<comment userInput="Open created customer details page and change US address to Canada address" stepKey="changeCustomerAddressToCanada"/>
97101
<actionGroup ref="OpenEditCustomerAddressFromAdminActionGroup" stepKey="editCustomerAddress">
98102
<argument name="address" value="US_Address_CA"/>
99103
</actionGroup>
@@ -104,10 +108,11 @@
104108
<click stepKey="saveCustomer" selector="{{AdminCustomerAccountInformationSection.saveCustomerAndContinueEdit}}"/>
105109
<waitForPageLoad stepKey="waitForCustomersPage"/>
106110
<!--Go to Customers grid and check that filter countries amount is the same as initial allowed countries amount-->
111+
<comment userInput="Go to Customers grid and check that filter countries amount is the same as initial allowed countries amount" stepKey="compareCountriesAmount"/>
107112
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersGrid"/>
108113
<waitForPageLoad stepKey="waitForCustomersGrid"/>
109114
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomersGrid"/>
110-
<executeJS function="var len = document.querySelectorAll('{{AdminDataGridHeaderSection.countryOptions}}').length; return len-1;" stepKey="CountriesAmount2"/>
111-
<assertEquals expected='($CountriesAmount)' expectedType="integer" actual="($CountriesAmount2)" stepKey="assertCountryAmounts"/>
115+
<executeJS function="var len = document.querySelectorAll('{{AdminCustomerFiltersSection.countryOptions}}').length; return len-1;" stepKey="countriesAmount2"/>
116+
<assertEquals expected='($countriesAmount)' expectedType="integer" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/>
112117
</test>
113118
</tests>

0 commit comments

Comments
 (0)