-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Admin] Do not allow HTML tags for the Product Attribute labels on save #27371
[Admin] Do not allow HTML tags for the Product Attribute labels on save #27371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vasilii-b, thank you for your contribution, could you please cover the following improvement by an MFTF test and fix the failing Static Tests?
Thank you.
Hi @eduard13, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vasilii-b, thank you for the MFTF coverage, please check the bellow comments. Feel free to reach me if any questions arise.
Thank you.
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="SaveProductAttributeWithHtmlTagsInLabelActionGroup"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please split this Action group into 2 separated ones, trying to make Action Groups a much atomic as possible?
AdminSaveProductAttributeActionGroup
- so it may be used later in other validation scopesAssertSeeProductAttributeValidationErrorActionGroup
- will validate the presence of the error.
Please check the Best Practices.
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openProductAttributePage"/> | ||
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="createNewAttribute"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest replacing these steps by a separate ActionGroup, that will navigate to NewProductAttributePage.
AdminNavigateToNewProductAttributePageActionGroup
, using this page URL ProductAttributePage
.
@@ -50,6 +50,11 @@ | |||
<element name="StorefrontPropertiesSectionToggle" type="button" selector="#front_fieldset-wrapper"/> | |||
<element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/> | |||
</section> | |||
<section name="ManageLabelsSection"> | |||
<element name="PageTitle" type="text" selector="//span[text()='Manage Titles (Size, Color, etc.)']" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this element is unnecessary as far as we don't use it.
@@ -50,6 +50,11 @@ | |||
<element name="StorefrontPropertiesSectionToggle" type="button" selector="#front_fieldset-wrapper"/> | |||
<element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/> | |||
</section> | |||
<section name="ManageLabelsSection"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please create a separate Section file, and include it in ProductAttributePage
page?
</annotations> | ||
<before> | ||
<!-- Login as admin --> | ||
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoginAsAdmin
is deprecated, please use AdminLoginActionGroup
instead.
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> | ||
</after> | ||
|
||
<!-- Go to Stores > Attributes > Product , click "Add New Attribute" --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments are unnecessary, as the stepKeys should be self explanatory.
…o admin-area-product-attribute-can-save-with-html-tags-in-labels
Thank you very much for the feedback and the suggestions, @eduard13! |
@magento give me test instance |
Hi @eduard13. Thank you for your request. I'm working on Magento instance for you |
Hi @eduard13, here is your new Magento instance. |
…o admin-area-product-attribute-can-save-with-html-tags-in-labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the adjustments.
The failing tests aren't related to these changes/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve the conflict before proceeding with it
Pull Request state was updated. Re-review required.
…ibute-can-save-with-html-tags-in-labels # Conflicts # app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @vasilii-b.
Hi @eduard13, thank you for the review. |
@magento run Functional Tests CE, Functional Tests EE, Functional Tests B2B |
Hi @slavvka, thank you for the review. |
Hi @vasilii-b, thank you for your contribution! |
Description (*)
This PR adds changes to prevent the store owner to create product attributes which labels contain HTML tags.
HTML tags can be added to the following fields:
ℹ️ It doesn't make sense to allow HTML tags since those are escaped at the view level.
E.g.
magento2/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml
Line 37 in ac3eb00
Desired result
At the moment the store owner tries to save the attribute, the labels validation must happen and error messages shown to the user that HTML tags are not allowed.
Related Pull Requests
N/A
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
Without the fix
<span>
With the fix
<span>
Questions or comments
MFTF tests are on the way
Contribution checklist (*)