Skip to content

Commit af521aa

Browse files
committed
Merge branch 'ACP2E-1444' of https://github.com/magento-l3/magento2-page-builder into PR-L3-2023-01-31
2 parents 1fb4b74 + 509edc9 commit af521aa

File tree

7 files changed

+239
-4
lines changed

7 files changed

+239
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="assertFieldSlideOutPropertyValueEquals">
11+
<arguments>
12+
<argument name="property"/>
13+
<argument name="value" defaultValue="" type="string"/>
14+
</arguments>
15+
<waitForElement time="2" selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="waitForElementVisible"/>
16+
<see userInput="{{property.name}}" selector="{{EditPanelForm.panelFieldLabel(property.section, property.fieldName, property.section, property.name)}}" stepKey="seePropertyLabel"/>
17+
<grabValueFrom selector="{{EditPanelForm.panelFieldControl(property.section, property.fieldName)}}" stepKey="getFieldValue"/>
18+
<assertEquals stepKey="assertFieldValueEquals">
19+
<actualResult type="variable">getFieldValue</actualResult>
20+
<expectedResult type="string">{{value}}</expectedResult>
21+
</assertEquals>
22+
</actionGroup>
23+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminPageBuilderProductsCarouselSelectBySKUWithSpecialCharacterAndVerifyProductIsDisplayedTest" extends="AdminPageBuilderProductsSelectBySKUWithSpecialCharacterAndVerifyProductIsDisplayedTest">
11+
<annotations>
12+
<features value="PageBuilder"/>
13+
<stories value="Products"/>
14+
<title value="Carousel - Select Products By SKU with special characters, delete one product, verify product is displayed in the content preview and storefront"/>
15+
<description value="Verify that a product is shown in the content preview and storefront if the content type is filtered by 'Select By SKU' and the SKU contains special characters"/>
16+
<severity value="MINOR"/>
17+
<useCaseId value="ACP2E-1444"/>
18+
<testCaseId value="AC-7587"/>
19+
<group value="pagebuilder"/>
20+
<group value="pagebuilder-products"/>
21+
<group value="pagebuilder-productsCarousel"/>
22+
</annotations>
23+
<actionGroup ref="chooseVisualSelectOption" stepKey="selectAppearance">
24+
<argument name="property" value="PageBuilderProductsProductCarouselAppearance"/>
25+
</actionGroup>
26+
<actionGroup ref="fillSlideOutPanelFieldGeneral" stepKey="enterProductsCount">
27+
<argument name="property" value="PageBuilderProductsCarouselCountPropertyFour"/>
28+
</actionGroup>
29+
<actionGroup ref="validateProductCountInProducts" stepKey="validateProductsCountStage">
30+
<argument name="page" value="ProductsCarouselOnStage"/>
31+
<argument name="count" value="1"/>
32+
</actionGroup>
33+
<actionGroup ref="validateProductInProducts" stepKey="validateProduct1Stage">
34+
<argument name="page" value="ProductsCarouselOnStage"/>
35+
<argument name="product" value="ProductWithSpecialCharsInSKU"/>
36+
<argument name="productIndex" value="1"/>
37+
</actionGroup>
38+
<actionGroup ref="validateProductCountInProducts" stepKey="validateProductsCountStage2">
39+
<argument name="page" value="ProductsCarouselOnStage"/>
40+
<argument name="count" value="1"/>
41+
</actionGroup>
42+
<actionGroup ref="validateProductInProducts" stepKey="validateProduct2Stage2">
43+
<argument name="page" value="ProductsCarouselOnStage"/>
44+
<argument name="product" value="ProductWithSpecialCharsInSKU"/>
45+
<argument name="productIndex" value="1"/>
46+
</actionGroup>
47+
</test>
48+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminPageBuilderProductsSelectBySKUWithSpecialCharacterAndVerifyProductIsDisplayedTest">
11+
<annotations>
12+
<features value="PageBuilder"/>
13+
<stories value="Products"/>
14+
<title value="Grid - Select Products By SKU with special characters, delete one product, verify product is displayed in the content preview and storefront"/>
15+
<description value="Verify that a product is shown in the content preview and storefront if the content type is filtered by 'Select By SKU' and the SKU contains special characters"/>
16+
<severity value="MINOR"/>
17+
<useCaseId value="ACP2E-1444"/>
18+
<testCaseId value="AC-7586"/>
19+
<group value="pagebuilder"/>
20+
<group value="pagebuilder-products"/>
21+
<group value="pagebuilder-productsGrid"/>
22+
</annotations>
23+
<before>
24+
<createData entity="ProductWithSpecialCharsInSKU" stepKey="createProduct1"/>
25+
<createData entity="SimpleProduct" stepKey="createProduct2"/>
26+
<createData entity="_emptyCmsPage" stepKey="createCMSPage"/>
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28+
<actionGroup ref="navigateToCMSPage" stepKey="navigateToCMSPage">
29+
<argument name="CMSPage" value="$$createCMSPage$$"/>
30+
</actionGroup>
31+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
32+
<actionGroup ref="dragContentTypeToStage" stepKey="dragRowToRootContainer">
33+
<argument name="contentType" value="PageBuilderRowContentType"/>
34+
<argument name="containerTargetType" value="PageBuilderRootContainerContentType"/>
35+
</actionGroup>
36+
</before>
37+
<after>
38+
<deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/>
39+
<deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/>
40+
<deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/>
41+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
42+
</after>
43+
<actionGroup ref="expandPageBuilderPanelMenuSection" stepKey="expandMenuSectionAddContent">
44+
<argument name="contentType" value="PageBuilderProductsContentType"/>
45+
</actionGroup>
46+
<actionGroup ref="dragContentTypeToStage" stepKey="dragProductsIntoStage">
47+
<argument name="contentType" value="PageBuilderProductsContentType"/>
48+
</actionGroup>
49+
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditAfterDrop">
50+
<argument name="contentType" value="PageBuilderProductsContentType"/>
51+
</actionGroup>
52+
<actionGroup ref="chooseVisualSelectOption" stepKey="selectAppearance">
53+
<argument name="property" value="PageBuilderProductsProductGridAppearance"/>
54+
</actionGroup>
55+
<actionGroup ref="chooseVisualSelectOption" stepKey="chooseSelectProductsBy">
56+
<argument name="property" value="PageBuilderProductsSelectProductsBySKU"/>
57+
</actionGroup>
58+
<actionGroup ref="addSKUsToSelectProductsBySKU" stepKey="addProductsSKUsToInputField">
59+
<argument name="SKUs" value="$$createProduct1.sku$$"/>
60+
</actionGroup>
61+
<actionGroup ref="fillSlideOutPanelFieldGeneral" stepKey="enterProductsCount">
62+
<argument name="property" value="PageBuilderProductsCountPropertyFour"/>
63+
</actionGroup>
64+
<actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
65+
<actionGroup ref="validateProductCountInProducts" stepKey="validateProductsCountStage">
66+
<argument name="page" value="ProductsOnStage"/>
67+
<argument name="count" value="1"/>
68+
</actionGroup>
69+
<actionGroup ref="validateProductInProducts" stepKey="validateProduct1Stage">
70+
<argument name="page" value="ProductsOnStage"/>
71+
<argument name="product" value="ProductWithSpecialCharsInSKU"/>
72+
<argument name="productIndex" value="1"/>
73+
</actionGroup>
74+
<actionGroup ref="exitPageBuilderFullScreen" stepKey="exitPageBuilderFullScreen"/>
75+
<actionGroup ref="SaveAndContinueEditCmsPageActionGroup" stepKey="saveAndContinueEditCmsPage"/>
76+
<reloadPage stepKey="reloadPage"/>
77+
<waitForPageLoad stepKey="waitForReload"/>
78+
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage1"/>
79+
<actionGroup ref="validateProductCountInProducts" stepKey="validateProductsCountStage2">
80+
<argument name="page" value="ProductsOnStage"/>
81+
<argument name="count" value="1"/>
82+
</actionGroup>
83+
<actionGroup ref="validateProductInProducts" stepKey="validateProduct2Stage2">
84+
<argument name="page" value="ProductsOnStage"/>
85+
<argument name="product" value="ProductWithSpecialCharsInSKU"/>
86+
<argument name="productIndex" value="1"/>
87+
</actionGroup>
88+
<actionGroup ref="openPageBuilderEditPanel" stepKey="openProductsContentType">
89+
<argument name="contentType" value="PageBuilderProductsContentType"/>
90+
</actionGroup>
91+
<actionGroup ref="assertFieldSlideOutPropertyValueEquals" stepKey="assertSKUFilterValueEqualsToProductSKU">
92+
<argument name="property" value="PageBuilderProductsEnterSKUsInput"/>
93+
<argument name="value" value="$$createProduct1.sku$$"/>
94+
</actionGroup>
95+
</test>
96+
</tests>

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/mass-converter/carousel-widget-directive.js

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/mass-converter/widget-directive.js

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/products/mass-converter/carousel-widget-directive.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export default class WidgetDirective extends BaseWidgetDirective {
3030
data.carousel_products_count = attributes.products_count;
3131
data.sort_order = attributes.sort_order;
3232
data.condition_option = attributes.condition_option || "condition";
33-
data[data.condition_option] = this.decodeWysiwygCharacters(attributes.condition_option_value || "");
33+
data[data.condition_option] = this.decodeWysiwygCharacters(
34+
this.decodeHtmlCharacters(attributes.condition_option_value || ""),
35+
);
3436
data.conditions_encoded = this.decodeWysiwygCharacters(attributes.conditions_encoded || "");
3537
data[data.condition_option + "_source"] = data.conditions_encoded;
3638
return data;
@@ -98,4 +100,20 @@ export default class WidgetDirective extends BaseWidgetDirective {
98100
.replace(/&lt;/g, "<")
99101
.replace(/&gt;/g, ">");
100102
}
103+
104+
/**
105+
* Decode html special characters
106+
*
107+
* @param {string} content
108+
* @returns {string}
109+
*/
110+
private decodeHtmlCharacters(content: string) {
111+
if (content) {
112+
const htmlDocument = new DOMParser().parseFromString(content, "text/html");
113+
114+
return htmlDocument.body ? htmlDocument.body.textContent : content;
115+
}
116+
117+
return content;
118+
}
101119
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/products/mass-converter/widget-directive.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export default class WidgetDirective extends BaseWidgetDirective {
3030
data.products_count = attributes.products_count;
3131
data.sort_order = attributes.sort_order;
3232
data.condition_option = attributes.condition_option || "condition";
33-
data[data.condition_option] = this.decodeWysiwygCharacters(attributes.condition_option_value || "");
33+
data[data.condition_option] = this.decodeWysiwygCharacters(
34+
this.decodeHtmlCharacters(attributes.condition_option_value || ""),
35+
);
3436
data.conditions_encoded = this.decodeWysiwygCharacters(attributes.conditions_encoded || "");
3537
data[data.condition_option + "_source"] = data.conditions_encoded;
3638
return data;
@@ -98,4 +100,20 @@ export default class WidgetDirective extends BaseWidgetDirective {
98100
.replace(/&lt;/g, "<")
99101
.replace(/&gt;/g, ">");
100102
}
103+
104+
/**
105+
* Decode html special characters
106+
*
107+
* @param {string} content
108+
* @returns {string}
109+
*/
110+
private decodeHtmlCharacters(content: string) {
111+
if (content) {
112+
const htmlDocument = new DOMParser().parseFromString(content, "text/html");
113+
114+
return htmlDocument.body ? htmlDocument.body.textContent : content;
115+
}
116+
117+
return content;
118+
}
101119
}

0 commit comments

Comments
 (0)