Skip to content

Commit 2e3128f

Browse files
author
Burlacu Vasilii
committed
Added the MFTF test that checks attribute won't save with HTML tags in labels
1 parent b4b22a4 commit 2e3128f

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminFillProductAttributeDefaultStoreViewActionGroup">
11+
<arguments>
12+
<argument name="value" type="string"/>
13+
</arguments>
14+
<fillField selector="{{ManageLabelsSection.DefaultStoreLabel}}" userInput="{{value}}" stepKey="fillDefaultStoreViewLabel"/>
15+
</actionGroup>
16+
</actionGroups>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="SaveProductAttributeWithHtmlTagsInLabelActionGroup">
12+
<annotations>
13+
<description>Clicks on Save. Validates that the HTML tags issue is present.</description>
14+
</annotations>
15+
16+
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
17+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/>
18+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
19+
20+
<!-- See the error message on the "Manage Labels Tab" -->
21+
<seeElement selector="#attribute-labels-table .mage-error" stepKey="seeHtmlTagsUsageErrorMessage1"/>
22+
23+
<!-- Click on "Properties" tab on left menu -->
24+
<click selector="{{AttributePropertiesSection.propertiesTab}}" stepKey="clickPropertiesTab"/>
25+
26+
<!-- See the error message on the "Properties" Tab -->
27+
<seeElement selector=".field-attribute_label .mage-error" stepKey="seeHtmlTagsUsageErrorMessage2"/>
28+
</actionGroup>
29+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,11 @@
406406
<data key="frontend_label">Size</data>
407407
<data key="attribute_code" unique="suffix">size_attr</data>
408408
</entity>
409+
<entity name="productAttributeWithHtmlTagsInLabel" extends="newProductAttribute" type="ProductAttribute">
410+
<data key="default_label" unique="suffix">Attribute Default label &lt;span&gt;</data>
411+
<data key="default_store_label" unique="suffix">Attribute Store label &lt;span&gt; </data>
412+
<data key="frontend_input">text</data>
413+
</entity>
409414
<!-- Product attribute from file "export_import_configurable_product.csv" -->
410415
<entity name="ProductAttributeWithTwoOptionsForExportImport" extends="productAttributeDropdownTwoOptions" type="ProductAttribute">
411416
<data key="attribute_code">attribute</data>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<element name="StorefrontPropertiesSectionToggle" type="button" selector="#front_fieldset-wrapper"/>
5151
<element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/>
5252
</section>
53+
<section name="ManageLabelsSection">
54+
<element name="PageTitle" type="text" selector="//span[text()='Manage Titles (Size, Color, etc.)']" />
55+
<element name="ManageLabelsTab" selector="#product_attribute_tabs_labels" type="button"/>
56+
<element name="DefaultStoreLabel" type="input" selector="#attribute-labels-table [name='frontend_label[1]']"/>
57+
</section>
5358
<section name="WYSIWYGProductAttributeSection">
5459
<element name="ShowHideBtn" type="button" selector="#toggledefault_value_texteditor"/>
5560
<element name="InsertImageBtn" type="button" selector=".scalable.action-add-image.plugin"/>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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="AdminProductAttributeLabelDontAllowHtmlTagsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Product Attribute label must not contain HTML tags"/>
15+
<title value="Product Attribute label musts not contain HTML tags"/>
16+
<description value="Test whenever HTML tags are allowed for a product attribute label"/>
17+
<severity value="CRITICAL"/>
18+
<group value="catalog"/>
19+
</annotations>
20+
<before>
21+
<!-- Login as admin -->
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<!-- Log out -->
26+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
27+
</after>
28+
29+
<!-- Go to Stores > Attributes > Product , click "Add New Attribute" -->
30+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openProductAttributePage"/>
31+
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="createNewAttribute"/>
32+
33+
<!-- Input value for Default Label -->
34+
<actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeDefaultLabel">
35+
<argument name="attributeName" value="{{productAttributeWithHtmlTagsInLabel.default_label}}"/>
36+
<argument name="attributeType" value="{{productAttributeWithHtmlTagsInLabel.frontend_input}}" />
37+
</actionGroup>
38+
39+
<!-- Click on "Manage Labels" tab on left menu -->
40+
<click selector="{{ManageLabelsSection.ManageLabelsTab}}" stepKey="clickManageLabelsTab"/>
41+
42+
<!-- Input value for Default Store View -->
43+
<actionGroup ref="AdminFillProductAttributeDefaultStoreViewActionGroup" stepKey="fillAttributeDefaultStoreViewLabel">
44+
<argument name="value" value="{{productAttributeWithHtmlTagsInLabel.default_store_label}}"/>
45+
</actionGroup>
46+
47+
<!-- Save Product Attribute -->
48+
<actionGroup ref="SaveProductAttributeWithHtmlTagsInLabelActionGroup" stepKey="saveAttribute"/>
49+
</test>
50+
</tests>

0 commit comments

Comments
 (0)