Skip to content

Commit 0d0122c

Browse files
committed
MC-4872: Convert CreateStoreGroupEntityTest to MFTF
1 parent 765c3c7 commit 0d0122c

5 files changed

+202
-1
lines changed

app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateNewStoreGroupActionGroup.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,32 @@
4242
<waitForElementVisible selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="waitForStoreGridReload"/>
4343
<see userInput="You saved the store." stepKey="seeSavedMessage"/>
4444
</actionGroup>
45+
<actionGroup name="AssertStoreGroupInGrid">
46+
<arguments>
47+
<argument name="storeGroupName" type="string"/>
48+
</arguments>
49+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
50+
<waitForPageLoad stepKey="waitForAdminSystemStorePageLoad"/>
51+
<click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/>
52+
<fillField userInput="{{storeGroupName}}" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" stepKey="fillSearchStoreGroupField"/>
53+
<click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton"/>
54+
<waitForPageLoad stepKey="waitForStoreToLoad"/>
55+
<see selector="{{AdminStoresGridSection.firstRow('1')}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupInGridMessage"/>
56+
</actionGroup>
57+
<actionGroup name="AssertStoreGroupForm">
58+
<arguments>
59+
<argument name="website" type="string"/>
60+
<argument name="storeGroupName" type="string"/>
61+
<argument name="storeGroupCode" type="string"/>
62+
<argument name="rootCategory" type="string"/>
63+
</arguments>
64+
<click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickEditExistingStoreRow"/>
65+
<waitForPageLoad stepKey="waitTillAdminSystemStoreGroupPage"/>
66+
<grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabStoreGroupIdFromCurrentUrl"/>
67+
<seeInCurrentUrl url="system_store/editGroup/group_id/{$grabStoreGroupIdFromCurrentUrl}" stepKey="seeStoreGroupId"/>
68+
<seeInField selector="{{AdminNewStoreGroupSection.storeGrpWebsiteDropdown}}" userInput="{{website}}" stepKey="seeAssertWebsite"/>
69+
<seeInField selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" userInput="{{storeGroupName}}" stepKey="seeAssertStoreGroupName"/>
70+
<seeInField selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" userInput="{{storeGroupCode}}" stepKey="seeAssertStoreGroupCode"/>
71+
<seeInField selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="{{rootCategory}}" stepKey="seeAssertRootCategory"/>
72+
</actionGroup>
4573
</actionGroups>

