Skip to content

Commit 7fe731f

Browse files
glo74186Manjusha.S
authored andcommitted
AdminDeleteCustomGroupInAnAttributeSetTest
1 parent 10e2aeb commit 7fe731f

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- ActionGroup will add a single custom option to a product
12+
You must already be on the product creation page -->
13+
<actionGroup name="AdminCreateCustomGroupInAnAttributeSetActionGroup">
14+
<annotations>
15+
<description> Admin Create Custom Group In An Attribute Set</description>
16+
</annotations>
17+
18+
<arguments>
19+
<argument name="name" type="string"/>
20+
<argument name="customGroupName" type="string"/>
21+
</arguments>
22+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
23+
<click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/>
24+
<fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/>
25+
<click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/>
26+
<click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/>
27+
<waitForPageLoad stepKey="waitForPageLoad"/>
28+
<click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddNew"/>
29+
<wait stepKey="k1" time="20"/>
30+
<fillField userInput="" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillName"/>
31+
<wait stepKey="k2" time="20"/>
32+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOk"/>
33+
<see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/>
34+
<fillField userInput="{{customGroupName}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/>
35+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/>
36+
</actionGroup>
37+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
<element name="xThLineItemUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]//a/span" parameterized="true"/>
2525
<!-- Buttons -->
2626
<element name="AddNewGroup" type="button" selector="button[data-ui-id='adminhtml-catalog-product-set-edit-add-group-button']"/>
27+
<element name="DeleteSelectedGroup" type="button" selector="button[data-ui-id='adminhtml-catalog-product-set-edit-delete-group-button']"/>
2728
<!-- Modal Window Add New Group -->
2829
<element name="newGroupName" type="input" selector="input[data-role='promptField']"/>
2930
<element name="buttonOk" type="button" selector=".modal-footer .action-primary.action-accept"/>
3031
<element name="errorLabel" type="text" selector="label.mage-error"/>
32+
<element name="attentionMessage" type="text" selector="(//div[@class='modal-inner-wrap'])[2]//div[contains(text(),'This group')]"/>
3133
</section>
3234
</sections>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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="AdminDeleteCustomGroupInAnAttributeSetTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Delete Custom Group In An attribute set "/>
15+
<title value="Delete Custom Group from attribute set"/>
16+
<description value="Delete Custom Group from attribute set"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-26728"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
22+
<before>
23+
24+
<!-- Login to Admin -->
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
26+
27+
<!-- Create attribute set with custom group -->
28+
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
29+
<actionGroup ref="AdminCreateCustomGroupInAnAttributeSetActionGroup" stepKey="createGroupInAttributeSet">
30+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
31+
<argument name="customGroupName" value="Custom Group"/>
32+
</actionGroup>
33+
<wait stepKey="k1" time="10"/>
34+
35+
<!-- Drag and drop system product attributes in to custom group -->
36+
<dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute('price')}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="dragAndDrop"/>
37+
<dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute('sku')}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="dragAndDrop1"/>
38+
39+
<!-- Click Save Attribute -->
40+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttribute"/>
41+
42+
</before>
43+
44+
<after>
45+
46+
<!-- Delete attribute set -->
47+
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
48+
49+
<!-- Logout from Admin -->
50+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
51+
52+
</after>
53+
54+
<!-- Navigate to Stores > Attributes > Attribute Set -->
55+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
56+
<waitForPageLoad stepKey="waitForPageLoad"/>
57+
58+
<!-- Search and open Attribute Set from preconditions -->
59+
<actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="searchAttribute">
60+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
61+
</actionGroup>
62+
63+
<!-- Delete created custom group -->
64+
<click selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom Group')}}" stepKey="selectCustomGroup"/>
65+
<click selector="{{AdminProductAttributeSetEditSection.DeleteSelectedGroup}}" stepKey="clickDeleteSelectedGroup"/>
66+
<wait stepKey="k3" time="20"/>
67+
<seeElement selector="{{AdminProductAttributeSetEditSection.attentionMessage}}" stepKey="assertCustomGroup"/>
68+
<click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOk"/>
69+
<wait stepKey="k4" time="10"/>
70+
71+
<!-- Drag and drop product attributes to its original groups -->
72+
<dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute('price')}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroup('Product Details')}}" stepKey="dragAndDrop3"/>
73+
<dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute('sku')}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroup('Product Details')}}" stepKey="dragAndDrop4"/>
74+
<click selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom Group')}}" stepKey="selectCustomGroup1"/>
75+
<click selector="{{AdminProductAttributeSetEditSection.DeleteSelectedGroup}}" stepKey="deleteSelectedGroup1"/>
76+
77+
<wait stepKey="k5" time="10"/>
78+
79+
<!-- Click 'Save' -->
80+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttribute1"/>
81+
82+
<!-- Again open attribute set and search for custom group -->
83+
<actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="searchAttribute1">
84+
<argument name="name" value="$$createAttributeSet.attribute_set_name$$"/>
85+
</actionGroup>
86+
87+
<!-- Custom Group is absent in attribute set -->
88+
<dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom Group')}}" stepKey="assertCustomGroupIsNotPresent"/>
89+
90+
<!-- Navigate to Catalog > Products -->
91+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductPage"/>
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+
<actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttribute">
97+
<argument name="attributeSetName" value="$$createAttributeSet.attribute_set_name$$"/>
98+
</actionGroup>
99+
100+
<!-- Custom Group is absent in attribute set -->
101+
<dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Custom Group')}}" stepKey="dontSeeCustomGroup"/>
102+
103+
</test>
104+
</tests>
105+

0 commit comments

Comments
 (0)