Skip to content

Commit 6db74c2

Browse files
dthampydanielrenaud
authored andcommitted
MAGETWO-62310: Product "Use Default Value" checkbox for an attributes are unchecked for the new website scope
- added functional test to cover the bug fix
1 parent 2c910f4 commit 6db74c2

File tree

7 files changed

+126
-14
lines changed

7 files changed

+126
-14
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1414
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
1515
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
16+
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
1617
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
18+
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
1719
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']"/>
1820
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
1921
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminMultipleWebsitesUseDefaultValuesTest">
12+
<annotations>
13+
<title value="Use Default Value checkboxes should be checked for new website scope"/>
14+
<description value="Use Default Value checkboxes for product attribute should be checked for new website scope"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-92454"/>
17+
<group value="Catalog"/>
18+
</annotations>
19+
<after>
20+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
21+
<argument name="websiteName" value="Second Website"/>
22+
</actionGroup>
23+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
24+
</after>
25+
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
26+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
27+
<argument name="newWebsiteName" value="Second Website"/>
28+
<argument name="websiteCode" value="second_website"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
31+
<argument name="website" value="Second Website"/>
32+
<argument name="storeGroupName" value="Second Store"/>
33+
<argument name="storeGroupCode" value="second_store"/>
34+
</actionGroup>
35+
36+
<!--Create Store view -->
37+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
38+
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
39+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
40+
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
41+
<fillField userInput="Second Store View" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
42+
<fillField userInput="second_store_view" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
43+
<selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="1" stepKey="enableStoreViewStatus"/>
44+
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickStoreViewSaveButton"/>
45+
<waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationModal" />
46+
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="AcceptNewStoreViewCreation"/>
47+
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/>
48+
<see userInput="You saved the store view." stepKey="seeSaveMessage"/>
49+
50+
<!--Create a Simple Product -->
51+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
52+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
53+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
54+
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillProductName"/>
55+
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillProductSKU"/>
56+
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillProductPrice"/>
57+
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillProductQuantity"/>
58+
59+
<!-- Add product to second website and save the product -->
60+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsites"/>
61+
<click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite"/>
62+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
63+
<waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/>
64+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/>
65+
66+
<!-- switch to the second store view -->
67+
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
68+
<click selector="{{AdminProductFormActionSection.selectStoreView('Second Store View')}}" stepKey="chooseStoreView"/>
69+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
70+
<!--<waitForPageLoad stepKey="waitForStoreViewSwitched"/>-->
71+
<waitForPageLoad time="30" stepKey="waitForPageLoad9"/>
72+
<see userInput="Second Store View" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewStoreViewName"/>
73+
74+
<!-- Check if Use Default Value checkboxes are checked -->
75+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatusUseDefault}}" stepKey="seeProductStatusCheckboxChecked"/>
76+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="seeProductNameCheckboxChecked"/>
77+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productTaxClassUseDefault}}" stepKey="seeTaxClassCheckboxChecked"/>
78+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.visibilityUseDefault}}" stepKey="seeVisibilityCheckboxChecked"/>
79+
</test>
80+
</tests>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,23 @@
2121

2222
<after>
2323
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
24-
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"/>
25-
24+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
25+
<argument name="websiteName" value="Second Website"/>
26+
</actionGroup>
2627
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
2728
</after>
2829
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2930
<actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/>
30-
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addnewWebsite"/>
31-
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="addNewStoreGroup"/>
31+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addnewWebsite">
32+
<argument name="newWebsiteName" value="Second Website"/>
33+
<argument name="websiteCode" value="second_website"/>
34+
</actionGroup>
35+
36+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
37+
<argument name="website" value="Second Website"/>
38+
<argument name="storeGroupName" value="Second Store"/>
39+
<argument name="storeGroupCode" value="second_store"/>
40+
</actionGroup>
3241

3342
<!--Create Store view -->
3443
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,22 @@
7373
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
7474
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
7575
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
76-
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"/>
76+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
77+
<argument name="websiteName" value="Second Website"/>
78+
</actionGroup>
7779
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
7880
</after>
7981

