Skip to content

Commit f846c00

Browse files
committed
MAGETWO-91163: Image doesn't load on frontend PDP if the product name contains double quote "
1 parent a328a6b commit f846c00

14 files changed

+208
-6
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<!--Fill main fields in create product form-->
11+
<actionGroup name="fillMainProductForm">
12+
<arguments>
13+
<argument name="product" defaultValue="_defaultProduct"/>
14+
</arguments>
15+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/>
16+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
17+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/>
18+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/>
19+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/>
20+
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/>
21+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/>
22+
</actionGroup>
23+
24+
<!--Save product and see success message-->
25+
<actionGroup name="saveProductForm">
26+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
27+
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
28+
</actionGroup>
29+
30+
<!--Upload image for product-->
31+
<actionGroup name="addProductImage">
32+
<arguments>
33+
<argument name="image" defaultValue="ProductImage"/>
34+
</arguments>
35+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
36+
<waitForPageLoad time="30" stepKey="waitForPageRefresh"/>
37+
<waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/>
38+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
39+
<waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/>
40+
<waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/>
41+
</actionGroup>
42+
</actionGroups>

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,38 @@
1616
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
1717
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
1818
</actionGroup>
19+
20+
<!--Navigate to create product page from product grid page-->
21+
<actionGroup name="goToCreateProductPage">
22+
<arguments>
23+
<argument name="product" defaultValue="_defaultProduct"/>
24+
</arguments>
25+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
26+
<waitForElementVisible selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="waitForAddProductDropdown" time="30"/>
27+
<click selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="clickAddProductType"/>
28+
<waitForPageLoad stepKey="waitForCreateProductPageLoad"/>
29+
<seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, product.type_id)}}" stepKey="seeNewProductUrl"/>
30+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/>
31+
</actionGroup>
32+
33+
<!--Delete a product by filtering grid and using delete action-->
34+
<actionGroup name="deleteProductUsingProductGrid">
35+
<arguments>
36+
<argument name="product"/>
37+
</arguments>
38+
<!--TODO use other action group for filtering grid when MQE-539 is implemented -->
39+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
40+
<waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/>
41+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
42+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
43+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
44+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
45+
<see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/>
46+
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
47+
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>
48+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
49+
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
50+
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
51+
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
52+
</actionGroup>
1953
</actionGroups>

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@
7575
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
7676
<requiredEntity type="custom_attributes">CustomAttributeProductAttribute</requiredEntity>
7777
</entity>
78-
<entity name="ImageUpload" type="uploadImage">
78+
<entity name="ProductImage" type="uploadImage">
7979
<data key="title" unique="suffix">Image1</data>
8080
<data key="price">1.00</data>
8181
<data key="file_type">Upload File</data>
8282
<data key="shareable">Yes</data>
8383
<data key="file">magento-logo.png</data>
84+
<data key="fileName">magento-logo</data>
8485
</entity>
8586
<entity name="productWithDescription" type="product">
8687
<data key="sku" unique="suffix">testProductWithDescriptionSku</data>
@@ -147,4 +148,16 @@
147148
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
148149
<requiredEntity type="custom_attribute_array">ApiProductNewsFromDate</requiredEntity>
149150
</entity>
151+
<entity name="SimpleProductNameWithDoubleQuote" type="product">
152+
<data key="name" unique="prefix">Double Quote"</data>
153+
<data key="sku" unique="prefix">doubleQuote</data>
154+
<data key="type_id">simple</data>
155+
<data key="attribute_set_id">4</data>
156+
<data key="price">10.00</data>
157+
<data key="visibility">4</data>
158+
<data key="status">1</data>
159+
<data key="quantity">1000</data>
160+
<data key="weight">1</data>
161+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
162+
</entity>
150163
</entities>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="AdminProductCreatePage" url="catalog/product/new/set/{{set}}/type/{{type}}/" area="admin" module="Magento_Catalog" parameterized="true">
12+
<section name="AdminProductFormSection"/>
13+
<section name="AdminProductFormActionSection"/>
14+
<section name="AdminProductSEOSection"/>
15+
<section name="AdminProductImagesSection"/>
16+
<section name="AdminAddProductsToOptionPanel"/>
17+
<section name="AdminProductMessagesSection"/>
18+
<section name="AdminMessagesSection"/>
19+
<section name="AdminProductCustomizableOptionsSection" />
20+
</page>
21+
</pages>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/AdminProductEditPage.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="AdminProductEditPage" url="catalog/product/new/set/4/type/simple/" area="admin" module="Magento_Catalog">
12-
<section name="AdminProductFormSection"/>
13-
<section name="AdminProductFormActionSection"/>
14-
<section name="AdminMessagesSection"/>
15-
<section name="AdminProductCustomizableOptionsSection" />
11+
<page name="AdminProductEditPage" url="catalog/product/edit/id/{{productId}}" area="admin" module="Magento_Catalog">
12+
<!-- This page object only exists for the url. Use the AdminProductCreatePage for selectors. -->
1613
</page>
1714
</pages>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
1515
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
1616
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
17+
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']"/>
18+
<element name="productWeight" type="input" selector=".admin__field[data-index=weight] input"/>
19+
<element name="productWeightSelect" type="select" selector="select[name='product[product_has_weight]']"/>
1720
<element name="contentTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[text()='Content']"/>
1821
<element name="validationErrorLabel" type="text" selector="//label[@class='admin__field-error']"/>
1922
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<element name="addSimpleProduct" type="button" selector=".item[data-ui-id='products-list-add-new-product-button-item-simple']" timeout="30"/>
1414
<element name="addConfigurableProduct" type="button" selector=".item[data-ui-id='products-list-add-new-product-button-item-configurable']" timeout="30"/>
1515
<element name="addBundleProduct" type="button" selector=".item[data-ui-id='products-list-add-new-product-button-item-bundle']" timeout="30"/>
16+
<element name="addTypeProduct" type="button" selector=".item[data-ui-id='products-list-add-new-product-button-item-{{type}}']" parameterized="true"/>
1617
<element name="productName" type="text" selector="//div[text()='{{var1}}']" parameterized="true"/>
1718
<element name="actionsSelectBox" type="select" selector="//div[contains(@class,'col-xs-2')]//button[contains(@title,'Select Items')]"/>
1819
<element name="deleteOptionInActionsSelectBox" type="select" selector="//div[contains(@class,'col-xs-2')]//span[contains(text(),'Delete')]"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="clearFilters" type="button" selector=".admin__data-grid-header button[data-action='grid-filter-reset']" timeout="30"/>
1717
<element name="applyFilters" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/>
1818
<element name="newFromDateFilter" type="input" selector="input.admin__control-text[name='news_from_date[from]']"/>
19+
<element name="skuFilter" type="input" selector="input.admin__control-text[name='sku']"/>
1920
</section>
2021
</sections>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
1414
<element name="productGridElement1" type="input" selector="#addselector" />
1515
<element name="productGridElement2" type="text" selector="#addselector" />
16+
<element name="productGridCell" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
17+
<element name="multicheckDropdown" type="button" selector="div[data-role='grid-wrapper'] th.data-grid-multicheck-cell button.action-multicheck-toggle"/>
18+
<element name="multicheckOption" type="button" selector="//div[@data-role='grid-wrapper']//th[contains(@class, data-grid-multicheck-cell)]//li//span[text() = '{{label}}']" parameterized="true"/>
19+
<element name="bulkActionDropdown" type="button" selector="div.admin__data-grid-header-row.row div.action-select-wrap button.action-select"/>
20+
<element name="bulkActionOption" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-select-wrap')]//ul/li/span[text() = '{{label}}']" parameterized="true"/>
1621
<element name="firstRow" type="button" selector="tr.data-row:nth-of-type(1)"/>
1722
<element name="productGridXRowYColumnButton" type="input" selector="table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true" timeout="30"/>
1823
<element name="productNameInNameColumn" type="input" selector="//td[4]/div[@class='data-grid-cell-content']"/>

0 commit comments

Comments
 (0)