Skip to content

Commit 0eb435b

Browse files
MAGETWO-66442: Changes in default scope not effect product images in other scopes
- Add automated test
1 parent 11cd40e commit 0eb435b

File tree

5 files changed

+168
-2
lines changed

5 files changed

+168
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,30 @@
196196
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/>
197197
<waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/>
198198
</actionGroup>
199+
200+
<!--Select Product In Websites-->
201+
<actionGroup name="SelectProductInWebsitesActionGroup">
202+
<arguments>
203+
<argument name="website" type="string"/>
204+
</arguments>
205+
<scrollTo selector="{{CreateProductSection.productInWebsite}}" stepKey="ScrollToWebsites"/>
206+
<click selector="{{CreateProductSection.productInWebsite}}" stepKey="ClickTpOpenProductInWebsite"/>
207+
<waitForPageLoad stepKey="waitForPageOpened"/>
208+
<click selector="{{CreateProductSection.isSelected(website)}}" stepKey="SelectWebsite"/>
209+
<click selector="{{CreateProductSection.saveButton}}" stepKey="clickSaveProduct"/>
210+
</actionGroup>
211+
212+
<!--Switch to New Store view-->
213+
<actionGroup name="SwitchToTheNewStoreView">
214+
<arguments>
215+
<argument name="storeViewName" type="string"/>
216+
</arguments>
217+
<scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/>
218+
<waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/>
219+
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
220+
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/>
221+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
222+
<waitForPageLoad stepKey="waitForPageLoad"/>
223+
</actionGroup>
224+
199225
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductContentSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="sectionHeader" type="button" selector="div[data-index='content']" timeout="30"/>
1313
<element name="descriptionTextArea" type="textarea" selector="#product_form_description"/>
1414
<element name="shortDescriptionTextArea" type="textarea" selector="#product_form_short_description"/>
15+
<element name="pageHeader" type="textarea" selector="//*[@class='page-header row']"/>
1516
</section>
1617
</sections>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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="AdminRemoveImageAffectsAllScopesTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="MAGETWO-66442: Changes in default scope not effect product images in other scopes"/>
15+
<title value="Effect of product images changes in default scope to other scopes"/>
16+
<description value="Product image should be deleted from all scopes"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-94265"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<!--Create 2 websites (with stores, store views)-->
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<createData entity="_defaultCategory" stepKey="category"/>
25+
<createData entity="_defaultProduct" stepKey="product">
26+
<requiredEntity createDataKey="category"/>
27+
</createData>
28+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
29+
<argument name="newWebsiteName" value="FirstWebSite"/>
30+
<argument name="websiteCode" value="FirstWebSiteCode"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore" after="createWebsite">
33+
<argument name="website" value="FirstWebSite"/>
34+
<argument name="storeGroupName" value="NewStore"/>
35+
<argument name="storeGroupCode" value="Base1"/>
36+
</actionGroup>
37+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView" after="createNewStore">
38+
<argument name="StoreGroup" value="staticFirstStoreGroup"/>
39+
<argument name="customStore" value="staticStore"/>
40+
</actionGroup>
41+
42+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite" after="createCustomStoreView">
43+
<argument name="newWebsiteName" value="SecondWebSite"/>
44+
<argument name="websiteCode" value="SecondWebSiteCode"/>
45+
</actionGroup>
46+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStore" after="createSecondWebsite">
47+
<argument name="website" value="SecondWebSite"/>
48+
<argument name="storeGroupName" value="SecondStore"/>
49+
<argument name="storeGroupCode" value="Base2"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView2" after="createSecondStore">
52+
<argument name="StoreGroup" value="staticStoreGroup"/>
53+
<argument name="customStore" value="staticSecondStore"/>
54+
</actionGroup>
55+
</before>
56+
57+
<after>
58+
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
59+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
60+
<argument name="websiteName" value="FirstWebSite"/>
61+
</actionGroup>
62+
63+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
64+
<argument name="websiteName" value="SecondWebSite"/>
65+
</actionGroup>
66+
<deleteData createDataKey="category" stepKey="deletePreReqCategory"/>
67+
<deleteData createDataKey="product" stepKey="deleteFirstProduct"/>
68+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
69+
</after>
70+
71+
<!--Create product-->
72+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
73+
<waitForPageLoad stepKey="waitForProductIndexPage"/>
74+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/>
75+
76+
<!--Open created product-->
77+
<click selector="{{AdminProductGridSection.productGridNameProduct($$product.name$$)}}" stepKey="createdProduct"/>
78+
<waitForPageLoad stepKey="waitForOpenedCreatedProduct"/>
79+
80+
<!-- Add image to product -->
81+
<actionGroup ref="addProductImage" stepKey="addFirstImageForProduct">
82+
<argument name="image" value="TestImageNew"/>
83+
</actionGroup>
84+
85+
<!-- Add second image to product -->
86+
<actionGroup ref="addProductImage" stepKey="addSecondImageForProduct">
87+
<argument name="image" value="MagentoLogo"/>
88+
</actionGroup>
89+
90+
<!--"Product in Websites": select both Websites-->
91+
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectFirstWebsite">
92+
<argument name="website" value="FirstWebSite"/>
93+
</actionGroup>
94+
95+
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectSecondWebsite">
96+
<argument name="website" value="SecondWebSite"/>
97+
</actionGroup>
98+
99+
<!--Go to "Catalog" -> "Products". Open created product-->
100+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductPage"/>
101+
<waitForPageLoad stepKey="waitForProductPageLoaded"/>
102+
<click selector="{{AdminProductGridSection.productGridNameProduct($$product.name$$)}}" stepKey="openCreatedProduct"/>
103+
<waitForPageLoad stepKey="waitForCreatedProductOpened"/>
104+
105+
<!--Delete Image 1-->
106+
<actionGroup ref="removeProductImage" stepKey="removeProductImage"/>
107+
108+
<!--Click "Save" in the upper right corner-->
109+
<actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/>
110+
111+
<!--Switch to "Store view 1"-->
112+
<actionGroup ref="SwitchToTheNewStoreView" stepKey="selectStoreView">
113+
<argument name="storeViewName" value="Store View"/>
114+
</actionGroup>
115+
116+
<!-- Assert product first image not in admin product form -->
117+
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage">
118+
<argument name="image" value="TestImageNew"/>
119+
</actionGroup>
120+
121+
<!--Switch to "Store view 2"-->
122+
<actionGroup ref="SwitchToTheNewStoreView" stepKey="selectSecondStoreView">
123+
<argument name="storeViewName" value="Second Store View"/>
124+
</actionGroup>
125+
126+
<!-- Verify that Image 1 is deleted from the Second Store View list -->
127+
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInSecondStoreViewPage">
128+
<argument name="image" value="TestImageNew"/>
129+
</actionGroup>
130+
</test>
131+
</tests>

app/code/Magento/Store/Test/Mftf/Data/StoreData.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@
4141
</entity>
4242
<entity name="staticStore" type="store">
4343
<!--data key="group_id">customStoreGroup.id</data-->
44-
<data key="name" >Second Store View</data>
45-
<data key="code" >store123</data>
44+
<data key="name">Second Store View</data>
45+
<data key="code">store123</data>
4646
<data key="is_active">1</data>
4747
<data key="store_id">null</data>
4848
<data key="store_action">add</data>
4949
<data key="store_type">group</data>
5050
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
5151
</entity>
52+
<entity name="staticSecondStore" extends="staticStore">
53+
<data key="name">Store View</data>
54+
<data key="code">store2</data>
55+
</entity>
5256
</entities>

app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@
2727
<data key="root_category_id">2</data>
2828
<data key="website_id">1</data>
2929
</entity>
30+
<entity name="staticFirstStoreGroup" extends="staticStoreGroup">
31+
<data key="name">NewStore</data>
32+
<data key="code">Base1</data>
33+
</entity>
3034
</entities>

0 commit comments

Comments
 (0)