Skip to content

Commit d36b769

Browse files
committed
MC-170: Admin should be able to create new group in an Attribute Set
1 parent 68599ef commit d36b769

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="customGroup">
12+
<data key="name">Custom Group</data>
13+
</entity>
14+
<entity name="emptyGroup">
15+
<data key="name">Empty Group</data>
16+
</entity>
17+
<entity name="newGroup">
18+
<data key="name">New Group</data>
19+
</entity>
20+
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/>
7171
<element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/>
7272
<element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/>
73+
<element name="footerBlock" type="block" selector="//footer"/>
7374
</section>
7475
<section name="ProductInWebsitesSection">
7576
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
<group value="Catalog"/>
1919
</annotations>
2020
<before>
21-
<!-- Create a custom attribute set and custom product attribute -->
22-
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
23-
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
21+
<!-- Create a custom attribute set and custom product attribute -->
22+
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
23+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
24+
25+
<!-- Login to Admin -->
26+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
2427
</before>
2528
<after>
2629
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
2730
<actionGroup ref="logout" stepKey="logout"/>
2831
</after>
29-
<!-- Login to Admin -->
30-
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
3132

3233
<!-- Navigate to Stores > Attributes > Attribute Set -->
3334
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
@@ -50,17 +51,17 @@
5051
<see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/>
5152

5253
<!-- Fill 'name' for new group and click 'Ok': Name = Custom group -->
53-
<fillField userInput="Custom group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/>
54+
<fillField userInput="{{customGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/>
5455
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/>
5556

5657
<!-- Group is created and displayed in 'Groups' block -->
57-
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom group')}}" stepKey="assertCustomGroup"/>
58+
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(customGroup.name)}}" stepKey="assertCustomGroup"/>
5859

5960
<!-- Move custom Product Attribute to new 'Custom group' Group -->
6061
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
61-
<click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="click"/>
62+
<click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="click"/>
6263
<waitForPageLoad stepKey="waitForPageLoadAfterClick"/>
63-
<dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="moveAttribute"/>
64+
<dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="moveAttribute"/>
6465
<waitForPageLoad stepKey="waitForDragAndDrop"/>
6566

6667
<!-- Attribute is displayed in the new group -->
@@ -77,13 +78,13 @@
7778
<click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddEmptyGroup"/>
7879
<waitForAjaxLoad stepKey="waitForLoad"/>
7980

80-
<fillField userInput="Empty group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/>
81+
<fillField userInput="{{emptyGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/>
8182
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOnOk"/>
8283
<waitForPageLoad stepKey="waitForNewGroup"/>
8384

8485
<!-- Empty group is created. No attributes are assigned to it. -->
85-
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Empty group')}}" stepKey="assertEmptyGroup"/>
86-
<dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup('Empty group')}}" stepKey="seeNoAttributes"/>
86+
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(emptyGroup.name)}}" stepKey="assertEmptyGroup"/>
87+
<dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup(emptyGroup.name)}}" stepKey="seeNoAttributes"/>
8788

8889
<!-- Navigate to Catalog > Products -->
8990
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/>
@@ -98,13 +99,13 @@
9899
</actionGroup>
99100

100101
<!-- New Section 'Custom group' is present in form. The section contains the attribute from preconditions -->
101-
<seeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="seeSectionCustomGroup"/>
102-
<click selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="openCustomGroupSection"/>
102+
<seeElement selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="seeSectionCustomGroup"/>
103+
<click selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="openCustomGroupSection"/>
103104
<waitForAjaxLoad stepKey="waitForOpenSection"/>
104-
<scrollTo selector="//footer" stepKey="scrollToFooter"/>
105-
<seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName('Custom group')}}" stepKey="seeAttributePresent"/>
105+
<scrollTo selector="{{AdminProductFormSection.footerBlock}}" stepKey="scrollToFooter"/>
106+
<seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName(customGroup.name)}}" stepKey="seeAttributePresent"/>
106107

107108
<!-- Empty section is absent in Product Form -->
108-
<dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Empty group')}}" stepKey="dontSeeEmptyGroup"/>
109+
<dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName(emptyGroup.name)}}" stepKey="dontSeeEmptyGroup"/>
109110
</test>
110111
</tests>

0 commit comments

Comments
 (0)