|
| 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="AdminConfigureProductImagePlaceholderTest"> |
| 12 | + |
| 13 | + <annotations> |
| 14 | + <features value="Configuration"/> |
| 15 | + <stories value="Configure product placeholder images"/> |
| 16 | + <title value="Admin is able to configure product placeholder images"/> |
| 17 | + <description value="Admin should be able to configure the images used for product image placeholders. The configured placeholders should be seen on the frontend when an image has no image."/> |
| 18 | + <severity value="MAJOR"/> |
| 19 | + <testCaseId value="MC-5005"/> |
| 20 | + <group value="configuration"/> |
| 21 | + </annotations> |
| 22 | + |
| 23 | + <before> |
| 24 | + <createData entity="ApiCategory" stepKey="category"/> |
| 25 | + <!--Create product with no images--> |
| 26 | + <createData entity="ApiSimpleProduct" stepKey="productNoImages"> |
| 27 | + <requiredEntity createDataKey="category"/> |
| 28 | + </createData> |
| 29 | + <!--Create product with small, base, and thumbnail image--> |
| 30 | + <createData entity="ApiSimpleProduct" stepKey="productWithImages"> |
| 31 | + <requiredEntity createDataKey="category"/> |
| 32 | + </createData> |
| 33 | + <createData entity="ApiProductAttributeMediaGalleryEntryTestImage" stepKey="productImage"> |
| 34 | + <requiredEntity createDataKey="productWithImages"/> |
| 35 | + </createData> |
| 36 | + </before> |
| 37 | + |
| 38 | + <after> |
| 39 | + <!--Unset product image placeholders--> |
| 40 | + <amOnPage url="{{CatalogConfigPage.url}}" stepKey="goToCatalogConfigurationPageAfter"/> |
| 41 | + <waitForPageLoad stepKey="waitForConfigurationPageLoadAfter"/> |
| 42 | + <conditionalClick selector="{{AdminProductImagePlaceholderConfigSection.sectionHeader}}" dependentSelector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" visible="false" stepKey="openPlaceholderSectionAfter"/> |
| 43 | + <waitForElementVisible selector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" stepKey="waitForPlaceholderSectionOpenAfter"/> |
| 44 | + <!--Delete base placeholder--> |
| 45 | + <checkOption selector="{{AdminProductImagePlaceholderConfigSection.baseImageDelete}}" stepKey="checkDeleteBasePlaceholder"/> |
| 46 | + <!--Delete small placeholder--> |
| 47 | + <checkOption selector="{{AdminProductImagePlaceholderConfigSection.smallImageDelete}}" stepKey="checkDeleteSmallPlaceholder"/> |
| 48 | + <!--Delete thumbnail placeholder--> |
| 49 | + <checkOption selector="{{AdminProductImagePlaceholderConfigSection.thumbnailImageDelete}}" stepKey="checkDeleteThumbnailPlaceholder"/> |
| 50 | + <!--Save config to delete placeholders--> |
| 51 | + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigWithPlaceholders"/> |
| 52 | + <!--See placeholders are empty--> |
| 53 | + <conditionalClick selector="{{AdminProductImagePlaceholderConfigSection.sectionHeader}}" dependentSelector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" visible="false" stepKey="openPlaceholderSection2"/> |
| 54 | + <waitForElementVisible selector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" stepKey="waitForPlaceholderSectionOpen2"/> |
| 55 | + <dontSeeElement selector="{{AdminProductImagePlaceholderConfigSection.baseImage}}" stepKey="dontSeeBaseImageSet"/> |
| 56 | + <dontSeeElement selector="{{AdminProductImagePlaceholderConfigSection.smallImage}}" stepKey="dontSeeSmallImageSet"/> |
| 57 | + <dontSeeElement selector="{{AdminProductImagePlaceholderConfigSection.thumbnailImage}}" stepKey="dontSeeThumbnailImageSet"/> |
| 58 | + <dontSeeElement selector="{{AdminProductImagePlaceholderConfigSection.swatchImage}}" stepKey="dontSeeSwatchImageSet"/> |
| 59 | + |
| 60 | + <!--Delete prerequisite entities--> |
| 61 | + <deleteData createDataKey="category" stepKey="deleteCategory"/> |
| 62 | + <deleteData createDataKey="productNoImages" stepKey="deleteProductNoImages"/> |
| 63 | + <deleteData createDataKey="productWithImages" stepKey="deleteProductWithImages"/> |
| 64 | + </after> |
| 65 | + |
| 66 | + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> |
| 67 | + |
| 68 | + <!--Admin area: configure Product Image Placeholders--> |
| 69 | + <comment userInput="Configure product image placeholders in store config" stepKey="configurePlaceholderComment"/> |
| 70 | + <amOnPage url="{{CatalogConfigPage.url}}" stepKey="goToCatalogConfigurationPage"/> |
| 71 | + <waitForPageLoad stepKey="waitForConfigurationPageLoad1"/> |
| 72 | + <conditionalClick selector="{{AdminProductImagePlaceholderConfigSection.sectionHeader}}" dependentSelector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" visible="false" stepKey="openPlaceholderSection1"/> |
| 73 | + <waitForElementVisible selector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" stepKey="waitForPlaceholderSectionOpen1"/> |
| 74 | + <!--Set base placeholder--> |
| 75 | + <attachFile selector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" userInput="{{placeholderBaseImage.file}}" stepKey="uploadBasePlaceholder"/> |
| 76 | + <!--Set small placeholder--> |
| 77 | + <attachFile selector="{{AdminProductImagePlaceholderConfigSection.smallImageInput}}" userInput="{{placeholderSmallImage.file}}" stepKey="uploadSmallPlaceholder"/> |
| 78 | + <!--Set thumbnail placeholder--> |
| 79 | + <attachFile selector="{{AdminProductImagePlaceholderConfigSection.thumbnailImageInput}}" userInput="{{placeholderThumbnailImage.file}}" stepKey="uploadThumbnailPlaceholder"/> |
| 80 | + <!--Save config with placeholders--> |
| 81 | + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigWithPlaceholders"/> |
| 82 | + <!--See images are saved--> |
| 83 | + <conditionalClick selector="{{AdminProductImagePlaceholderConfigSection.sectionHeader}}" dependentSelector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" visible="false" stepKey="openPlaceholderSection2"/> |
| 84 | + <waitForElementVisible selector="{{AdminProductImagePlaceholderConfigSection.baseImageInput}}" stepKey="waitForPlaceholderSectionOpen2"/> |
| 85 | + <seeElement selector="{{AdminProductImagePlaceholderConfigSection.baseImageBySrc(placeholderBaseImage.name)}}" stepKey="seeBasePlaceholderSet"/> |
| 86 | + <seeElement selector="{{AdminProductImagePlaceholderConfigSection.smallImageBySrc(placeholderSmallImage.name)}}" stepKey="seeSmallPlaceholderSet"/> |
| 87 | + <seeElement selector="{{AdminProductImagePlaceholderConfigSection.thumbnailImageBySrc(placeholderThumbnailImage.name)}}" stepKey="seeThumbnailPlaceholderSet"/> |
| 88 | + <dontSeeElement selector="{{AdminProductImagePlaceholderConfigSection.swatchImage}}" stepKey="dontSeeSwatchImageSet"/> |
| 89 | + |
| 90 | + <!--See correct placeholder images on category page--> |
| 91 | + <comment userInput="Check placeholder images on the storefront" stepKey="checkStorefrontComment"/> |
| 92 | + <amOnPage url="$$category.name$$.html" stepKey="goToCategoryStorefront1"/> |
| 93 | + <waitForPageLoad stepKey="waitForStorefrontCategory1"/> |
| 94 | + <!--Product with no images uses placeholder--> |
| 95 | + <seeElement selector="{{StorefrontCategoryProductSection.ProductImageByName($$productNoImages.name$$)}}" stepKey="seeProductNoImagesInCategory"/> |
| 96 | + <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$productNoImages.name$$)}}" userInput="src" stepKey="getSmallPlaceholderImageSrc"/> |
| 97 | + <assertContains stepKey="checkSmallPlaceholderImage"> |
| 98 | + <actualResult type="variable">$getSmallPlaceholderImageSrc</actualResult> |
| 99 | + <expectedResult type="string">{{placeholderSmallImage.name}}</expectedResult> |
| 100 | + </assertContains> |
| 101 | + <!--Product with images does not use placeholder--> |
| 102 | + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$productWithImages.name$$)}}" stepKey="seeProductWithImagesInCategory"/> |
| 103 | + <grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByName($$productWithImages.name$$)}}" userInput="src" stepKey="getSmallNonPlaceholderImageSrc"/> |
| 104 | + <assertNotContains stepKey="checkSmallPlaceholderImageNotUsed"> |
| 105 | + <actualResult type="variable">$getSmallNonPlaceholderImageSrc</actualResult> |
| 106 | + <expectedResult type="string">{{placeholderSmallImage.name}}</expectedResult> |
| 107 | + </assertNotContains> |
| 108 | + |
| 109 | + <!--Check base image on product page--> |
| 110 | + <!--Product which is using placeholder--> |
| 111 | + <click selector="{{StorefrontCategoryProductSection.ProductImageByName($$productNoImages.name$$)}}" stepKey="goToProductNoImages"/> |
| 112 | + <waitForPageLoad stepKey="waitForProductPageLoad1"/> |
| 113 | + <seeInCurrentUrl url="$$productNoImages.sku$$" stepKey="seeCorrectProductPage1"/> |
| 114 | + <seeElement selector="{{StorefrontProductMediaSection.imageFile(placeholderBaseImage.name)}}" stepKey="seeBasePlaceholderImage"/> |
| 115 | + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addProductToCart1"/> |
| 116 | + <waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" stepKey="waitForProductAdded1"/> |
| 117 | + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniCart1"/> |
| 118 | + <grabAttributeFrom selector="{{StorefrontMinicartSection.productImageByName($$productNoImages.name$$)}}" userInput="src" stepKey="getThumbnailPlaceholderImageSrc"/> |
| 119 | + <assertContains stepKey="checkThumbnailPlaceholderImage"> |
| 120 | + <actualResult type="variable">$getThumbnailPlaceholderImageSrc</actualResult> |
| 121 | + <expectedResult type="string">{{placeholderThumbnailImage.name}}</expectedResult> |
| 122 | + </assertContains> |
| 123 | + <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromCart1"> |
| 124 | + <argument name="productName" value="$$productNoImages.name$$"/> |
| 125 | + </actionGroup> |
| 126 | + <!--Product which is NOT using placeholder--> |
| 127 | + <amOnPage url="$$category.name$$.html" stepKey="goToCategoryStorefront2"/> |
| 128 | + <waitForPageLoad stepKey="waitForStorefrontCategory2"/> |
| 129 | + <click selector="{{StorefrontCategoryProductSection.ProductImageByName($$productWithImages.name$$)}}" stepKey="goToProductWithImages"/> |
| 130 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 131 | + <seeInCurrentUrl url="$$productWithImages.sku$$" stepKey="seeCorrectProductPage2"/> |
| 132 | + <dontSeeElement selector="{{StorefrontProductMediaSection.imageFile(placeholderBaseImage.name)}}" stepKey="dontSeeBasePlaceholderImage"/> |
| 133 | + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addProductToCart2"/> |
| 134 | + <waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" stepKey="waitForProductAdded2"/> |
| 135 | + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniCart2"/> |
| 136 | + <grabAttributeFrom selector="{{StorefrontMinicartSection.productImageByName($$productWithImages.name$$)}}" userInput="src" stepKey="getThumbnailImageSrc"/> |
| 137 | + <assertNotContains stepKey="checkThumbnailImage"> |
| 138 | + <actualResult type="variable">$getThumbnailImageSrc</actualResult> |
| 139 | + <expectedResult type="string">{{placeholderThumbnailImage.name}}</expectedResult> |
| 140 | + </assertNotContains> |
| 141 | + <actionGroup ref="removeProductFromMiniCart" stepKey="removeProductFromCart2"> |
| 142 | + <argument name="productName" value="$$productWithImages.name$$"/> |
| 143 | + </actionGroup> |
| 144 | + </test> |
| 145 | +</tests> |
0 commit comments