-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [Magento Community Engineering] Community Contributions
Accepted Community Pull Requests: - #27371: [Admin] Do not allow HTML tags for the Product Attribute labels on save (by @vasilii-b)
- Loading branch information
Showing
15 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...to/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributeDefaultStoreViewActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminFillProductAttributeDefaultStoreViewActionGroup"> | ||
<arguments> | ||
<argument name="value" type="string"/> | ||
</arguments> | ||
<fillField selector="{{AdminProductAttributeManageLabelsSection.DefaultStoreLabel}}" userInput="{{value}}" stepKey="fillDefaultStoreViewLabel"/> | ||
</actionGroup> | ||
</actionGroups> |
19 changes: 19 additions & 0 deletions
19
...gento/Catalog/Test/Mftf/ActionGroup/AdminNavigateToNewProductAttributePageActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminNavigateToNewProductAttributePageActionGroup"> | ||
<annotations> | ||
<description>Go to the create new product attribute page</description> | ||
</annotations> | ||
|
||
<amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/> | ||
<waitForPageLoad stepKey="waitForAttributePageLoad"/> | ||
</actionGroup> | ||
</actionGroups> |
21 changes: 21 additions & 0 deletions
21
...e/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributePageSwitchTabActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminProductAttributePageSwitchTabActionGroup"> | ||
<annotations> | ||
<description>Switches the active tab on the Product Attribute New/Edit Page</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="tabName" type="string"/> | ||
</arguments> | ||
|
||
<click selector="{{AdminEditProductAttributesSection.tabButton(tabName)}}" stepKey="changeProductAttributeActiveTab"/> | ||
</actionGroup> | ||
</actionGroups> |
20 changes: 20 additions & 0 deletions
20
app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSaveProductAttributeActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminSaveProductAttributeActionGroup"> | ||
<annotations> | ||
<description>Clicks on Save button to save the attribute.</description> | ||
</annotations> | ||
|
||
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/> | ||
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/> | ||
<waitForPageLoad stepKey="waitForAttributeToSave"/> | ||
</actionGroup> | ||
</actionGroups> |
22 changes: 22 additions & 0 deletions
22
...Mftf/ActionGroup/AssertSeeProductAttributeValidationErrorOnManageLabelsTabActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AssertSeeProductAttributeValidationErrorOnManageLabelsTabActionGroup"> | ||
<annotations> | ||
<description>Check whenever the validation error is present for the product attribute in the "Manage Labels" Tab</description> | ||
</annotations> | ||
|
||
<arguments> | ||
<argument name="message" type="string"/> | ||
</arguments> | ||
|
||
<see userInput="{{message}}" selector="{{AdminProductAttributeManageLabelsSection.attributeStoreLabelValidationError}}" stepKey="seeValidationMessage"/> | ||
</actionGroup> | ||
</actionGroups> |
22 changes: 22 additions & 0 deletions
22
...t/Mftf/ActionGroup/AssertSeeProductAttributeValidationErrorOnPropertiesTabActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AssertSeeProductAttributeValidationErrorOnPropertiesTabActionGroup"> | ||
<annotations> | ||
<description>Check whenever the validation error is present for the product attribute in the "Properties" Tab</description> | ||
</annotations> | ||
|
||
<arguments> | ||
<argument name="message" type="string"/> | ||
</arguments> | ||
|
||
<see userInput="{{message}}" selector="{{AttributePropertiesSection.attributeLabelValidationError}}" stepKey="seeValidationMessage"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeManageLabelsSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="AdminProductAttributeManageLabelsSection"> | ||
<element name="DefaultStoreLabel" type="input" selector="#attribute-labels-table [name='frontend_label[1]']"/> | ||
<element name="attributeStoreLabelValidationError" type="text" selector="#attribute-labels-table .mage-error"/> | ||
</section> | ||
</sections> |
56 changes: 56 additions & 0 deletions
56
app/code/Magento/Catalog/Test/Mftf/Test/AdminProductAttributeLabelDontAllowHtmlTagsTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="AdminProductAttributeLabelDontAllowHtmlTagsTest"> | ||
<annotations> | ||
<features value="Catalog"/> | ||
<stories value="Product Attribute label must not contain HTML tags"/> | ||
<title value="Product Attribute label musts not contain HTML tags"/> | ||
<description value="Test whenever HTML tags are allowed for a product attribute label"/> | ||
<severity value="CRITICAL"/> | ||
<group value="catalog"/> | ||
</annotations> | ||
<before> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> | ||
</before> | ||
<after> | ||
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> | ||
</after> | ||
|
||
<actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="openProductAttributePage"/> | ||
|
||
<actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeDefaultLabel"> | ||
<argument name="attributeName" value="{{productAttributeWithHtmlTagsInLabel.default_label}}"/> | ||
<argument name="attributeType" value="{{productAttributeWithHtmlTagsInLabel.frontend_input}}" /> | ||
</actionGroup> | ||
|
||
<actionGroup ref="AdminProductAttributePageSwitchTabActionGroup" stepKey="makeManageLabelsTabActive"> | ||
<argument name="tabName" value="Manage Labels"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="AdminFillProductAttributeDefaultStoreViewActionGroup" stepKey="fillAttributeDefaultStoreViewLabel"> | ||
<argument name="value" value="{{productAttributeWithHtmlTagsInLabel.default_store_label}}"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="AdminSaveProductAttributeActionGroup" stepKey="saveAttribute"/> | ||
|
||
<actionGroup ref="AssertSeeProductAttributeValidationErrorOnManageLabelsTabActionGroup" stepKey="validateAttributeStoreViewLabelForHtmlTags"> | ||
<argument name="message" value="HTML tags are not allowed"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="AdminProductAttributePageSwitchTabActionGroup" stepKey="makePropertiesTabActive"> | ||
<argument name="tabName" value="Properties"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="AssertSeeProductAttributeValidationErrorOnPropertiesTabActionGroup" stepKey="validateAttributeLabelForHtmlTags"> | ||
<argument name="message" value="HTML tags are not allowed"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters