Skip to content

Commit f0fc2ad

Browse files
committed
MC-42531: HTML Tags are displaying on customer's order comment section on frontend
- Removed html tags in order comment section on frontend. - Added MFTF test.
1 parent 32fda1c commit f0fc2ad

File tree

5 files changed

+121
-1
lines changed

5 files changed

+121
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSalesOrderCommentsActionGroup">
12+
<annotations>
13+
<description>Adding comments on admin sales order details page</description>
14+
</annotations>
15+
<fillField selector="{{AdminSalesOrderCommentsSection.historyComment}}" userInput="{{SalesOrderComments.comment}}" stepKey="fillComment"/>
16+
<checkOption selector="{{AdminSalesOrderCommentsSection.historyVisible}}" stepKey="checkVisibleOnStoreFront"/>
17+
<click selector="{{AdminSalesOrderCommentsSection.submitOrderComment}}" stepKey="clickSaveCommentButton"/>
18+
<waitForPageLoad stepKey="waitForSaveComments"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="SalesOrderComments" type="order">
12+
<data key="comment">&#x3C;a href=&#x22;https://business.adobe.com/products/magento/magento-commerce.html&#x22;&#x3E;Testing Html Tags&#x3C;/a&#x3E;</data>
13+
</entity>
14+
</entities>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminSalesOrderCommentsSection">
12+
<element name="historyComment" type="textarea" selector="#history_comment"/>
13+
<element name="historyVisible" type="checkbox" selector="#history_visible"/>
14+
<element name="submitOrderComment" type="button" selector=".order-history-comments-actions>button"/>
15+
</section>
16+
</sections>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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="StorefrontVerifyOrderHistoryCommentsTest">
12+
<annotations>
13+
<features value="Sales"/>
14+
<stories value="Storefront Order History Comments"/>
15+
<title value="Verify Order History Comments For Storefront My Account Sales Pages"/>
16+
<description value="Verify that the History comments without the HTML tags to the Sales my account pages on the Storefront"/>
17+
<testCaseId value="MC-42531"/>
18+
<useCaseId value="MC-42531"/>
19+
<severity value="MINOR"/>
20+
<group value="Sales"/>
21+
</annotations>
22+
<before>
23+
<!-- Create customer -->
24+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
25+
<!-- Create product -->
26+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
27+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
28+
</before>
29+
<after>
30+
<!-- Customer log out -->
31+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
32+
<!-- Admin log out -->
33+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
34+
<!-- Delete customer -->
35+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
36+
<!-- Delete product -->
37+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
38+
</after>
39+
<!-- Login as customer -->
40+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
41+
<argument name="Customer" value="$$createCustomer$$"/>
42+
</actionGroup>
43+
<!-- Add product to cart -->
44+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addSimpleProductToCart">
45+
<argument name="product" value="$$createProduct$$"/>
46+
<argument name="quantity" value="1"/>
47+
</actionGroup>
48+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
49+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
50+
<actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToReview"/>
51+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
52+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder">
53+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
54+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
55+
</actionGroup>
56+
57+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>
58+
59+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
60+
61+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="addFilterToGridAndOpenOrder">
62+
<argument name="orderId" value="{$orderNumber}"/>
63+
</actionGroup>
64+
65+
<actionGroup ref="AdminSalesOrderCommentsActionGroup" stepKey="fillAndSaveOrderComments"/>
66+
67+
<actionGroup ref="StorefrontOpenMyAccountPageActionGroup" stepKey="navigateToCustomerDashboardPage"/>
68+
<actionGroup ref="StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup" stepKey="clickViewOrder"/>
69+
</test>
70+
</tests>

app/code/Magento/Sales/view/frontend/templates/order/order_comments.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<?= /* @noEscape */
1818
$block->formatDate($_historyItem->getCreatedAt(), \IntlDateFormatter::MEDIUM, true) ?>
1919
</dt>
20-
<dd class="comment-content"><?= $block->escapeHtml($_historyItem->getComment()) ?></dd>
20+
<dd class="comment-content"><?= $block->escapeHtml($_historyItem->getComment(), ['b', 'br', 'strong', 'i', 'u', 'a']) ?></dd>
2121
<?php endforeach; ?>
2222
</dl>
2323
</div>

0 commit comments

Comments
 (0)