Skip to content

Commit 29c858f

Browse files
committed
MC-4409: Convert UpdateProductAttributeEntityTest to MFTF
1 parent 9391977 commit 29c858f

6 files changed

+196
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,13 @@
5454
<waitForPageLoad stepKey="waitForUserInput"/>
5555
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/>
5656
</actionGroup>
57+
<actionGroup name="FilterProductAttributeSetGridByAttributeSetName">
58+
<arguments>
59+
<argument name="name" type="string"/>
60+
</arguments>
61+
<click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/>
62+
<fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/>
63+
<click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/>
64+
<click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/>
65+
</actionGroup>
5766
</actionGroups>

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,27 @@
7373
<data key="used_for_sort_by">true</data>
7474
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
7575
</entity>
76+
<entity name="productDropDownAttributeNotSearchable" type="ProductAttribute">
77+
<data key="attribute_code" unique="suffix">attribute</data>
78+
<data key="frontend_input">select</data>
79+
<data key="scope">global</data>
80+
<data key="is_required">false</data>
81+
<data key="is_unique">false</data>
82+
<data key="is_searchable">false</data>
83+
<data key="is_visible">true</data>
84+
<data key="is_visible_in_advanced_search">true</data>
85+
<data key="is_visible_on_front">true</data>
86+
<data key="is_filterable">true</data>
87+
<data key="is_filterable_in_search">true</data>
88+
<data key="used_in_product_listing">true</data>
89+
<data key="is_used_for_promo_rules">true</data>
90+
<data key="is_comparable">true</data>
91+
<data key="is_used_in_grid">true</data>
92+
<data key="is_visible_in_grid">true</data>
93+
<data key="is_filterable_in_grid">true</data>
94+
<data key="used_for_sort_by">true</data>
95+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
96+
</entity>
7697
<entity name="productAttributeWithDropdownTwoOptions" type="ProductAttribute">
7798
<data key="attribute_code">testattribute</data>
7899
<data key="frontend_input">select</data>
@@ -115,6 +136,27 @@
115136
<data key="used_for_sort_by">true</data>
116137
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
117138
</entity>
139+
<entity name="productAttributeMultiselectTwoOptionsNotSearchable" type="ProductAttribute">
140+
<data key="attribute_code" unique="suffix">attribute</data>
141+
<data key="frontend_input">multiselect</data>
142+
<data key="scope">global</data>
143+
<data key="is_required">false</data>
144+
<data key="is_unique">false</data>
145+
<data key="is_searchable">false</data>
146+
<data key="is_visible">true</data>
147+
<data key="is_visible_in_advanced_search">true</data>
148+
<data key="is_visible_on_front">true</data>
149+
<data key="is_filterable">true</data>
150+
<data key="is_filterable_in_search">true</data>
151+
<data key="used_in_product_listing">true</data>
152+
<data key="is_used_for_promo_rules">true</data>
153+
<data key="is_comparable">true</data>
154+
<data key="is_used_in_grid">true</data>
155+
<data key="is_visible_in_grid">true</data>
156+
<data key="is_filterable_in_grid">true</data>
157+
<data key="used_for_sort_by">true</data>
158+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
159+
</entity>
118160
<entity name="newsFromDate" type="ProductAttribute">
119161
<data key="attribute_code">news_from_date</data>
120162
<data key="default_frontend_label">Set Product as New from Date</data>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,7 @@
8181
<element name="AddToColumnOptions" type="select" selector="#is_used_in_grid"/>
8282
<element name="UseInFilterOptions" type="select" selector="#is_filterable_in_grid"/>
8383
<element name="UseInProductListing" type="select" selector="#used_in_product_listing"/>
84+
<element name="UseInSearch" type="select" selector="#is_searchable"/>
85+
<element name="VisibleInAdvancedSearch" type="select" selector="#is_visible_in_advanced_search"/>
8486
</section>
8587
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="nthRow" type="block" selector="#setGrid_table tbody tr:nth-of-type({{var1}})" parameterized="true"/>
1515
<element name="AttributeSetName" type="text" selector="//td[contains(text(), '{{var1}}')]" parameterized="true"/>
1616
<element name="addAttributeSetBtn" type="button" selector="button.add-set" timeout="30"/>
17+
<element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
1718
</section>
1819
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Create product Dropdown attribute and check its visibility on frontend in Advanced Search form"/>
14+
<title value="AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest"/>
15+
<description value="Admin should able to create product Dropdown attribute and check its visibility on frontend in Advanced Search form"/>
16+
<testCaseId value="MC-10827"/>
17+
<severity value="CRITICAL"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<!-- Create product attribute with 2 options -->
22+
<createData entity="productDropDownAttributeNotSearchable" stepKey="attribute"/>
23+
<createData entity="productAttributeOption1" stepKey="option1">
24+
<requiredEntity createDataKey="attribute"/>
25+
</createData>
26+
<createData entity="productAttributeOption2" stepKey="option2">
27+
<requiredEntity createDataKey="attribute"/>
28+
</createData>
29+
<!-- Create product attribute set -->
30+
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
31+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
32+
</before>
33+
<!-- Filter product attribute set by attribute set name -->
34+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/>
35+
<actionGroup ref="FilterProductAttributeSetGridByAttributeSetName" stepKey="filterProductAttrSetGridByAttrSetName">
36+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
37+
</actionGroup>
38+
<!-- Assert created attribute in an unassigned attributes -->
39+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/>
40+
<!-- Assign attribute in the group -->
41+
<actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup">
42+
<argument name="group" value="Product Details"/>
43+
<argument name="attribute" value="$$attribute.attribute_code$$"/>
44+
</actionGroup>
45+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
46+
<actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/>
47+
<!-- Go to Product Attribute Grid page -->
48+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
49+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="$$attribute.attribute_code$$" stepKey="fillAttrCodeField" />
50+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickSearchBtn" />
51+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="chooseFirstRow" />
52+
<!-- Change attribute property: Frontend Label -->
53+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{productDropDownAttribute.attribute_code}}" stepKey="fillDefaultLabel"/>
54+
<!-- Change attribute property: Use in Search >Yes -->
55+
<scrollToTopOfPage stepKey="scrollToTabs"/>
56+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/>
57+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" stepKey="waitTabLoad"/>
58+
<selectOption selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" userInput="Yes" stepKey="seeInSearch"/>
59+
<!-- Change attribute property: Visible In Advanced Search >No -->
60+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.VisibleInAdvancedSearch}}" stepKey="waitTabLoad2"/>
61+
<selectOption selector="{{AdvancedAttributePropertiesSection.VisibleInAdvancedSearch}}" userInput="No" stepKey="dontSeeInAdvancedSearch"/>
62+
<!-- Save the new product attributes -->
63+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSave"/>
64+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
65+
<!-- Flash cache -->
66+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
67+
<!-- Go to store's advanced catalog search page -->
68+
<actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/>
69+
<dontSeeElement selector="{{StorefrontCatalogSearchAdvancedFormSection.AttributeByCode('$$attribute.attribute_code$$')}}" stepKey="dontSeeAttribute"/>
70+
</test>
71+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Create Multiple Select product attribute and check its visibility in Advanced Search form"/>
14+
<title value="Create product attribute of type Multiple Select and check its visibility on frontend in Advanced Search form"/>
15+
<description value="Admin should be able to create product attribute of type Multiple Select and check its visibility on frontend in Advanced Search form"/>
16+
<testCaseId value="MC-10828"/>
17+
<severity value="CRITICAL"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<!-- Create a multiple select product attribute with two options -->
22+
<createData entity="productAttributeMultiSelectTwoOptionsNotSearchable" stepKey="attribute"/>
23+
<createData entity="productAttributeOption1" stepKey="option1">
24+
<requiredEntity createDataKey="attribute"/>
25+
</createData>
26+
<createData entity="productAttributeOption2" stepKey="option2">
27+
<requiredEntity createDataKey="attribute"/>
28+
</createData>
29+
<!-- Create product attribute set -->
30+
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
31+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
32+
</before>
33+
<!-- Filter product attribute set by attribute set name -->
34+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/>
35+
<actionGroup ref="FilterProductAttributeSetGridByAttributeSetName" stepKey="filterProductAttrSetGridByAttrSetName">
36+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
37+
</actionGroup>
38+
<!-- Assert created attribute in an unassigned attributes -->
39+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassignedAttr"/>
40+
<!-- Assign attribute in the group -->
41+
<actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup">
42+
<argument name="group" value="Product Details"/>
43+
<argument name="attribute" value="$$attribute.attribute_code$$"/>
44+
</actionGroup>
45+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
46+
<actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/>
47+
<!-- Go to Product Attribute Grid page -->
48+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
49+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="$$attribute.attribute_code$$" stepKey="fillAttrCodeField" />
50+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickSearchBtn" />
51+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="chooseFirstRow" />
52+
<!-- Change attribute property: Frontend Label -->
53+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{productDropDownAttribute.attribute_code}}" stepKey="fillDefaultLabel"/>
54+
<!-- Change attribute property: Use in Search >Yes -->
55+
<scrollToTopOfPage stepKey="scrollToTabs"/>
56+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/>
57+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" stepKey="waitTabLoad"/>
58+
<selectOption selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" userInput="Yes" stepKey="seeInSearch"/>
59+
<!-- Change attribute property: Visible In Advanced Search >No -->
60+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.VisibleInAdvancedSearch}}" stepKey="waitTabLoad2"/>
61+
<selectOption selector="{{AdvancedAttributePropertiesSection.VisibleInAdvancedSearch}}" userInput="No" stepKey="dontSeeInAdvancedSearch"/>
62+
<!-- Save the new product attributes -->
63+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSave"/>
64+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
65+
<!-- Flash cache -->
66+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
67+
<!-- Go to store's advanced catalog search page -->
68+
<actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/>
69+
<dontSeeElement selector="{{StorefrontCatalogSearchAdvancedFormSection.AttributeByCode('$$attribute.attribute_code$$')}}" stepKey="dontSeeAttribute"/>
70+
</test>
71+
</tests>

0 commit comments

Comments
 (0)