8082
<actionGroup ref="EnableWebUrlOptions" stepKey="addStoreCodeToUrls"/>
81-
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addnewWebsite"/>
82-
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="addNewStoreGroup"/>
83+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="addnewWebsite">
84+
<argument name="newWebsiteName" value="Second Website"/>
85+
<argument name="websiteCode" value="second_website"/>
86+
</actionGroup>
87+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
88+
<argument name="website" value="Second Website"/>
89+
<argument name="storeGroupName" value="Second Store"/>
90+
<argument name="storeGroupCode" value="second_store"/>
91+
</actionGroup>
8392

8493
<!--Create Store view -->
8594
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="AdminCreateNewStoreGroupActionGroup">
12+
<arguments>
13+
<argument name="website" type="string"/>
14+
<argument name="storeGroupName" type="string"/>
15+
<argument name="storeGroupCode" type="string"/>
16+
</arguments>
1217
<amOnPage url="{{AdminSystemStoreGroupPage.url}}" stepKey="navigateToNewStoreView"/>
1318
<waitForPageLoad stepKey="waitForPageLoad1" />
1419
<!--Create Store group -->
15-
<selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="Second Website" stepKey="selectWebsite" />
16-
<fillField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="Second Store" stepKey="enterStoreGroupName" />
17-
<fillField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="second_store" stepKey="enterStoreGroupCode" />
20+
<selectOption selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website}}" stepKey="selectWebsite" />
21+
<fillField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="{{storeGroupName}}" stepKey="enterStoreGroupName" />
22+
<fillField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="{{storeGroupCode}}" stepKey="enterStoreGroupCode" />
1823
<selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="Default Category" stepKey="chooseRootCategory" />
1924
<click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreGroup" />
2025
<waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateWebsiteActionGroup.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="AdminCreateWebsiteActionGroup">
12+
<arguments>
13+
<argument name="newWebsiteName" type="string"/>
14+
<argument name="websiteCode" type="string"/>
15+
</arguments>
1216
<amOnPage url="{{AdminSystemStoreWebsitePage.url}}" stepKey="navigateToNewWebsitePage"/>
1317
<waitForPageLoad stepKey="waitForStoresPageLoad"/>
1418
<!--Create Website-->
15-
<fillField selector="{{AdminNewWebsiteSection.name}}" userInput="Second Website" stepKey="enterWebsiteName" />
16-
<fillField selector="{{AdminNewWebsiteSection.code}}" userInput="second_website" stepKey="enterWebsiteCode" />
19+
<fillField selector="{{AdminNewWebsiteSection.name}}" userInput="{{newWebsiteName}}" stepKey="enterWebsiteName" />
20+
<fillField selector="{{AdminNewWebsiteSection.code}}" userInput="{{websiteCode}}" stepKey="enterWebsiteCode" />
1721
<click selector="{{AdminNewWebsiteActionsSection.saveWebsite}}" stepKey="clickSaveWebsite" />
1822
<waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload"/>
1923
<see userInput="You saved the website." stepKey="seeSavedMessage" />

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminDeleteWebsiteActionGroup.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="AdminDeleteWebsiteActionGroup">
11+
<arguments>
12+
<argument name="websiteName" type="string"/>
13+
</arguments>
1114
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
1215
<click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/>
13-
<fillField userInput="Second Website" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillSearchWebsiteField"/>
16+
<fillField userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="fillSearchWebsiteField"/>
1417
<click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/>
15-
<see userInput="Second Website" selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="verifyThatCorrectWebsiteFound"/>
18+
<see userInput="{{websiteName}}" selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="verifyThatCorrectWebsiteFound"/>
1619
<click selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/>
1720
<waitForPageLoad stepKey="waitForStoreToLoad"/>
1821
<click selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="clickDeleteWebsiteButtonOnEditWebsitePage"/>

0 commit comments

Comments
 (0)