Skip to content

Commit 7c48e9c

Browse files
committed
MAGETWO-8709:[GITHUB] Child product image should be shown in Wishist if options are selected for configurable product #8168
-added functional test to cover bug fix
1 parent 5413d1a commit 7c48e9c

File tree

5 files changed

+86
-0
lines changed

5 files changed

+86
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@
171171
<data key="filename">magento-logo</data>
172172
<data key="file_extension">png</data>
173173
</entity>
174+
<entity name="TestImageNew" type="image">
175+
<data key="title" unique="suffix">magento-again</data>
176+
<data key="price">1.00</data>
177+
<data key="file_type">Upload File</data>
178+
<data key="shareable">Yes</data>
179+
<data key="file">magento-again.jpg</data>
180+
<data key="filename">magento-again</data>
181+
<data key="file_extension">jpg</data>
182+
</entity>
174183
<entity name="ProductWithUnicode" type="product">
175184
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
176185
<data key="type_id">simple</data>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
<element name="firstRow" type="button" selector="tr.data-row:nth-of-type(1)"/>
2929
<element name="productGridCheckboxOnRow" type="checkbox" selector="//*[@id='container']//tr[{{row}}]/td[1]//input" parameterized="true"/>
3030
<element name="productGridNameProduct" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
31+
<element name="selectRowBasedOnName" type="input" selector="//td/div[text()='{{var1}}']" parameterized="true"/>
3132
</section>
3233
</sections>

app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="ProductImageByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/>
1515
<element name="ProductInfoByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//div[@class='product-item-info']" parameterized="true"/>
1616
<element name="ProductAddToCartByName" type="button" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//button[contains(@class, 'action tocart primary')]" parameterized="true"/>
17+
<element name="ProductImageByImageName" type="text" selector="//main//li//a//img[contains(@src, '{{var1}}')]" parameterized="true"/>
1718
</section>
1819
</sections>

app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistSidebarSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="ProductPriceByName" type="text" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//span[@class='price']" parameterized="true"/>
1414
<element name="ProductImageByName" type="text" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//img[@class='product-image-photo']" parameterized="true"/>
1515
<element name="ProductAddToCartByName" type="button" selector="//main//ol[@id='wishlist-sidebar']//a[@class='product-item-link']/span[text()='{{var1}}']//ancestor::ol//button[contains(@class, 'action tocart primary')]" parameterized="true"/>
16+
<element name="ProductImageByImageName" type="text" selector="//main//ol[@id='wishlist-sidebar']//a//img[contains(@src, '{{var1}}')]" parameterized="true"/>
1617
</section>
1718
</sections>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="ConfigurableProductChildImageShouldBeShownOnWishListTest">
11+
<annotations>
12+
<features value="Wishlist"/>
13+
<stories value="MAGETWO-8709"/>
14+
<group value="wishlist12"/>
15+
<title value="When user add Configurable child product to WIshlist then child product image should be shown in Wishlist"/>
16+
<description value="When user add Configurable child product to WIshlist then child product image should be shown in Wishlist"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-93097"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set checkout/cart/configurable_product_image 0" stepKey="setProductImageSettingUnderCofigurationSalesCheckout"/>
22+
<createData entity="ApiCategory" stepKey="createCategory"/>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
24+
25+
<actionGroup ref="createConfigurableProduct" stepKey="createProduct">
26+
<argument name="product" value="_defaultProduct"/>
27+
<argument name="category" value="$$createCategory$$"/>
28+
</actionGroup>
29+
<createData entity="Simple_US_Customer" stepKey="customer"/>
30+
</before>
31+
<after>
32+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
33+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
34+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
35+
</after>
36+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
37+
<waitForPageLoad stepKey="waitForProductIndexPageLoad"/>
38+
<click selector="{{AdminProductGridSection.selectRowBasedOnName(_defaultProduct.name)}}" stepKey="selectProductToAddImage"/>
39+
<waitForPageLoad stepKey="waitForProductEditPageLoad"/>
40+
<actionGroup ref="addProductImage" stepKey="addImageForParentProduct">
41+
<argument name="image" value="MagentoLogo"/>
42+
</actionGroup>
43+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
44+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex1"/>
45+
<waitForPageLoad stepKey="waitForProductIndexPageLoad1"/>
46+
<click selector="{{AdminProductGridSection.selectRowBasedOnName(colorProductAttribute1.name)}}" stepKey="selectProductToAddImage1"/>
47+
<waitForPageLoad stepKey="waitForProductEditPageLoad1"/>
48+
<actionGroup ref="addProductImage" stepKey="addImageForChildProduct">
49+
<argument name="image" value="TestImageNew"/>
50+
</actionGroup>
51+
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>
52+
53+
<!--Sign in as customer -->
54+
<amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/>
55+
<fillField userInput="$$customer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="fillEmail"/>
56+
<fillField userInput="$$customer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}" stepKey="fillPassword"/>
57+
<waitForElementVisible selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="waitForButton"/>
58+
<click selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="clickSignInAccountButton"/>
59+
<see userInput="$$customer.firstname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" stepKey="seeFirstName"/>
60+
<see userInput="$$customer.lastname$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" stepKey="seeLastName"/>
61+
<see userInput="$$customer.email$$" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" stepKey="seeEmail"/>
62+
<waitForPageLoad stepKey="waitForLogin"/>
63+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnConfigurableProductPage"/>
64+
<waitForPageLoad stepKey="wait3"/>
65+
<see userInput="{{_defaultProduct.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="seeProductName"/>
66+
<selectOption userInput="{{colorProductAttribute1.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/>
67+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="waitForAddToCartVisible"/>
68+
<click selector="{{StorefrontProductPageSection.addToWishlist}}" stepKey="addFirstProductToWishlist"/>
69+
<waitForElement selector="{{StorefrontCustomerWishlistSection.successMsg}}" time="30" stepKey="addProductToWishlistWaitForSuccessMessage"/>
70+
<waitForPageLoad stepKey="waitForPageToLoad2"/>
71+
<seeElement selector="{{StorefrontCustomerWishlistProductSection.ProductImageByImageName(TestImageNew.filename)}}" stepKey="AssertWishlistProductImage" />
72+
<seeElement selector="{{StorefrontCustomerWishlistSidebarSection.ProductImageByImageName(TestImageNew.filename)}}" stepKey="AssertWishlistSidebarProductImage" />
73+
</test>
74+
</tests>

0 commit comments

Comments
 (0)