Skip to content

Commit ae2038e

Browse files
author
Burlacu Vasilii
committed
Refactored the MFTF tests according to the review
1 parent 03e3efb commit ae2038e

7 files changed

+64
-25
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminFillProductAttributeDefaultStoreViewActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<arguments>
1212
<argument name="value" type="string"/>
1313
</arguments>
14-
<fillField selector="{{ManageLabelsSection.DefaultStoreLabel}}" userInput="{{value}}" stepKey="fillDefaultStoreViewLabel"/>
14+
<fillField selector="{{AdminProductAttributeManageLabelsSection.DefaultStoreLabel}}" userInput="{{value}}" stepKey="fillDefaultStoreViewLabel"/>
1515
</actionGroup>
1616
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminNavigateToNewProductAttributePageActionGroup">
12+
<annotations>
13+
<description>Go to the create new product attribute page</description>
14+
</annotations>
15+
16+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/>
17+
<waitForPageLoad stepKey="waitForAttributePageLoad"/>
18+
</actionGroup>
19+
</actionGroups>
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="AdminSaveProductAttributeActionGroup">
12+
<annotations>
13+
<description>Clicks on Save button to save the attribute.</description>
14+
</annotations>
15+
16+
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
17+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/>
18+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeWithHtmlTagsInLabelActionGroup.xml renamed to app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertSeeProductAttributeHtmlTagsValidationErrorActionGroup.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="SaveProductAttributeWithHtmlTagsInLabelActionGroup">
11+
<actionGroup name="AssertSeeProductAttributeValidationErrorActionGroup">
1212
<annotations>
13-
<description>Clicks on Save. Validates that the HTML tags issue is present.</description>
13+
<description>Validates that the HTML tags issue is present on the attribute page after save.</description>
1414
</annotations>
1515

16-
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
17-
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveButton"/>
18-
<waitForPageLoad stepKey="waitForAttributeToSave"/>
19-
2016
<!-- See the error message on the "Manage Labels Tab" -->
2117
<seeElement selector="#attribute-labels-table .mage-error" stepKey="seeHtmlTagsUsageErrorMessage1"/>
2218

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@
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>
5853
<section name="WYSIWYGProductAttributeSection">
5954
<element name="ShowHideBtn" type="button" selector="#toggledefault_value_texteditor"/>
6055
<element name="InsertImageBtn" type="button" selector=".scalable.action-add-image.plugin"/>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AdminProductAttributeManageLabelsSection">
12+
<element name="ManageLabelsTab" selector="#product_attribute_tabs_labels" type="button"/>
13+
<element name="DefaultStoreLabel" type="input" selector="#attribute-labels-table [name='frontend_label[1]']"/>
14+
</section>
15+
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AdminProductAttributeLabelDontAllowHtmlTagsTest.xml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,27 @@
1818
<group value="catalog"/>
1919
</annotations>
2020
<before>
21-
<!-- Login as admin -->
22-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2322
</before>
2423
<after>
25-
<!-- Log out -->
26-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
2725
</after>
2826

29-
<!-- Go to Stores > Attributes > Product , click "Add New Attribute" -->
30-
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openProductAttributePage"/>
31-
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="createNewAttribute"/>
27+
<actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="openProductAttributePage"/>
3228

33-
<!-- Input value for Default Label -->
3429
<actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeDefaultLabel">
3530
<argument name="attributeName" value="{{productAttributeWithHtmlTagsInLabel.default_label}}"/>
3631
<argument name="attributeType" value="{{productAttributeWithHtmlTagsInLabel.frontend_input}}" />
3732
</actionGroup>
3833

39-
<!-- Click on "Manage Labels" tab on left menu -->
40-
<click selector="{{ManageLabelsSection.ManageLabelsTab}}" stepKey="clickManageLabelsTab"/>
34+
<click selector="{{AdminProductAttributeManageLabelsSection.ManageLabelsTab}}" stepKey="clickManageLabelsTab"/>
4135

42-
<!-- Input value for Default Store View -->
4336
<actionGroup ref="AdminFillProductAttributeDefaultStoreViewActionGroup" stepKey="fillAttributeDefaultStoreViewLabel">
4437
<argument name="value" value="{{productAttributeWithHtmlTagsInLabel.default_store_label}}"/>
4538
</actionGroup>
4639

47-
<!-- Save Product Attribute -->
48-
<actionGroup ref="SaveProductAttributeWithHtmlTagsInLabelActionGroup" stepKey="saveAttribute"/>
40+
<actionGroup ref="AdminSaveProductAttributeActionGroup" stepKey="saveAttribute"/>
41+
42+
<actionGroup ref="AssertSeeProductAttributeValidationErrorActionGroup" stepKey="validateAttributeLabelsForHtmlTags"/>
4943
</test>
5044
</tests>

0 commit comments

Comments
 (0)