|
| 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="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminExportImportConfigurableProductWithImagesTest"> |
| 12 | + <annotations> |
| 13 | + <features value="ConfigurableProduct"/> |
| 14 | + <stories value="Export/Import products"/> |
| 15 | + <title value="Check importing of configurable products with images present in filesystem"/> |
| 16 | + <description value="Check importing of configurable products with images present in filesystem"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-11557"/> |
| 19 | + <group value="configurable_product"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create sample data: |
| 23 | + 1. Create simple products --> |
| 24 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 25 | + <createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct"/> |
| 26 | + <createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/> |
| 27 | + |
| 28 | + <!-- 2. Create Downloadable product --> |
| 29 | + <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> |
| 30 | + <createData entity="ApiDownloadableLink" stepKey="addFirstDownloadableLink"> |
| 31 | + <requiredEntity createDataKey="createDownloadableProduct"/> |
| 32 | + </createData> |
| 33 | + <createData entity="ApiDownloadableLink" stepKey="addSecondDownloadableLink"> |
| 34 | + <requiredEntity createDataKey="createDownloadableProduct"/> |
| 35 | + </createData> |
| 36 | + |
| 37 | + <!-- 3. Create Grouped product --> |
| 38 | + <createData entity="ApiGroupedProduct" stepKey="createGroupedProduct"/> |
| 39 | + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> |
| 40 | + <requiredEntity createDataKey="createGroupedProduct"/> |
| 41 | + <requiredEntity createDataKey="createFirstSimpleProduct"/> |
| 42 | + </createData> |
| 43 | + |
| 44 | + <!-- 4. Create configurable product with images --> |
| 45 | + <createData entity="CategoryExportImport" stepKey="createExportImportCategory"/> |
| 46 | + <createData entity="ApiConfigurableExportImportProduct" stepKey="createExportImportConfigurableProduct"> |
| 47 | + <requiredEntity createDataKey="createExportImportCategory"/> |
| 48 | + </createData> |
| 49 | + <createData entity="ApiProductAttributeMediaGalleryForExportImport" stepKey="createConfigurableProductWithImage"> |
| 50 | + <requiredEntity createDataKey="createExportImportConfigurableProduct"/> |
| 51 | + </createData> |
| 52 | + <createData entity="ProductAttributeWithTwoOptionsForExportImport" stepKey="createExportImportConfigurableProductAttribute"/> |
| 53 | + <createData entity="ProductAttributeOptionOneForExportImport" stepKey="createExportImportConfigurableProductAttributeFirstOption"> |
| 54 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 55 | + </createData> |
| 56 | + <createData entity="ProductAttributeOptionTwoForExportImport" stepKey="createExportImportConfigurableProductAttributeSecondOption"> |
| 57 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 58 | + </createData> |
| 59 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 60 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 61 | + </createData> |
| 62 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeFirstOption"> |
| 63 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 64 | + </getData> |
| 65 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeSecondOption"> |
| 66 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 67 | + </getData> |
| 68 | + <createData entity="ApiSimpleOneExportImport" stepKey="createConfigFirstChildProduct"> |
| 69 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 70 | + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> |
| 71 | + </createData> |
| 72 | + <createData entity="ApiProductAttributeMediaGalleryForExportImport" stepKey="addImageForFirstSimpleProduct"> |
| 73 | + <requiredEntity createDataKey="createConfigFirstChildProduct"/> |
| 74 | + </createData> |
| 75 | + <createData entity="ApiSimpleTwoExportImport" stepKey="createConfigSecondChildProduct"> |
| 76 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 77 | + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> |
| 78 | + </createData> |
| 79 | + <createData entity="ApiProductAttributeMediaGalleryEntryTestImage" stepKey="addImageForSecondSimpleProduct"> |
| 80 | + <requiredEntity createDataKey="createConfigSecondChildProduct"/> |
| 81 | + </createData> |
| 82 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createExportImportConfigurableProductTwoOption"> |
| 83 | + <requiredEntity createDataKey="createExportImportConfigurableProduct"/> |
| 84 | + <requiredEntity createDataKey="createExportImportConfigurableProductAttribute"/> |
| 85 | + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> |
| 86 | + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> |
| 87 | + </createData> |
| 88 | + <createData entity="ConfigurableProductAddChild" stepKey="addFirstExportImportConfigurableProductChild"> |
| 89 | + <requiredEntity createDataKey="createExportImportConfigurableProduct"/> |
| 90 | + <requiredEntity createDataKey="createConfigFirstChildProduct"/> |
| 91 | + </createData> |
| 92 | + <createData entity="ConfigurableProductAddChild" stepKey="addSecondExportImportConfigurableProductChild"> |
| 93 | + <requiredEntity createDataKey="createExportImportConfigurableProduct"/> |
| 94 | + <requiredEntity createDataKey="createConfigSecondChildProduct"/> |
| 95 | + </createData> |
| 96 | + |
| 97 | + <!-- 5. Create configurable product --> |
| 98 | + <createData entity="ApiConfigurableProduct" stepKey="createConfigurableProduct"> |
| 99 | + <requiredEntity createDataKey="createCategory"/> |
| 100 | + </createData> |
| 101 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttr"/> |
| 102 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption"> |
| 103 | + <requiredEntity createDataKey="createConfigProductAttr"/> |
| 104 | + </createData> |
| 105 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttrSet"> |
| 106 | + <requiredEntity createDataKey="createConfigProductAttr"/> |
| 107 | + </createData> |
| 108 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption"> |
| 109 | + <requiredEntity createDataKey="createConfigProductAttr"/> |
| 110 | + </getData> |
| 111 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct"> |
| 112 | + <requiredEntity createDataKey="createConfigProductAttr"/> |
| 113 | + <requiredEntity createDataKey="getConfigAttributeOption"/> |
| 114 | + <requiredEntity createDataKey="createCategory"/> |
| 115 | + </createData> |
| 116 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 117 | + <requiredEntity createDataKey="createConfigurableProduct"/> |
| 118 | + <requiredEntity createDataKey="createConfigProductAttr"/> |
| 119 | + <requiredEntity createDataKey="getConfigAttributeOption"/> |
| 120 | + </createData> |
| 121 | + <createData entity="ConfigurableProductAddChild" stepKey="addConfigurableProductChild"> |
| 122 | + <requiredEntity createDataKey="createConfigurableProduct"/> |
| 123 | + <requiredEntity createDataKey="createConfigChildProduct"/> |
| 124 | + </createData> |
| 125 | + |
| 126 | + <!-- Login as admin --> |
| 127 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 128 | + <actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/> |
| 129 | + </before> |
| 130 | + <after> |
| 131 | + <!-- Delete created data --> |
| 132 | + <deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFisrtSimpleProduct"/> |
| 133 | + <deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/> |
| 134 | + <deleteData createDataKey="createDownloadableProduct" stepKey="deleteDownloadableProduct"/> |
| 135 | + <deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/> |
| 136 | + <deleteData createDataKey="createExportImportConfigurableProduct" stepKey="deleteConfigProduct"/> |
| 137 | + <deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteConfigFirstChildProduct"/> |
| 138 | + <deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/> |
| 139 | + <deleteData createDataKey="createExportImportConfigurableProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 140 | + <deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigurableProduct"/> |
| 141 | + <deleteData createDataKey="createConfigChildProduct" stepKey="deleteConfigChildProduct"/> |
| 142 | + <deleteData createDataKey="createConfigProductAttr" stepKey="deleteConfigProductAttr"/> |
| 143 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 144 | + <deleteData createDataKey="createExportImportCategory" stepKey="deleteExportImportCategory"/> |
| 145 | + |
| 146 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> |
| 147 | + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> |
| 148 | + <!-- Admin logout--> |
| 149 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 150 | + </after> |
| 151 | + |
| 152 | + <!-- Go to System > Export --> |
| 153 | + <amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/> |
| 154 | + |
| 155 | + <!-- Set Export Settings: Entity Type > Products, SKU > ConfProd's sku and press "Continue" --> |
| 156 | + <actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku"> |
| 157 | + <argument name="attribute" value="sku"/> |
| 158 | + <argument name="attributeData" value="$$createExportImportConfigurableProduct.sku$$"/> |
| 159 | + </actionGroup> |
| 160 | + |
| 161 | + <!-- Run cron twice --> |
| 162 | + <magentoCLI command="cron:run" stepKey="runCronFirstTime"/> |
| 163 | + <magentoCLI command="cron:run" stepKey="runCronSecondTime"/> |
| 164 | + |
| 165 | + <!-- Save exported file: file successfully downloaded --> |
| 166 | + <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> |
| 167 | + <argument name="rowIndex" value="0"/> |
| 168 | + </actionGroup> |
| 169 | + |
| 170 | + <!-- Go to Catalog > Products. Find ConfProd and delete it --> |
| 171 | + <actionGroup ref="deleteProductBySku" stepKey="deleteConfigurableProductBySku"> |
| 172 | + <argument name="sku" value="$$createExportImportConfigurableProduct.sku$$"/> |
| 173 | + </actionGroup> |
| 174 | + |
| 175 | + <!-- Go to System > Import. Set import settings: Entity Type > Product, Import Behavior > Add/Update, |
| 176 | + Select File to Import > previously exported file and press "Check Data" --> |
| 177 | + <actionGroup ref="AdminImportProductsActionGroup" stepKey="adminImportProduct"> |
| 178 | + <argument name="behavior" value="Add/Update"/> |
| 179 | + <argument name="importFile" value="export_import_configurable_product.csv"/> |
| 180 | + <argument name="importMessage" value="Created: 1, Updated: 0, Deleted: 0"/> |
| 181 | + </actionGroup> |
| 182 | + |
| 183 | + <!-- Go to Catalog > Products: Configurable product exists --> |
| 184 | + <actionGroup ref="filterAndSelectProduct" stepKey="openConfigurableProduct"> |
| 185 | + <argument name="productSku" value="$$createExportImportConfigurableProduct.sku$$"/> |
| 186 | + </actionGroup> |
| 187 | + |
| 188 | + <!-- Go to "Configurations" section: configurations exist and have images --> |
| 189 | + <seeNumberOfElements selector="{{AdminProductFormConfigurationsSection.currentVariationsRows}}" userInput="2" stepKey="seeNumberOfRows"/> |
| 190 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigFirstChildProduct.name$$" stepKey="seeFirstProductNameInField"/> |
| 191 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="$$createConfigSecondChildProduct.name$$" stepKey="seeSecondProductNameInField"/> |
| 192 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="$$createConfigFirstChildProduct.sku$$" stepKey="seeFirstProductSkuInField"/> |
| 193 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="$$createConfigSecondChildProduct.sku$$" stepKey="seeSecondProductSkuInField"/> |
| 194 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="$$createConfigFirstChildProduct.price$$" stepKey="seeFirstProductPriceInField"/> |
| 195 | + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="$$createConfigSecondChildProduct.price$$" stepKey="seeSecondProductPriceInField"/> |
| 196 | + <seeElement selector="{{AdminProductFormConfigurationsSection.variationImageSource(MagentoLogo.fileName)}}" stepKey="seeFirstProductImageInField"/> |
| 197 | + <seeElement selector="{{AdminProductFormConfigurationsSection.variationImageSource(TestImage.fileName)}}" stepKey="seeSecondProductImageInField"/> |
| 198 | + |
| 199 | + <!-- Go to "Images and Videos" section: assert image --> |
| 200 | + <scrollTo selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" stepKey="scrollToProductGalleryTab"/> |
| 201 | + <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"> |
| 202 | + <argument name="image" value="MagentoLogo"/> |
| 203 | + </actionGroup> |
| 204 | + |
| 205 | + <!-- Go to any ConfProd's configuration page: Product page open successfully --> |
| 206 | + <click selector="{{AdminProductFormConfigurationsSection.variationProductLinkByName($$createConfigFirstChildProduct.name$$)}}" stepKey="clickOnFirstProductLink"/> |
| 207 | + <switchToNextTab stepKey="switchToConfigChildProductPage"/> |
| 208 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 209 | + <!-- Go to "Images and Videos" section: assert image --> |
| 210 | + <scrollTo selector="{{AdminProductFormConfigurationsSection.sectionHeader}}" stepKey="scrollToChildProductGalleryTab"/> |
| 211 | + <actionGroup ref="assertProductImageAdminProductPage" stepKey="assertChildProductImageAdminProductPage"> |
| 212 | + <argument name="image" value="MagentoLogo"/> |
| 213 | + </actionGroup> |
| 214 | + <closeTab stepKey="closeConfigChildProductPage"/> |
| 215 | + </test> |
| 216 | +</tests> |
0 commit comments