Skip to content

Commit 95a4321

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-92952' into 2.2-develop-mftf-pr3
2 parents 92cb7a2 + 1c67efd commit 95a4321

17 files changed

+227
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminProductCheckUnsupportedFileActionGroup">
12+
<arguments>
13+
<argument name="filename" type="string"/>
14+
</arguments>
15+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{filename}}" stepKey="attachImage"/>
16+
<waitForPageLoad stepKey="waitForUploadImage"/>
17+
<see selector="{{AdminConfirmationModalSection.message}}" userInput="We don't recognize or support this file extension type." stepKey="seeErrorMessage"/>
18+
<click selector="{{AdminProductImagesSection.modalOkBtn}}" stepKey="closeModal"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Magento_Category" parameterized="true">
1212
<section name="StorefrontProductPageSection"/>
1313
<section name="StorefrontProductAdditionalInformationSection"/>
14+
<section name="StorefrontProductMediaSection"/>
1415
</page>
1516
</pages>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<element name="checkbox" type="checkbox" selector="//div[contains(text(),'{{product}}')]/ancestor::tr[@class='data-row']//input[@class='admin__control-checkbox']" parameterized="true" />
2525
<element name="bulkActionOption" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-select-wrap')]//ul/li/span[text() = '{{label}}']" parameterized="true"/>
2626
<element name="productGridNameProduct" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
27+
<element name="adminImgGridThumbnail" type="text" selector="img.admin__control-thumbnail[src*='/{{var1}}']" parameterized="true"/>
2728
</section>
2829
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<element name="imageUploadButton" type="button" selector="div.image div.fileinput-button"/>
1515
<element name="imageFile" type="text" selector="//*[@id='media_gallery_content']//img[contains(@src, '{{url}}')]" parameterized="true"/>
1616
<element name="removeImageButton" type="button" selector=".action-remove"/>
17+
<element name="modalOkBtn" type="button" selector="button.action-primary.action-accept"/>
1718
<element name="uploadProgressBar" type="text" selector=".uploader .file-row"/>
1819
</section>
1920
</sections>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
<element name="CatalogDescription" type="text" selector="//div[@class='category-description']//p"/>
1919
<element name="mediaDescription" type="text" selector="img[alt='{{var1}}']" parameterized="true"/>
2020
<element name="productsList" type="text" selector="//ol[@class='products list items product-items']"/>
21+
<element name="categoryPageProductImagePlaceholderSmall" type="text" selector=".products-grid img[src*='placeholder/small_image.jpg']"/>
22+
<element name="categoryPageProductImage" type="text" selector=".products-grid img[src*='/{{var1}}']" parameterized="true"/>
2123
</section>
2224
</sections>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="StorefrontProductMediaSection">
12+
<element name="imageFile" type="text" selector=".product.media img[src*='{{filename}}']" parameterized="true"/>
13+
</section>
14+
</sections>
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminSimpleProductImagesTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Add/remove images and videos for all product types and category"/>
15+
<title value="Admin should be able to add images of different types and sizes to Simple Product"/>
16+
<description value="Admin should be able to add images of different types and sizes to Simple Product"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MAGETWO-76315"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="category"/>
24+
<createData entity="_defaultProduct" stepKey="firstProduct">
25+
<requiredEntity createDataKey="category"/>
26+
</createData>
27+
<createData entity="_defaultProduct" stepKey="secondProduct">
28+
<requiredEntity createDataKey="category"/>
29+
</createData>
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
</before>
32+
33+
<after>
34+
<deleteData createDataKey="category" stepKey="deletePreReqCategory"/>
35+
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
36+
<deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/>
37+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
38+
</after>
39+
40+
<!-- Go to the first product edit page -->
41+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/>
42+
<waitForPageLoad stepKey="wait1"/>
43+
<actionGroup ref="AdminResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid"/>
44+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProductOnBackend1">
45+
<argument name="product" value="$$firstProduct$$"/>
46+
</actionGroup>
47+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductOnBackend1">
48+
<argument name="product" value="$$firstProduct$$"/>
49+
</actionGroup>
50+
51+
<!-- Set url key -->
52+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
53+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$firstProduct.name$$" stepKey="fillUrlKey"/>
54+
55+
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages"/>
56+
57+
<!-- *.bmp is not allowed -->
58+
<actionGroup ref="AdminProductCheckUnsupportedFileActionGroup" stepKey="attachBmp">
59+
<argument name="filename" value="bmp.bmp"/>
60+
</actionGroup>
61+
62+
<!-- *.ico is not allowed -->
63+
<actionGroup ref="AdminProductCheckUnsupportedFileActionGroup" stepKey="attachIco">
64+
<argument name="filename" value="ico.ico"/>
65+
</actionGroup>
66+
67+
<!-- *.svg is not allowed -->
68+
<actionGroup ref="AdminProductCheckUnsupportedFileActionGroup" stepKey="attachSvg">
69+
<argument name="filename" value="svg.svg"/>
70+
</actionGroup>
71+
72+
73+
<!-- 0kb size is not allowed -->
74+
<actionGroup ref="AdminProductCheckUnsupportedFileActionGroup" stepKey="attachEmpty">
75+
<argument name="filename" value="empty.jpg"/>
76+
</actionGroup>
77+
78+
<!-- 1~ kb is allowed -->
79+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="small.jpg" stepKey="attachSmall"/>
80+
<waitForPageLoad stepKey="waitForUploadSmall"/>
81+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorSmall"/>
82+
83+
<!-- 1~ mb is allowed -->
84+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="medium.jpg" stepKey="attachMedium"/>
85+
<waitForPageLoad stepKey="waitForUploadMedium"/>
86+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorMedium"/>
87+
88+
<!-- 10~ mb is allowed -->
89+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="large.jpg" stepKey="attachLarge"/>
90+
<waitForPageLoad stepKey="waitForUploadLarge"/>
91+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorLarge"/>
92+
93+
<!-- *.gif is allowed -->
94+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="gif.gif" stepKey="attachGif"/>
95+
<waitForPageLoad stepKey="waitForUploadGif"/>
96+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorGif"/>
97+
98+
<!-- *.jpg is allowed -->
99+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="jpg.jpg" stepKey="attachJpg"/>
100+
<waitForPageLoad stepKey="waitForUploadJpg"/>
101+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorJpg"/>
102+
103+
<!-- *.png is allowed -->
104+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="png.png" stepKey="attachPng"/>
105+
<waitForPageLoad stepKey="waitForUploadPng"/>
106+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorPng"/>
107+
108+
<!-- Save the first product and go to the storefront -->
109+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
110+
<amOnPage url="{{StorefrontProductPage.url($$firstProduct.name$$)}}" stepKey="goToStorefront"/>
111+
<waitForPageLoad stepKey="waitForStorefront1"/>
112+
113+
<!-- See all of the images that we uploaded -->
114+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('small')}}" stepKey="seeSmall"/>
115+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('medium')}}" stepKey="seeMedium"/>
116+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge"/>
117+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('gif')}}" stepKey="seeGif"/>
118+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('jpg')}}" stepKey="seeJpg"/>
119+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('png')}}" stepKey="seePng"/>
120+
121+
<!-- Go to the category page and see a placeholder image for the second product -->
122+
<amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="goToCategoryPage"/>
123+
<seeElement selector="{{StorefrontCategoryMainSection.categoryPageProductImagePlaceholderSmall}}" stepKey="seePlaceholder"/>
124+
125+
<!-- Go to the second product edit page -->
126+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex2"/>
127+
<waitForPageLoad stepKey="wait2"/>
128+
<actionGroup ref="AdminResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid2"/>
129+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProductOnBackend2">
130+
<argument name="product" value="$$secondProduct$$"/>
131+
</actionGroup>
132+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductOnBackend2">
133+
<argument name="product" value="$$secondProduct$$"/>
134+
</actionGroup>
135+
136+
<!-- Upload an image -->
137+
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages2"/>
138+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="large.jpg" stepKey="attachLarge2"/>
139+
<waitForPageLoad stepKey="waitForUploadLarge2"/>
140+
<dontSeeElement selector="{{AdminConfirmationModalSection.message}}" stepKey="dontSeeErrorLarge2"/>
141+
142+
<!-- Set url key -->
143+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection2"/>
144+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$secondProduct.name$$" stepKey="fillUrlKey2"/>
145+
146+
<!-- Save the second product -->
147+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct2"/>
148+
149+
<!-- Go to the admin grid and see the uploaded image -->
150+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex3"/>
151+
<waitForPageLoad stepKey="wait3"/>
152+
<actionGroup ref="AdminResetProductGridToDefaultViewActionGroup" stepKey="resetProductGrid3"/>
153+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProductOnBackend3">
154+
<argument name="product" value="$$secondProduct$$"/>
155+
</actionGroup>
156+
<seeElement selector="{{AdminProductGridSection.adminImgGridThumbnail('large')}}" stepKey="seeImgInGrid"/>
157+
158+
<!-- Go to the category page and see the uploaded image -->
159+
<amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="goToCategoryPage2"/>
160+
<waitForPageLoad stepKey="waitForStorefront2"/>
161+
<seeElement selector="{{StorefrontCategoryMainSection.categoryPageProductImage('large')}}" stepKey="seeUploadedImg"/>
162+
163+
<!-- Go to the product page and see the uploaded image -->
164+
<amOnPage url="{{StorefrontProductPage.url($$secondProduct.name$$)}}" stepKey="goToStorefront2"/>
165+
<waitForPageLoad stepKey="waitForStorefront3"/>
166+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge2"/>
167+
</test>
168+
</tests>
1.66 MB
Binary file not shown.

dev/tests/acceptance/tests/_data/empty.jpg

Loading
213 KB
Loading

0 commit comments

Comments
 (0)