Skip to content

Commit 9769d5c

Browse files
committed
MC-189: Admin should be able to add images of different types and sizes to Simple Product
- Fix code review feedback
1 parent bbcbccd commit 9769d5c

File tree

1 file changed

+59
-11
lines changed

1 file changed

+59
-11
lines changed

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

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,35 @@
2020
</annotations>
2121

2222
<before>
23-
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
24-
<createData entity="_defaultProduct" stepKey="createPreReqProduct">
25-
<requiredEntity createDataKey="createPreReqCategory"/>
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"/>
2629
</createData>
2730
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2831
</before>
2932

3033
<after>
31-
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
32-
<deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/>
34+
<deleteData createDataKey="category" stepKey="deletePreReqCategory"/>
35+
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
36+
<deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/>
3337
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
3438
</after>
3539

36-
<!-- Go to the product edit page of the product that was created in the before block -->
40+
<!-- Go to the first product edit page -->
3741
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/>
3842
<waitForPageLoad stepKey="wait1"/>
3943
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/>
4044
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku">
41-
<argument name="product" value="_defaultProduct"/>
45+
<argument name="product" value="$$firstProduct$$"/>
4246
</actionGroup>
4347
<actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid"/>
4448

45-
<!-- Set url key so that we can go to this product later -->
49+
<!-- Set url key -->
4650
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
47-
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{_defaultProduct.urlKey}}" stepKey="fillUrlKey"/>
51+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$firstProduct.name$$" stepKey="fillUrlKey"/>
4852

4953
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages"/>
5054

@@ -102,9 +106,9 @@
102106
<waitForPageLoad stepKey="waitForUploadPng"/>
103107
<dontSeeElement selector="{{AdminProductMessagesSection.errorMessage}}" stepKey="dontSeeErrorPng"/>
104108

105-
<!-- Save the product and go to the storefront -->
109+
<!-- Save the first product and go to the storefront -->
106110
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
107-
<amOnPage url="{{_defaultProduct.urlkey}}.html" stepKey="goToStorefront"/>
111+
<amOnPage url="$$firstProduct.name$$.html" stepKey="goToStorefront"/>
108112
<waitForPageLoad stepKey="waitForStorefront"/>
109113

110114
<!-- See all of the images that we uploaded -->
@@ -114,5 +118,49 @@
114118
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('gif')}}" stepKey="seeGif"/>
115119
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('jpg')}}" stepKey="seeJpg"/>
116120
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('png')}}" stepKey="seePng"/>
121+
122+
<!-- Go to the category page and see a placeholder image for the second product -->
123+
<amOnPage url="$$category.name$$.html" stepKey="goToCategoryPage"/>
124+
<seeElement selector=".products-grid img[src*='placeholder/small_image.jpg']" stepKey="seePlaceholder"/>
125+
126+
<!-- Go to the second product edit page -->
127+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex2"/>
128+
<waitForPageLoad stepKey="wait2"/>
129+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid2"/>
130+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2">
131+
<argument name="product" value="$$secondProduct$$"/>
132+
</actionGroup>
133+
<actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openProducForEditByClickingRow1Column2InProductGrid2"/>
134+
135+
<!-- Upload an image -->
136+
<click selector="{{AdminProductImagesSection.productImagesToggle}}" stepKey="expandImages2"/>
137+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="large.jpg" stepKey="attachLarge2"/>
138+
<waitForPageLoad stepKey="waitForUploadLarge2"/>
139+
<dontSeeElement selector="{{AdminProductMessagesSection.errorMessage}}" stepKey="dontSeeErrorLarge2"/>
140+
141+
<!-- Set url key -->
142+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection2"/>
143+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="$$secondProduct.name$$" stepKey="fillUrlKey2"/>
144+
145+
<!-- Save the second product -->
146+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct2"/>
147+
148+
<!-- Go to the admin grid and see the uploaded image -->
149+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex3"/>
150+
<waitForPageLoad stepKey="wait3"/>
151+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid3"/>
152+
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku3">
153+
<argument name="product" value="$$secondProduct$$"/>
154+
</actionGroup>
155+
<seeElement selector="img.admin__control-thumbnail[src*='/large']" stepKey="seeImgInGrid"/>
156+
157+
<!-- Go to the category page and see the uploaded image -->
158+
<amOnPage url="$$category.name$$.html" stepKey="goToCategoryPage2"/>
159+
<seeElement selector=".products-grid img[src*='/large']" stepKey="seeUploadedImg"/>
160+
161+
<!-- Go to the product page and see the uploaded image -->
162+
<amOnPage url="$$secondProduct.name$$.html" stepKey="goToStorefront2"/>
163+
<waitForPageLoad stepKey="waitForStorefront2"/>
164+
<seeElementInDOM selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge2"/>
117165
</test>
118166
</tests>

0 commit comments

Comments
 (0)