Skip to content

Commit c19e2d8

Browse files
committed
MC-191: Admin should be able to remove Product Images assigned as Base, Small and Thumbnail from Simple Product
1 parent 345823b commit c19e2d8

File tree

7 files changed

+155
-0
lines changed

7 files changed

+155
-0
lines changed
31.4 KB
Loading
16.2 KB
Loading
9.98 KB
Loading

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<element name="productGridRows" type="text" selector="table.data-grid tr.data-row"/>
1717
<element name="firstProductRow" type="text" selector="table.data-grid tr.data-row:first-of-type"/>
1818
<element name="productThumbnail" type="text" selector="table.data-grid tr:nth-child({{row}}) td.data-grid-thumbnail-cell > img" parameterized="true"/>
19+
<element name="productThumbnailBySrc" type="text" selector="img.admin__control-thumbnail[src*='{{pattern}}']" parameterized="true"/>
1920
<element name="productGridCell" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
2021
<element name="productGridHeaderCell" type="text" selector="//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]" parameterized="true"/>
2122
<element name="multicheckDropdown" type="button" selector="div[data-role='grid-wrapper'] th.data-grid-multicheck-cell button.action-multicheck-toggle"/>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,20 @@
1616
<element name="removeImageButton" type="button" selector=".action-remove"/>
1717
<element name="modalOkBtn" type="button" selector="button.action-primary.action-accept"/>
1818
<element name="uploadProgressBar" type="text" selector=".uploader .file-row"/>
19+
20+
<element name="nthProductImage" type="button" selector="#media_gallery_content > div:nth-child({{var}}) img.product-image" parameterized="true"/>
21+
<element name="nthRemoveImageBtn" type="button" selector="#media_gallery_content > div:nth-child({{var}}) button.action-remove" parameterized="true"/>
22+
23+
<element name="altText" type="textarea" selector="textarea[data-role='image-description']"/>
24+
25+
<element name="roleBase" type="button" selector="div.field-image-role ul li:nth-of-type(1) label"/>
26+
<element name="roleSmall" type="button" selector="div.field-image-role ul li:nth-of-type(2) label"/>
27+
<element name="roleThumbnail" type="button" selector="div.field-image-role ul li:nth-of-type(3) label"/>
28+
<element name="roleSwatch" type="button" selector="div.field-image-role ul li:nth-of-type(4) label"/>
29+
30+
<element name="isBaseSelected" type="button" selector="div.field-image-role ul li.selected:nth-of-type(1)"/>
31+
<element name="isSmallSelected" type="button" selector="div.field-image-role ul li.selected:nth-of-type(2)"/>
32+
<element name="isThumbnailSelected" type="button" selector="div.field-image-role ul li.selected:nth-of-type(3)"/>
33+
<element name="isSwatchSelected" type="button" selector="div.field-image-role ul li.selected:nth-of-type(4)"/>
1934
</section>
2035
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<element name="ProductTitleByName" type="button" selector="//main//li//a[contains(text(), '{{var1}}')]" parameterized="true"/>
1818
<element name="ProductPriceByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//span[@class='price']" parameterized="true"/>
1919
<element name="ProductImageByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/>
20+
<element name="ProductImageBySrc" type="text" selector=".products-grid img[src*='{{pattern}}']" parameterized="true"/>
2021
<element name="ProductInfoByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//div[@class='product-item-info']" parameterized="true"/>
2122
<element name="ProductAddToCompareByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//a[contains(@class, 'tocompare')]" parameterized="true"/>
2223
<element name="ProductImageByNameAndSrc" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[contains(@src, '{{src}}')]" parameterized="true"/>

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

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,142 @@
163163
<waitForPageLoad stepKey="waitForStorefront2"/>
164164
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge2"/>
165165
</test>
166+
167+
<test name="AdminSimpleProductRemoveImagesTest">
168+
<annotations>
169+
<features value="Catalog"/>
170+
<stories value="Add/remove images and videos for all product types and category"/>
171+
<title value="Admin should be able to remove Product Images assigned as Base, Small and Thumbnail from Simple Product"/>
172+
<description value="Admin should be able to remove Product Images assigned as Base, Small and Thumbnail from Simple Product"/>
173+
<severity value="CRITICAL"/>
174+
<testCaseId value="MC-191"/>
175+
<group value="Catalog"/>
176+
</annotations>
177+
178+
<before>
179+
<createData entity="_defaultCategory" stepKey="category"/>
180+
<createData entity="_defaultProduct" stepKey="product">
181+
<requiredEntity createDataKey="category"/>
182+
</createData>
183+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
184+
</before>
185+
186+
<after>
187+
<deleteData createDataKey="category" stepKey="deletePreReqCategory"/>
188+
<deleteData createDataKey="product" stepKey="deleteProduct"/>
189+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
190+
</after>
191+
192+
<!-- Go to the product edit page -->
193+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/>
194+
<waitForPageLoad stepKey="wait1"/>
195+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/>
196+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku">
197+
<argument name="product" value="$$product$$"/>
198+
</actionGroup>
199+
<actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProduct"/>
200+
201+
<!-- Set url key -->
202+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
203+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$product.name$$" stepKey="fillUrlKey"/>
204+
205+
<!-- Expand images section -->
206+
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages"/>
207+
208+
<!-- Upload and set Base image -->
209+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="adobe-base.jpg" stepKey="attach1"/>
210+
<waitForPageLoad stepKey="waitForUpload1"/>
211+
<click selector="{{AdminProductImagesSection.nthProductImage('1')}}" stepKey="openImageDetails1"/>
212+
<waitForPageLoad stepKey="waitForSlideout1"/>
213+
<conditionalClick selector="{{AdminProductImagesSection.roleBase}}" dependentSelector="{{AdminProductImagesSection.isBaseSelected}}" visible="false" stepKey="base1"/>
214+
<conditionalClick selector="{{AdminProductImagesSection.roleSmall}}" dependentSelector="{{AdminProductImagesSection.isSmallSelected}}" visible="true" stepKey="small1"/>
215+
<conditionalClick selector="{{AdminProductImagesSection.roleThumbnail}}" dependentSelector="{{AdminProductImagesSection.isThumbnailSelected}}" visible="true" stepKey="thumbnail1"/>
216+
<conditionalClick selector="{{AdminProductImagesSection.roleSwatch}}" dependentSelector="{{AdminProductImagesSection.isSwatchSelected}}" visible="true" stepKey="swatch1"/>
217+
<pressKey selector="{{AdminProductImagesSection.altText}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ESCAPE]" stepKey="pressEsc1"/>
218+
<waitForPageLoad stepKey="waitForHide1"/>
219+
220+
<!-- Upload and set Small image -->
221+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="adobe-small.jpg" stepKey="attach2"/>
222+
<waitForPageLoad stepKey="waitForUpload2"/>
223+
<click selector="{{AdminProductImagesSection.nthProductImage('2')}}" stepKey="openImageDetails2"/>
224+
<waitForPageLoad stepKey="waitForSlideout2"/>
225+
<conditionalClick selector="{{AdminProductImagesSection.roleBase}}" dependentSelector="{{AdminProductImagesSection.isBaseSelected}}" visible="true" stepKey="base2"/>
226+
<conditionalClick selector="{{AdminProductImagesSection.roleSmall}}" dependentSelector="{{AdminProductImagesSection.isSmallSelected}}" visible="false" stepKey="small2"/>
227+
<conditionalClick selector="{{AdminProductImagesSection.roleThumbnail}}" dependentSelector="{{AdminProductImagesSection.isThumbnailSelected}}" visible="true" stepKey="thumbnail2"/>
228+
<conditionalClick selector="{{AdminProductImagesSection.roleSwatch}}" dependentSelector="{{AdminProductImagesSection.isSwatchSelected}}" visible="true" stepKey="swatch2"/>
229+
<pressKey selector="{{AdminProductImagesSection.altText}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ESCAPE]" stepKey="pressEsc2"/>
230+
<waitForPageLoad stepKey="waitForHide2"/>
231+
232+
<!-- Upload and set Thumbnail image -->
233+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="adobe-thumb.jpg" stepKey="attach3"/>
234+
<waitForPageLoad stepKey="waitForUpload3"/>
235+
<click selector="{{AdminProductImagesSection.nthProductImage('3')}}" stepKey="openImageDetails3"/>
236+
<waitForPageLoad stepKey="waitForSlideout3"/>
237+
<conditionalClick selector="{{AdminProductImagesSection.roleBase}}" dependentSelector="{{AdminProductImagesSection.isBaseSelected}}" visible="true" stepKey="base3"/>
238+
<conditionalClick selector="{{AdminProductImagesSection.roleSmall}}" dependentSelector="{{AdminProductImagesSection.isSmallSelected}}" visible="true" stepKey="small3"/>
239+
<conditionalClick selector="{{AdminProductImagesSection.roleThumbnail}}" dependentSelector="{{AdminProductImagesSection.isThumbnailSelected}}" visible="false" stepKey="thumbnail3"/>
240+
<conditionalClick selector="{{AdminProductImagesSection.roleSwatch}}" dependentSelector="{{AdminProductImagesSection.isSwatchSelected}}" visible="true" stepKey="swatch3"/>
241+
<pressKey selector="{{AdminProductImagesSection.altText}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ESCAPE]" stepKey="pressEsc3"/>
242+
<waitForPageLoad stepKey="waitForHide3"/>
243+
244+
<!-- Save the product with all 3 images -->
245+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
246+
247+
<!-- Go to the admin grid and see the Thumbnail image -->
248+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex2"/>
249+
<waitForPageLoad stepKey="wait2"/>
250+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid2"/>
251+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2">
252+
<argument name="product" value="$$product$$"/>
253+
</actionGroup>
254+
<seeElement selector="{{AdminProductGridSection.productThumbnailBySrc('/adobe-thumb')}}" stepKey="seeBaseInGrid"/>
255+
256+
<!-- Go to the category page and see the Small image -->
257+
<amOnPage url="$$category.name$$.html" stepKey="goToCategoryPage"/>
258+
<waitForPageLoad stepKey="wait3"/>
259+
<seeElement selector="{{StorefrontCategoryProductSection.ProductImageBySrc('/adobe-small')}}" stepKey="seeThumb"/>
260+
261+
<!-- Go to the product page and see the Base image -->
262+
<amOnPage url="$$product.name$$.html" stepKey="goToProductPage"/>
263+
<waitForPageLoad stepKey="wait4"/>
264+
<seeElement selector="{{StorefrontProductMediaSection.imageFile('/adobe-base')}}" stepKey="seeBase"/>
265+
266+
<!-- Go to the product edit page again -->
267+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex3"/>
268+
<waitForPageLoad stepKey="wait5"/>
269+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid3"/>
270+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku3">
271+
<argument name="product" value="$$product$$"/>
272+
</actionGroup>
273+
<actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProduct3"/>
274+
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages2"/>
275+
276+
<!-- Remove all images -->
277+
<click selector="{{AdminProductImagesSection.nthRemoveImageBtn('1')}}" stepKey="removeImage1"/>
278+
<click selector="{{AdminProductImagesSection.nthRemoveImageBtn('2')}}" stepKey="removeImage2"/>
279+
<click selector="{{AdminProductImagesSection.nthRemoveImageBtn('3')}}" stepKey="removeImage3"/>
280+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct2"/>
281+
282+
<!-- Check admin grid for placeholder -->
283+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex4"/>
284+
<waitForPageLoad stepKey="wait6"/>
285+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid4"/>
286+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku4">
287+
<argument name="product" value="$$product$$"/>
288+
</actionGroup>
289+
<dontSeeElement selector="{{AdminProductGridSection.productThumbnailBySrc('/adobe-thumb')}}" stepKey="dontSeeBaseInGrid"/>
290+
<seeElement selector="{{AdminProductGridSection.productThumbnailBySrc('/placeholder/thumbnail')}}" stepKey="seePlaceholderThumb"/>
291+
292+
<!-- Check category page for placeholder -->
293+
<amOnPage url="$$category.name$$.html" stepKey="goToCategoryPage2"/>
294+
<waitForPageLoad stepKey="wait7"/>
295+
<dontSeeElement selector="{{StorefrontCategoryProductSection.ProductImageBySrc('/adobe-small')}}" stepKey="dontSeeThumb"/>
296+
<seeElement selector="{{StorefrontCategoryProductSection.ProductImageBySrc('placeholder/small_image')}}" stepKey="seePlaceholderSmall"/>
297+
298+
<!-- Check product page for placeholder -->
299+
<amOnPage url="$$product.name$$.html" stepKey="goToProductPage2"/>
300+
<waitForPageLoad stepKey="wait8"/>
301+
<dontSeeElement selector="{{StorefrontProductMediaSection.imageFile('/adobe-base')}}" stepKey="dontSeeBase"/>
302+
<seeElement selector="{{StorefrontProductMediaSection.imageFile('placeholder/image')}}" stepKey="seePlaceholderBase"/>
303+
</test>
166304
</tests>

0 commit comments

Comments
 (0)