Skip to content

Commit 52a0efe

Browse files
danielrenaudcpartica
authored andcommitted
MAGETWO-91595: Image doesn't load on frontend PDP if the product name contains double quote "
1 parent 6110fdd commit 52a0efe

File tree

6 files changed

+81
-2
lines changed

6 files changed

+81
-2
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
<waitForPageLoad time="30" stepKey="waitForPageRefresh"/>
8484
<waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/>
8585
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
86-
<waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/>
87-
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
86+
<waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/>
87+
<waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/>
8888
</actionGroup>
8989

9090
<!--Remove image for product-->

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
<data key="file_type">Upload File</data>
161161
<data key="shareable">Yes</data>
162162
<data key="file">magento-logo.png</data>
163+
<data key="fileName">magento-logo</data>
163164
</entity>
164165
<entity name="MagentoLogo" type="image">
165166
<data key="title" unique="suffix">MagentoLogo</data>
@@ -281,4 +282,16 @@
281282
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
282283
<requiredEntity type="custom_attribute_array">ApiProductNewsFromDate</requiredEntity>
283284
</entity>
285+
<entity name="SimpleProductNameWithDoubleQuote" type="product">
286+
<data key="name" unique="prefix">Double Quote"</data>
287+
<data key="sku" unique="prefix">doubleQuote</data>
288+
<data key="type_id">simple</data>
289+
<data key="attribute_set_id">4</data>
290+
<data key="price">10.00</data>
291+
<data key="visibility">4</data>
292+
<data key="status">1</data>
293+
<data key="quantity">1000</data>
294+
<data key="weight">1</data>
295+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
296+
</entity>
284297
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductImagesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="imageUploadButton" type="button" selector="div.image div.fileinput-button"/>
1515
<element name="imageFile" type="text" selector="//*[@id='media_gallery_content']//img[contains(@src, '{{url}}')]" parameterized="true"/>
1616
<element name="removeImageButton" type="button" selector=".action-remove"/>
17+
<element name="uploadProgressBar" type="text" selector=".uploader .file-row"/>
1718
</section>
1819
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="ProductImageByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/>
2020
<element name="ProductInfoByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//div[@class='product-item-info']" parameterized="true"/>
2121
<element name="ProductAddToCompareByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//a[contains(@class, 'tocompare')]" parameterized="true"/>
22+
<element name="ProductImageByNameAndSrc" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[contains(@src, '{{src}}')]" parameterized="true"/>
2223
</section>
2324
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<element name="oldPrice" type="text" selector=".old-price"/>
1919
<element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/>
2020
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[@class='fotorama__img']"/>
21+
<element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@src, '{{src}}')]" parameterized="true"/>
2122
<element name="productDescription" type="text" selector="#description .value"/>
2223
<element name="productOptionFieldInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='text']" parameterized="true"/>
2324
<element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="StorefrontProductNameWithDoubleQuote">
12+
<annotations>
13+
<title value="Product with double quote in name"/>
14+
<description value="Product with a double quote in the name should appear correctly on the storefront"/>
15+
<severity value="CRITICAL"/>
16+
<group value="product"/>
17+
<testCaseId value="MAGETWO-92384"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
</before>
22+
<after>
23+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
24+
</after>
25+
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<!--Create product via admin-->
28+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/>
29+
<waitForPageLoad stepKey="waitForProductIndexPage"/>
30+
<actionGroup ref="goToCreateProductPage" stepKey="goToProductCreatePage">
31+
<argument name="product" value="SimpleProductNameWithDoubleQuote"/>
32+
</actionGroup>
33+
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
34+
<argument name="product" value="SimpleProductNameWithDoubleQuote"/>
35+
</actionGroup>
36+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/>
37+
<actionGroup ref="addProductImage" stepKey="addImageToProduct">
38+
<argument name="image" value="ImageUpload"/>
39+
</actionGroup>
40+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
41+
42+
<!--Check product in category listing-->
43+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="goToCategoryPage"/>
44+
<seeElement selector="{{StorefrontCategoryProductSection.ProductImageByNameAndSrc(SimpleProductNameWithDoubleQuote.name, ImageUpload.fileName)}}" stepKey="seeCorrectImageCategoryPage"/>
45+
<see selector="{{StorefrontCategoryProductSection.ProductTitleByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectNameCategoryPage"/>
46+
<see selector="{{StorefrontCategoryProductSection.ProductPriceByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPriceCategoryPage"/>
47+
<!--Open product display page-->
48+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName(SimpleProductNameWithDoubleQuote.name)}}" stepKey="clickProductToGoProductPage"/>
49+
<waitForPageLoad stepKey="waitForProductDisplayPageLoad"/>
50+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectName"/>
51+
<see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{SimpleProductNameWithDoubleQuote.sku}}" stepKey="seeCorrectSku"/>
52+
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPrice"/>
53+
<seeElement selector="{{StorefrontProductInfoMainSection.productImageSrc(ImageUpload.fileName)}}" stepKey="seeCorrectImage"/>
54+
<see selector="{{StorefrontProductInfoMainSection.stock}}" userInput="In Stock" stepKey="seeInStock"/>
55+
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$createCategory.name$$" stepKey="seeCorrectBreadCrumbCategory"/>
56+
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectBreadCrumbProduct"/>
57+
58+
<!--Remove product-->
59+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
60+
<argument name="product" value="SimpleProductNameWithDoubleQuote"/>
61+
</actionGroup>
62+
</test>
63+
</tests>

0 commit comments

Comments
 (0)