Skip to content

Commit 6d8a87e

Browse files
committed
MC-168: Admin should be able to assign attributes to an attribute set
- added MFTF test
1 parent af966c9 commit 6d8a87e

File tree

6 files changed

+146
-0
lines changed

6 files changed

+146
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssignAttributeToGroup">
12+
<arguments>
13+
<argument name="group" type="string"/>
14+
<argument name="attribute" type="string"/>
15+
</arguments>
16+
<conditionalClick selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(group)}}" dependentSelector="{{AdminProductAttributeSetEditSection.attributeGroupCollapsed(group)}}" visible="true" stepKey="extendGroup"/>
17+
<waitForPageLoad stepKey="waitForPageLoad1"/>
18+
<dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute(attribute)}}" selector2="{{AdminProductAttributeSetEditSection.xThLineItemAttributeGroup(group, '1')}}" stepKey="dragAndDropToGroupProductDetails"/>
19+
<waitForPageLoad stepKey="waitForPageLoad2"/>
20+
<see userInput="{{attribute}}" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
21+
</actionGroup>
22+
<actionGroup name="UnassignAttributeFromGroup">
23+
<arguments>
24+
<argument name="ProductAttribute"/>
25+
</arguments>
26+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
27+
<waitForPageLoad stepKey="waitForPageLoad1"/>
28+
<click selector="{{AdminProductAttributeGridSection.AttributeCode(ProductAttribute.attribute_code)}}" stepKey="navigateToAttributeEditPage1" />
29+
<waitForPageLoad stepKey="waitForPageLoad2" />
30+
</actionGroup>
31+
<actionGroup name="SaveAttributeSet">
32+
<click selector="{{AdminProductAttributeSetActionSection.save}}" stepKey="clickSave"/>
33+
<see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/>
34+
</actionGroup>
35+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
10+
<page name="AdminProductAttributeSetEditPage" url="catalog/product_set/edit/id" area="admin" module="Catalog">
11+
<section name="AdminProductAttributeSetEditSection"/>
12+
</page>
13+
</pages>
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+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductAttributeSetActionSection">
12+
<element name="save" type="button" selector="button[title='Save']" timeout="30"/>
13+
<element name="reset" type="button" selector="button[title='Reset']" timeout="30"/>
14+
<element name="back" type="button" selector="button[title='Back']" timeout="30"/>
15+
</section>
16+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductAttributeSetEditSection">
12+
<!-- Groups Column -->
13+
<element name="groupTree" type="block" selector="#tree-div1"/>
14+
<element name="attributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']" parameterized="true"/>
15+
<element name="attributeGroupExtender" type="button" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']" parameterized="true"/>
16+
<element name="attributeGroupCollapsed" type="button" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*[contains(@class, 'collapsed')]" parameterized="true"/>
17+
<element name="xThLineItemYthAttributeGroup" type="text" selector="//*[@id='tree-div1']/ul/div/li[{{y}}]//li[{{x}}]" parameterized="true"/>
18+
<element name="xThLineItemAttributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*/parent::*//li[{{x}}]//a/span" parameterized="true"/>
19+
<!-- Unassigned Attributes Column -->
20+
<element name="unassignedAttributesTree" type="block" selector="#tree-div2"/>
21+
<element name="unassignedAttribute" type="text" selector="//*[@id='tree-div2']//span[text()='{{attributeName}}']" parameterized="true"/>
22+
<element name="xThLineItemUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]" parameterized="true"/>
23+
<element name="xThElbowLineUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]//img[contains(@class, 'elbow')]" parameterized="true"/>
24+
</section>
25+
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
3434
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
3535
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
36+
<element name="attributeLabel" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
3637
</section>
3738
<section name="ProductInWebsitesSection">
3839
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminAssignProductAttributeToAttributeSetTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Add/Update attribute set"/>
15+
<title value="Admin should be able to assign attributes to an attribute set"/>
16+
<description value="Admin should be able to assign attributes to an attribute set"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-168"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<createData entity="productDropDownAttribute" stepKey="attribute"/>
23+
24+
<createData entity="productAttributeOption1" stepKey="option1">
25+
<requiredEntity createDataKey="attribute"/>
26+
</createData>
27+
<createData entity="productAttributeOption2" stepKey="option2">
28+
<requiredEntity createDataKey="attribute"/>
29+
</createData>
30+
31+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
32+
</before>
33+
<after>
34+
<deleteData createDataKey="attribute" stepKey="deleteAttribute"/>
35+
<actionGroup ref="logout" stepKey="logout"/>
36+
</after>
37+
38+
<!-- Go to default attribute set edit page -->
39+
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/{{AddToDefaultSet.attributeSetId}}/" stepKey="onAttributeSetEdit"/>
40+
<!-- Assert created attribute in unassigned section -->
41+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/>
42+
<!-- Assign attribute to a group -->
43+
<actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup">
44+
<argument name="group" value="Product Details"/>
45+
<argument name="attribute" value="$$attribute.attribute_code$$"/>
46+
</actionGroup>
47+
<!-- Assert attribute in a group -->
48+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
49+
<!-- Save attribute set -->
50+
<actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/>
51+
<!-- Go to create new product page -->
52+
<amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/>
53+
<!-- Assert attribute can be used in product creation -->
54+
<seeElement selector="{{AdminProductFormSection.attributeLabel($$attribute.attribute[frontend_labels][0][label]$$)}}" stepKey="seeLabel"/>
55+
</test>
56+
</tests>

0 commit comments

Comments
 (0)