|
| 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> |
0 commit comments