Skip to content

Commit 974e6f5

Browse files
committed
MAGETWO-86624: [2.2] Allowed countries restriction for a default website is applied to backend customer grid
1 parent 32264e5 commit 974e6f5

File tree

8 files changed

+42
-39
lines changed

8 files changed

+42
-39
lines changed

app/code/Magento/Backend/Test/Mftf/ActionGroup/ConfigurationActionGroup.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10-
<actionGroup name="NavigateToConfigurationGeneralPage">
11-
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/>
12-
<waitForPageLoad stepKey="waitForConfigPageLoad"/>
13-
</actionGroup>
14-
1510
<actionGroup name="SelectTopDestinationsCountry">
1611
<arguments>
1712
<argument name="countries"/>

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,27 @@
1212
<arguments>
1313
<argument name="country" type="string"/>
1414
</arguments>
15-
<conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="openCountryOptionsTab"/>
16-
<waitForElementVisible selector="{{CountryOptionsSection.allowedCountries}}" stepKey="waitAllowedCountriesToBeVisible"/>
17-
<uncheckOption selector="{{CountryOptionsSection.generalCountryDefaultInherit}}" stepKey="uncheckDefaultCountryInheritCheckbox"/>
18-
<selectOption selector="{{CountryOptionsSection.generalCountryDefault}}" userInput="{{country}}" stepKey="chooseDefaultCountry"/>
19-
<uncheckOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="uncheckAllowInheritCheckbox"/>
20-
<selectOption selector="{{CountryOptionsSection.allowedCountries}}" userInput="{{country}}" stepKey="chooseAllowedCountries"/>
21-
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/>
22-
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
23-
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
15+
<conditionalClick selector="{{AdminConfigurationGeneralCountryOptionsSection.countryOptions}}" dependentSelector="{{AdminConfigurationGeneralCountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="openCountryOptionsTab"/>
16+
<waitForElementVisible selector="{{AdminConfigurationGeneralCountryOptionsSection.allowedCountries}}" stepKey="waitAllowedCountriesToBeVisible"/>
17+
<uncheckOption selector="{{AdminConfigurationGeneralCountryOptionsSection.generalCountryDefaultInherit}}" stepKey="uncheckDefaultCountryInheritCheckbox"/>
18+
<selectOption selector="{{AdminConfigurationGeneralCountryOptionsSection.generalCountryDefault}}" userInput="{{country}}" stepKey="chooseDefaultCountry"/>
19+
<uncheckOption selector="{{AdminConfigurationGeneralCountryOptionsSection.generalCountryAllowInherit}}" stepKey="uncheckAllowInheritCheckbox"/>
20+
<selectOption selector="{{AdminConfigurationGeneralCountryOptionsSection.allowedCountries}}" userInput="{{country}}" stepKey="chooseAllowedCountries"/>
21+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig"/>
22+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
2423
</actionGroup>
2524
<actionGroup name="AllowAllCountriesExceptOneActionGroup" extends="AllowOnlyOneCountryActionGroup">
2625
<remove keyForRemoval="uncheckDefaultCountryInheritCheckbox"/>
2726
<remove keyForRemoval="chooseDefaultCountry"/>
2827
<remove keyForRemoval="chooseAllowedCountries"/>
29-
<unselectOption selector="{{CountryOptionsSection.allowedCountries}}" userInput="{{country}}" after="uncheckAllowInheritCheckbox" stepKey="unselectCountry"/>
28+
<unselectOption selector="{{AdminConfigurationGeneralCountryOptionsSection.allowedCountries}}" userInput="{{country}}" after="uncheckAllowInheritCheckbox" stepKey="unselectCountry"/>
3029
</actionGroup>
3130
<actionGroup name="SetWebsiteCountryOptionsToDefaultActionGroup">
32-
<conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="openCountryOptionsTab"/>
33-
<waitForElementVisible selector="{{CountryOptionsSection.topDestinations}}" stepKey="waitCheckboxToBeVisible"/>
34-
<checkOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="setAllowInheritToDefault"/>
35-
<checkOption selector="{{CountryOptionsSection.generalCountryDefaultInherit}}" stepKey="setDefaultCountryInheritToDefault"/>
36-
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/>
37-
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
38-
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
31+
<conditionalClick selector="{{AdminConfigurationGeneralCountryOptionsSection.countryOptions}}" dependentSelector="{{AdminConfigurationGeneralCountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="openCountryOptionsTab"/>
32+
<waitForElementVisible selector="{{AdminConfigurationGeneralCountryOptionsSection.topDestinations}}" stepKey="waitCheckboxToBeVisible"/>
33+
<checkOption selector="{{AdminConfigurationGeneralCountryOptionsSection.generalCountryAllowInherit}}" stepKey="setAllowInheritToDefault"/>
34+
<checkOption selector="{{AdminConfigurationGeneralCountryOptionsSection.generalCountryDefaultInherit}}" stepKey="setDefaultCountryInheritToDefault"/>
35+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig"/>
36+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
3937
</actionGroup>
4038
</actionGroups>