app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<element name="websiteNameInFirstRow" type="text" selector=".col-website_title>a"/>
2121
<element name="storeGrpNameInFirstRow" type="text" selector=".col-group_title>a"/>
2222
<element name="storeNameInFirstRow" type="text" selector=".col-store_title>a"/>
23-
<element name="firstRow" type="textarea" selector="(//*[@id='storeGrid_table']/tbody/tr)[1]"/>
23+
<element name="firstRow" type="textarea" selector="(//*[@id='storeGrid_table']/tbody/tr)[{{rownum}}]" parameterized="true"/>
2424
<element name="successMessage" type="text" selector="//div[@class='message message-success success']/div"/>
2525
<element name="emptyText" type="text" selector="//tr[@class='data-grid-tr-no-data even']/td[@class='empty-text']"/>
2626
<element name="websiteName" type="text" selector="//td[@class='a-left col-website_title ']/a[contains(.,'{{websiteName}}')]" parameterized="true"/>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
<!-- Test XML Example -->
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest">
11+
<annotations>
12+
<stories value="Create Store Group"/>
13+
<title value="Create Store Group with Custom Website and Default Category"/>
14+
<description value="Test log in to Stores and Create Store Group with Custom Website and Default Category Test"/>
15+
<testCaseId value="MC-14300"/>
16+
<severity value="CRITICAL"/>
17+
<group value="store"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<!--Create website-->
24+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
25+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
26+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
27+
</actionGroup>
28+
</before>
29+
<after>
30+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
31+
<argument name="websiteName" value="{{customWebsite.name}}"/>
32+
</actionGroup>
33+
<actionGroup ref="logout" stepKey="logout"/>
34+
</after>
35+
36+
<!--Create custom store group with custom website and default category and verify AssertStoreGroupSuccessSaveMessage-->
37+
<actionGroup ref="CreateCustomStore" stepKey="createCustomStoreGroup">
38+
<argument name="website" value="{{customWebsite.name}}"/>
39+
<argument name="store" value="{{customStoreGroup.name}}"/>
40+
<argument name="rootCategory" value="Default Category"/>
41+
</actionGroup>
42+
43+
<!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid message-->
44+
<actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid">
45+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
46+
</actionGroup>
47+
48+
<!--Go to store group form page and verify AssertStoreGroupForm-->
49+
<actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupForm">
50+
<argument name="website" value="{{customWebsite.name}}"/>
51+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
52+
<argument name="storeGroupCode" value="{{customStoreGroup.code}}"/>
53+
<argument name="rootCategory" value="Default Category"/>
54+
</actionGroup>
55+
<!--Also verify absence of delete button on store group form page(AssertStoreGroupNoDeleteButton)-->
56+
<dontSee selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="AssertStoreGroupNoDeleteButton"/>
57+
</test>
58+
</tests>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
<!-- Test XML Example -->
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest">
11+
<annotations>
12+
<stories value="Create Store Group"/>
13+
<title value="Create Store Group with Custom Website and Root Category"/>
14+
<description value="Test log in to Stores and Create Store Group with Custom Website and Root Category Test"/>
15+
<testCaseId value="MC-14299"/>
16+
<severity value="CRITICAL"/>
17+
<group value="store"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<!--Create root category-->
24+
<createData entity="NewRootCategory" stepKey="rootCategory"/>
25+
<createData entity="SimpleRootSubCategory" stepKey="category">
26+
<requiredEntity createDataKey="rootCategory"/>
27+
</createData>
28+
<!--Create website-->
29+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
30+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
31+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
32+
</actionGroup>
33+
</before>
34+
<after>
35+
<!--Delete website-->
36+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
37+
<argument name="websiteName" value="{{customWebsite.name}}"/>
38+
</actionGroup>
39+
<!--Delete root category-->
40+
<deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/>
41+
<actionGroup ref="logout" stepKey="logout"/>
42+
</after>
43+
44+
<!--Create custom store group with custom website and root category and verify AssertStoreGroupSuccessSaveMessage-->
45+
<actionGroup ref="CreateCustomStore" stepKey="createCustomStoreGroup">
46+
<argument name="website" value="{{customWebsite.name}}"/>
47+
<argument name="store" value="{{customStoreGroup.name}}"/>
48+
<argument name="rootCategory" value="$$rootCategory.name$$"/>
49+
</actionGroup>
50+
51+
<!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid-->
52+
<actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid">
53+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
54+
</actionGroup>
55+
56+
<!--Go to store group form page and verify AssertStoreGroupForm and AssertStoreGroupOnStoreViewForm-->
57+
<actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupInForm">
58+
<argument name="website" value="{{customWebsite.name}}"/>
59+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
60+
<argument name="storeGroupCode" value="{{customStoreGroup.code}}"/>
61+
<argument name="rootCategory" value="$$rootCategory.name$$"/>
62+
</actionGroup>
63+
</test>
64+
</tests>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
<!-- Test XML Example -->
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest">
11+
<annotations>
12+
<stories value="Create Store Group"/>
13+
<title value="Create Store Group with Default Website and Default Category"/>
14+
<description value="Test log in to Stores and Create Store Group with Default Website and Default Category Test"/>
15+
<testCaseId value="MC-14298"/>
16+
<severity value="CRITICAL"/>
17+
<group value="store"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteStoreGroup">
26+
<argument name="storeGroupName" value="SecondStoreGroupUnique.name"/>
27+
</actionGroup>
28+
<actionGroup ref="logout" stepKey="logout"/>
29+
</after>
30+
31+
<!--Create custom store group with default website and default category and verify AssertStoreGroupSuccessSaveMessage-->
32+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewCustomStoreGroup">
33+
<argument name="website" value="{{_defaultWebsite.name}}"/>
34+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
35+
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
36+
</actionGroup>
37+
38+
<!--Search created store group(from above step) in grid and verify AssertStoreGroupInGrid-->
39+
<actionGroup ref="AssertStoreGroupInGrid" stepKey="seeCreatedStoreGroupInGrid">
40+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
41+
</actionGroup>
42+
43+
<!--Go to store group form page and verify AssertStoreGroupForm and AssertStoreGroupOnStoreViewForm-->
44+
<actionGroup ref="AssertStoreGroupForm" stepKey="seeCreatedStoreGroupForm">
45+
<argument name="website" value="{{_defaultWebsite.name}}"/>
46+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
47+
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
48+
<argument name="rootCategory" value="Default Category"/>
49+
</actionGroup>
50+
</test>
51+
</tests>

0 commit comments

Comments
 (0)