Skip to content

Commit 04e79d6

Browse files
authored
Merge pull request #137 from magento-pangolin/MC-170
MC-170
2 parents bc0940d + 40c1305 commit 04e79d6

File tree

4 files changed

+138
-0
lines changed

4 files changed

+138
-0
lines changed
Lines changed: 17 additions & 0 deletions
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+
<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+
</entities>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717
<element name="assignedAttribute" type="text" selector="//*[@id='tree-div1']//span[text()='{{attributeName}}']" parameterized="true"/>
1818
<element name="xThLineItemYthAttributeGroup" type="text" selector="//*[@id='tree-div1']/ul/div/li[{{y}}]//li[{{x}}]" parameterized="true"/>
1919
<element name="xThLineItemAttributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*/parent::*//li[{{x}}]//a/span" parameterized="true"/>
20+
<element name="attributesInGroup" type="text" selector="//span[text()='{{GroupName}}']/../../following-sibling::ul/li" parameterized="true"/>
2021
<!-- Unassigned Attributes Column -->
2122
<element name="unassignedAttributesTree" type="block" selector="#tree-div2"/>
2223
<element name="unassignedAttribute" type="text" selector="//*[@id='tree-div2']//span[text()='{{attributeName}}']" parameterized="true"/>
2324
<element name="xThLineItemUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]//a/span" parameterized="true"/>
25+
<!-- Buttons -->
26+
<element name="AddNewGroup" type="button" selector="button[data-ui-id='adminhtml-catalog-product-set-edit-add-group-button']"/>
27+
<!-- Modal Window Add New Group -->
28+
<element name="newGroupName" type="input" selector="input[data-role='promptField']"/>
29+
<element name="buttonOk" type="button" selector=".modal-footer .action-primary.action-accept"/>
30+
<element name="errorLabel" type="text" selector="label.mage-error"/>
2431
</section>
2532
</sections>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/>
7272
<element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/>
7373
<element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/>
74+
<element name="footerBlock" type="block" selector="//footer"/>
7475
</section>
7576
<section name="ProductInWebsitesSection">
7677
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
@@ -208,5 +209,7 @@
208209
<element name="textAttributeByName" type="text" selector="//div[@data-index='attributes']//fieldset[contains(@class, 'admin__field') and .//*[contains(.,'{{var}}')]]//input" parameterized="true"/>
209210
<element name="dropDownAttribute" type="select" selector="//select[@name='product[{{arg}}]']" parameterized="true" timeout="30"/>
210211
<element name="attributeSection" type="block" selector="//div[@data-index='attributes']/div[contains(@class, 'admin__collapsible-content _show')]" timeout="30"/>
212+
<element name="attributeGroupByName" type="button" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']" parameterized="true"/>
213+
<element name="attributeByGroupAndName" type="text" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']/../../following-sibling::div//span[contains(text(),'attribute')]" parameterized="true"/>
211214
</section>
212215
</sections>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCreateNewGroupForAttributeSetTest">
12+
<annotations>
13+
<stories value="Edit attribute set"/>
14+
<title value="Admin should be able to create new group in an Attribute Set"/>
15+
<description value="The test verifies creating a new group in an attribute set and a validation message in case of empty group name"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-170"/>
18+
<group value="Catalog"/>
19+
</annotations>
20+
<before>
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"/>
27+
</before>
28+
<after>
29+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
30+
<actionGroup ref="logout" stepKey="logout"/>
31+
</after>
32+
33+
<!-- Navigate to Stores > Attributes > Attribute Set -->
34+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
35+
<waitForPageLoad stepKey="waitForPageLoad"/>
36+
37+
<!-- Search and open Attribute Set from preconditions -->
38+
<actionGroup ref="goToAttributeSetByName" stepKey="searchAttribute">
39+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
40+
</actionGroup>
41+
42+
<!-- Click 'Add New': Show 'New Group' Modal -->
43+
<click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddNew"/>
44+
<waitForAjaxLoad stepKey="waitForAjax"/>
45+
46+
<!-- Fill 'name' for new group and click 'Ok': Name = <empty> -->
47+
<fillField userInput="" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillName"/>
48+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOk"/>
49+
50+
<!-- Error message 'This is a required field.' is displayed -->
51+
<see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/>
52+
53+
<!-- Fill 'name' for new group and click 'Ok': Name = Custom group -->
54+
<fillField userInput="{{customGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/>
55+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/>
56+
57+
<!-- Group is created and displayed in 'Groups' block -->
58+
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(customGroup.name)}}" stepKey="assertCustomGroup"/>
59+
60+
<!-- Move custom Product Attribute to new 'Custom group' Group -->
61+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
62+
<click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="click"/>
63+
<waitForPageLoad stepKey="waitForPageLoadAfterClick"/>
64+
<dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="moveAttribute"/>
65+
<waitForPageLoad stepKey="waitForDragAndDrop"/>
66+
67+
<!-- Attribute is displayed in the new group -->
68+
<see userInput="$$createConfigProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttribute"/>
69+
70+
<!-- Click 'Save' -->
71+
<actionGroup ref="SaveAttributeSet" stepKey="saveAttribute"/>
72+
73+
<actionGroup ref="goToAttributeSetByName" stepKey="backTohAttributeSet">
74+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
75+
</actionGroup>
76+
77+
<!-- Create another group: Name = Empty group -->
78+
<click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddEmptyGroup"/>
79+
<waitForAjaxLoad stepKey="waitForLoad"/>
80+
81+
<fillField userInput="{{emptyGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/>
82+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOnOk"/>
83+
<waitForPageLoad stepKey="waitForNewGroup"/>
84+
85+
<!-- Empty group is created. No attributes are assigned to it. -->
86+
<seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(emptyGroup.name)}}" stepKey="assertEmptyGroup"/>
87+
<dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup(emptyGroup.name)}}" stepKey="seeNoAttributes"/>
88+
89+
<!-- Navigate to Catalog > Products -->
90+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/>
91+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
92+
93+
<!-- Start to create a new simple product with the custom attribute set from the preconditions -->
94+
<click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddProduct"/>
95+
<waitForPageLoad stepKey="waitForNewProductPage"/>
96+
97+
<actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttribute">
98+
<argument name="attributeSetName" value="$$createAttributeSet.attribute_set_name$$"/>
99+
</actionGroup>
100+
101+
<!-- New Section 'Custom group' is present in form. The section contains the attribute from preconditions -->
102+
<seeElement selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="seeSectionCustomGroup"/>
103+
<click selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="openCustomGroupSection"/>
104+
<waitForAjaxLoad stepKey="waitForOpenSection"/>
105+
<scrollTo selector="{{AdminProductFormSection.footerBlock}}" stepKey="scrollToFooter"/>
106+
<seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName(customGroup.name)}}" stepKey="seeAttributePresent"/>
107+
108+
<!-- Empty section is absent in Product Form -->
109+
<dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName(emptyGroup.name)}}" stepKey="dontSeeEmptyGroup"/>
110+
</test>
111+
</tests>

0 commit comments

Comments
 (0)