app/code/Magento/Config/Test/Mftf/Page/AdminConfigPage.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@
99
<page name="AdminConfigPage" url="admin/system_config/" area="admin" module="Magento_Config">
1010
<section name="AdminConfigSection"/>
1111
</page>
12-
<page name="AdminConfigGeneralPage" url="admin/system_config/edit/section/general/" area="admin" module="Magento_Config">
13-
<section name="CountryOptionsSection"/>
14-
</page>
1512
</pages>

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,4 @@
3232
<element name="addStoreCodeToUrl" type="select" selector="#web_url_use_store"/>
3333
<element name="systemValueForStoreCode" type="checkbox" selector="#web_url_use_store_inherit"/>
3434
</section>
35-
<section name="CountryOptionsSection">
36-
<element name="allowedCountries" type="select" selector="#general_country_allow"/>
37-
<element name="notAllowedCountry" type="button" selector="#general_country_allow option:not([selected])"/>
38-
<element name="generalCountryAllowInherit" type="checkbox" selector="#general_country_allow_inherit"/>
39-
<element name="generalCountryDefaultInherit" type="checkbox" selector="#general_country_default_inherit"/>
40-
<element name="generalCountryDefault" type="select" selector="#general_country_default"/>
41-
<element name="countryOptions" type="button" selector="#general_country-head"/>
42-
<element name="countryOptionsOpen" type="button" selector="#general_country-head.open"/>
43-
<element name="topDestinations" type="select" selector="#general_country_destinations"/>
44-
</section>
4535
</sections>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCustomerFiltersSection">
1212
<element name="filtersButton" type="button" selector="#container > div > div.admin__data-grid-header > div:nth-child(1) > div.data-grid-filters-actions-wrap > div > button" timeout="30"/>
1313
<element name="nameInput" type="input" selector="input[name=name]"/>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
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"/>
1414
<features value="Customer"/>
15+
<stories value="Customer grid filter by country"/>
1516
<severity value="MAJOR"/>
1617
<testCaseId value="MC-17282"/>
1718
<useCaseId value="MAGETWO-86624"/>
@@ -44,7 +45,7 @@
4445
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
4546
<argument name="websiteName" value="{{CustomWebSite.name}}"/>
4647
</actionGroup>
47-
<actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage"/>
48+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
4849
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup">
4950
<argument name="scopeName" value="_defaultWebsite.name"/>
5051
</actionGroup>
@@ -53,8 +54,8 @@
5354
</after>
5455

5556
<!--Check that all countries are allowed initially and get amount-->
56-
<actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage"/>
57-
<executeJS function="return document.querySelectorAll('{{CountryOptionsSection.allowedCountries}} option').length" stepKey="countriesAmount"/>
57+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToCountryConfigurationSectionPage"/>
58+
<executeJS function="return document.querySelectorAll('{{AdminConfigurationGeneralCountryOptionsSection.allowedCountries}} option').length" stepKey="countriesAmount"/>
5859

5960
<!-- Switch to first website, allow only Canada and set Canada as default country -->
6061
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsite">

app/code/Magento/Directory/Test/Mftf/Page/AdminConfigurationGeneralSectionPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1010
<page name="AdminConfigurationGeneralSectionPage" url="admin/system_config/edit/section/general/{{group_anchor}}" parameterized="true" area="admin" module="Magento_Config">
1111
<section name="AdminConfigurationGeneralSectionStateOptionsGroupSection"/>
12+
<section name="AdminConfigurationGeneralCountryOptionsSection"/>
1213
</page>
1314
</pages>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminConfigurationGeneralCountryOptionsSection">
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+
<element name="countryOptions" type="button" selector="#general_country-head"/>
18+
<element name="countryOptionsOpen" type="button" selector="#general_country-head.open"/>
19+
<element name="topDestinations" type="select" selector="#general_country_destinations"/>
20+
</section>
21+
</sections>

0 commit comments

Comments
 (0)