Skip to content

Commit e07a872

Browse files
committed
MC-194: Admin should be able to unassign attributes from an attribute set
- added MFTF test
1 parent 6d8a87e commit e07a872

File tree

5 files changed

+117
-6
lines changed

5 files changed

+117
-6
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductAttributeSetActionGroup.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
</actionGroup>
2222
<actionGroup name="UnassignAttributeFromGroup">
2323
<arguments>
24-
<argument name="ProductAttribute"/>
24+
<argument name="group" type="string"/>
25+
<argument name="attribute" type="string"/>
2526
</arguments>
26-
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
27+
<conditionalClick selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(group)}}" dependentSelector="{{AdminProductAttributeSetEditSection.attributeGroupCollapsed(group)}}" visible="true" stepKey="extendGroup"/>
2728
<waitForPageLoad stepKey="waitForPageLoad1"/>
28-
<click selector="{{AdminProductAttributeGridSection.AttributeCode(ProductAttribute.attribute_code)}}" stepKey="navigateToAttributeEditPage1" />
29-
<waitForPageLoad stepKey="waitForPageLoad2" />
29+
<dragAndDrop selector1="{{AdminProductAttributeSetEditSection.assignedAttribute(attribute)}}" selector2="{{AdminProductAttributeSetEditSection.xThLineItemUnassignedAttribute('1')}}" stepKey="dragAndDropToUnassigned"/>
30+
<waitForPageLoad stepKey="waitForPageLoad2"/>
31+
<see userInput="{{attribute}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/>
3032
</actionGroup>
3133
<actionGroup name="SaveAttributeSet">
3234
<click selector="{{AdminProductAttributeSetActionSection.save}}" stepKey="clickSave"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontProductPageActionGroup.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,20 @@
2121
<waitForPageLoad stepKey="waitForPageLoad"/>
2222
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
2323
</actionGroup>
24+
<actionGroup name="checkAttributeInMoreInformationTab">
25+
<arguments>
26+
<argument name="attributeLabel" type="string"/>
27+
<argument name="attributeValue" type="string"/>
28+
</arguments>
29+
<click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/>
30+
<see userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/>
31+
<see userInput="{{attributeValue}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeValue"/>
32+
</actionGroup>
33+
<actionGroup name="checkAttributeNotInMoreInformationTab">
34+
<arguments>
35+
<argument name="attributeLabel" type="string"/>
36+
</arguments>
37+
<click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickTab"/>
38+
<dontSee userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="seeAttributeLabel"/>
39+
</actionGroup>
2440
</actionGroups>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<element name="attributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']" parameterized="true"/>
1515
<element name="attributeGroupExtender" type="button" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']" parameterized="true"/>
1616
<element name="attributeGroupCollapsed" type="button" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*[contains(@class, 'collapsed')]" parameterized="true"/>
17+
<element name="assignedAttribute" type="text" selector="//*[@id='tree-div1']//span[text()='{{attributeName}}']" parameterized="true"/>
1718
<element name="xThLineItemYthAttributeGroup" type="text" selector="//*[@id='tree-div1']/ul/div/li[{{y}}]//li[{{x}}]" parameterized="true"/>
1819
<element name="xThLineItemAttributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*/parent::*//li[{{x}}]//a/span" parameterized="true"/>
1920
<!-- Unassigned Attributes Column -->
2021
<element name="unassignedAttributesTree" type="block" selector="#tree-div2"/>
2122
<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"/>
23+
<element name="xThLineItemUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]//a/span" parameterized="true"/>
2424
</section>
2525
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="StorefrontProductMoreInformationSection">
12+
<element name="moreInformation" type="button" selector="#tab-label-additional-title" timeout="30"/>
13+
<element name="moreInformationTextArea" type="textarea" selector="#additional"/>
14+
<element name="attributeLabel" type="text" selector=".col.label"/>
15+
<element name="attributeValue" type="text" selector=".col.data"/>
16+
</section>
17+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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="AdminUnassignProductAttributeFromAttributeSetTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Add/Update attribute set"/>
15+
<title value="Admin should be able to unassign attributes from an attribute set"/>
16+
<description value="Admin should be able to unassign attributes from an attribute set"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-194"/>
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+
<createData entity="AddToDefaultSet" stepKey="addToDefaultSet">
32+
<requiredEntity createDataKey="attribute"/>
33+
</createData>
34+
35+
<createData entity="ApiProductWithDescription" stepKey="product"/>
36+
37+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="attribute" stepKey="deleteAttribute"/>
41+
<actionGroup ref="logout" stepKey="logout"/>
42+
</after>
43+
44+
<!-- Assert attribute presence in storefront product additional information -->
45+
<amOnPage url="/$$product.custom_attributes[url_key]$$.html" stepKey="onProductPage1"/>
46+
<waitForPageLoad stepKey="wait1"/>
47+
<actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkAttributeInMoreInformationTab">
48+
<argument name="attributeLabel" value="$$attribute.attribute[frontend_labels][0][label]$$"/>
49+
<argument name="attributeValue" value="$$option2.option[store_labels][0][label]$$"/>
50+
</actionGroup>
51+
<!-- Go to default attribute set edit page -->
52+
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/{{AddToDefaultSet.attributeSetId}}/" stepKey="onAttributeSetEdit"/>
53+
<!-- Assert created attribute in a group -->
54+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
55+
<!-- Unassign attribute from group -->
56+
<actionGroup ref="UnassignAttributeFromGroup" stepKey="UnassignAttributeFromGroup">
57+
<argument name="group" value="Product Details"/>
58+
<argument name="attribute" value="$$attribute.attribute_code$$"/>
59+
</actionGroup>
60+
<!-- Assert attribute in unassigned section -->
61+
<see userInput="$$attribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/>
62+
<!-- Save attribute set -->
63+
<actionGroup ref="SaveAttributeSet" stepKey="SaveAttributeSet"/>
64+
<!-- Go to create new product page -->
65+
<amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/>
66+
<!-- Assert attribute not present in product creation -->
67+
<dontSeeElement selector="{{AdminProductFormSection.attributeLabel($$attribute.attribute[frontend_labels][0][label]$$)}}" stepKey="seeLabel"/>
68+
<!-- Assert removed attribute not presence in storefront product additional information -->
69+
<amOnPage url="/$$product.custom_attributes[url_key]$$.html" stepKey="onProductPage2"/>
70+
<waitForPageLoad stepKey="wait2"/>
71+
<!-- Skip because of MAGETWO-92780 -->
72+
<!--actionGroup ref="checkAttributeNotInMoreInformationTab" stepKey="checkAttributeNotInMoreInformationTab">
73+
<argument name="attributeLabel" value="$$attribute.attribute[frontend_labels][0][label]$$"/>
74+
</actionGroup-->
75+
</test>
76+
</tests>

0 commit comments

Comments
 (0)