|
| 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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="AllowedCountriesRestrictionApplyOnBackendTest"> |
| 11 | + <annotations> |
| 12 | + <title value="Country filter on Customers page when allowed countries restriction for a default website is applied"/> |
| 13 | + <description value="Country filter on Customers page when allowed countries restriction for a default website is applied"/> |
| 14 | + <features value="Module/ Customer"/> |
| 15 | + <severity value="MAJOR"/> |
| 16 | + <testCaseId value="MC-6441"/> |
| 17 | + <useCaseId value="MAGETWO-91523"/> |
| 18 | + <group value="customer"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 22 | + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> |
| 23 | + <requiredEntity createDataKey="createCategory"/> |
| 24 | + </createData> |
| 25 | + <actionGroup ref="LoginActionGroup" stepKey="login"/> |
| 26 | + |
| 27 | + <!--Create new website,store and store view--> |
| 28 | + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="goToAdminSystemStorePage"/> |
| 29 | + <actionGroup ref="AdminCreateWebsite" stepKey="AdminCreateNewWebsite"> |
| 30 | + <argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/> |
| 31 | + <argument name="websiteCode" value="{{NewWebSiteData.code}}"/> |
| 32 | + </actionGroup> |
| 33 | + <actionGroup ref="AdminCreateNewStore" stepKey="AdminCreateNewStore"> |
| 34 | + <argument name="website" value="{{NewWebSiteData.name}}"/> |
| 35 | + <argument name="storeGroupName" value="{{NewStoreData.name}}"/> |
| 36 | + <argument name="storeGroupCode" value="{{NewStoreData.code}}"/> |
| 37 | + </actionGroup> |
| 38 | + <actionGroup ref="AdminCreateStoreView" stepKey="AdminCreateNewStoreView"> |
| 39 | + <argument name="StoreGroup" value="NewStoreData"/> |
| 40 | + </actionGroup> |
| 41 | + <!--Set account sharing option - Default value is 'Per Website'--> |
| 42 | + <actionGroup ref="SetAccountSharingOptionActionGroup" stepKey="setAccountSharingOptionToDefault"/> |
| 43 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 44 | + </before> |
| 45 | + <after> |
| 46 | + <!--delete all created data and set main website country options to default--> |
| 47 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 48 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 49 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 50 | + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite"> |
| 51 | + <argument name="websiteName" value="{{NewWebSiteData.name}}"/> |
| 52 | + </actionGroup> |
| 53 | + <actionGroup ref="NavigateToConfigurationGeneralPage" stepKey="navigateToConfigGeneralPage2"/> |
| 54 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup"> |
| 55 | + <argument name="website" value="_defaultWebsite"/> |
| 56 | + </actionGroup> |
| 57 | + <actionGroup ref="SetMainWebsiteCountryOptionsToDefaultActionGroup" stepKey="setCountryOptionsToDefault"/> |
| 58 | + <actionGroup ref="logout" stepKey="logout"/> |
| 59 | + </after> |
| 60 | + <!--Check that all countries are allowed initially and get amount--> |
| 61 | + <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"/> |
| 70 | + <!-- Create customer for US --> |
| 71 | + <createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/> |
| 72 | + <!-- Switch to first website, allow only Canada and set Canada as default country--> |
| 73 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup"> |
| 74 | + <argument name="website" value="_defaultWebsite"/> |
| 75 | + </actionGroup> |
| 76 | + <conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation2"/> |
| 77 | + <waitForElementVisible selector="{{CountryOptionsSection.allowedCountries}}" stepKey="waitAllowedCountriesToBeVisible"/> |
| 78 | + <uncheckOption selector="{{CountryOptionsSection.generalCountryDefaultInherit}}" stepKey="uncheckCheckbox1"/> |
| 79 | + <selectOption selector="{{CountryOptionsSection.generalCountryDefault}}" userInput="Canada" stepKey="chooseCanada1"/> |
| 80 | + <uncheckOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="uncheckCheckbox2"/> |
| 81 | + <selectOption selector="{{CountryOptionsSection.allowedCountries}}" userInput="Canada" stepKey="chooseCanada2"/> |
| 82 | + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig2"/> |
| 83 | + <waitForPageLoad stepKey="waitForSavingSystemConfiguration2"/> |
| 84 | + <!--Switch to second website and allow all countries except Canada--> |
| 85 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="adminSwitchWebsiteActionGroup2"> |
| 86 | + <argument name="website" value="NewWebSiteData"/> |
| 87 | + </actionGroup> |
| 88 | + <conditionalClick selector="{{CountryOptionsSection.countryOptions}}" dependentSelector="{{CountryOptionsSection.countryOptionsOpen}}" visible="false" stepKey="clickOnStoreInformation3"/> |
| 89 | + <waitForElementVisible selector="{{CountryOptionsSection.allowedCountries}}" stepKey="waitAllowedCountriesToBeVisible2"/> |
| 90 | + <uncheckOption selector="{{CountryOptionsSection.generalCountryAllowInherit}}" stepKey="uncheckCheckbox3"/> |
| 91 | + <unselectOption selector="{{CountryOptionsSection.allowedCountries}}" userInput="Canada" stepKey="unselectCanada"/> |
| 92 | + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig3"/> |
| 93 | + <waitForPageLoad stepKey="waitForSavingSystemConfiguration3"/> |
| 94 | + <amOnPage url="{{AdminEditCustomerPage.url($$createCustomer.id$$)}}" stepKey="goToCustomerEditPage"/> |
| 95 | + <waitForPageLoad stepKey="waitPageToLoad"/> |
| 96 | + <!--Open created customer details page and change US address to Canada address--> |
| 97 | + <actionGroup ref="OpenEditCustomerAddressFromAdminActionGroup" stepKey="editCustomerAddress"> |
| 98 | + <argument name="address" value="US_Address_CA"/> |
| 99 | + </actionGroup> |
| 100 | + <selectOption selector="{{AdminEditCustomerAddressesSection.country}}" userInput="Canada" stepKey="selectCountry"/> |
| 101 | + <selectOption selector="{{AdminEditCustomerAddressesSection.state}}" userInput="Quebec" stepKey="selectState"/> |
| 102 | + <click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/> |
| 103 | + <waitForPageLoad stepKey="waitForAddressSaved"/> |
| 104 | + <click stepKey="saveCustomer" selector="{{AdminCustomerAccountInformationSection.saveCustomerAndContinueEdit}}"/> |
| 105 | + <waitForPageLoad stepKey="waitForCustomersPage"/> |
| 106 | + <!--Go to Customers grid and check that filter countries amount is the same as initial allowed countries amount--> |
| 107 | + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersGrid"/> |
| 108 | + <waitForPageLoad stepKey="waitForCustomersGrid"/> |
| 109 | + <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"/> |
| 112 | + </test> |
| 113 | +</tests> |
0 commit comments