Skip to content

Commit 5903831

Browse files
committed
magento/magento-functional-tests-migration#417: Convert CreateCustomOrderStatusEntityTest to MFTF
1 parent 73b5b92 commit 5903831

12 files changed

+273
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<!-- Fill Order status form and click save -->
12+
<actionGroup name="AdminOrderStatusFormFillAndSave">
13+
<arguments>
14+
<argument name="status" type="string" defaultValue=""/>
15+
<argument name="label" type="string" defaultValue=""/>
16+
</arguments>
17+
18+
<fillField stepKey="fillStatusCode" selector="{{AdminOrderStatusFormSection.statusCodeField}}" userInput="{{status}}"/>
19+
<fillField stepKey="fillStatusLabel" selector="{{AdminOrderStatusFormSection.statusLabelField}}" userInput="{{label}}"/>
20+
<click stepKey="clickSaveStatus" selector="{{AdminMainActionsSection.save}}"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<!-- Search order status grid for item with a specific code and validate data -->
12+
<actionGroup name="AssertOrderStatusExistsInGrid">
13+
<arguments>
14+
<argument name="status" type="string" defaultValue=""/>
15+
<argument name="label" type="string" defaultValue=""/>
16+
</arguments>
17+
18+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/>
19+
<fillField selector="{{AdminOrderStatusGridSection.statusCodeFilterField}}" userInput="{{status}}" stepKey="fillStatusFilter"/>
20+
<click selector="{{AdminSecondaryGridSection.searchButton}}" stepKey="clickSearch"/>
21+
<see selector="{{AdminOrderStatusGridSection.statusCodeDataColumn}}" userInput="{{status}}" stepKey="seeStatusCodeInGrid"/>
22+
<see selector="{{AdminOrderStatusGridSection.statusLabelDataColumn}}" userInput="{{label}}" stepKey="seeStatusLabelInGrid"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<!-- Assert that order status is not saved with duplication error message -->
12+
<actionGroup name="AssertOrderStatusFormSaveDuplicateError">
13+
<see selector="{{AdminMessagesSection.error}}" userInput="We found another order status with the same order status code." stepKey="seeError"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<!-- Assert that order status saved with success message -->
12+
<actionGroup name="AssertOrderStatusFormSaveSuccess">
13+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the order status." stepKey="seeSuccess"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="defaultOrderStatus">
12+
<data key="status" unique="suffix">order_status</data>
13+
<data key="label" unique="suffix">orderLabel</data>
14+
</entity>
15+
<entity name="duplicatingCodeOrderStatus">
16+
<data key="status">pending</data>
17+
<data key="label" unique="suffix">orderLabel</data>
18+
</entity>
19+
<entity name="duplicatingLabelOrderStatus">
20+
<data key="status" unique="suffix">order_status</data>
21+
<data key="label">Suspected Fraud</data>
22+
</entity>
23+
</entities>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminOrderStatusPage" url="sales/order_status" area="admin" module="Magento_Sales">
12+
<section name="AdminOrderStatusFormSection"/>
13+
</page>
14+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminOrderStatusFormSection">
12+
<element name="statusCodeField" type="text" selector="#edit_form [name=status]"/>
13+
<element name="statusLabelField" type="text" selector="#edit_form [name=label]"/>
14+
</section>
15+
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminOrderStatusGridSection">
12+
<element name="statusCodeFilterField" type="input" selector="[data-role=filter-form] [name=status]"/>
13+
<element name="statusCodeDataColumn" type="input" selector="[data-role=row] [data-column=status]"/>
14+
<element name="statusLabelDataColumn" type="input" selector="[data-role=row] [data-column=label]"/>
15+
</section>
16+
</sections>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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="AdminCreateOrderStatusDuplicatingCodeTest">
12+
<annotations>
13+
<stories value="Create order status"/>
14+
<title value="Create order status with duplicating code"/>
15+
<description value="Receive error when creating order status with the code which is already exist"/>
16+
<group value="sales"/>
17+
<group value="mtf_migrated"/>
18+
<severity value="AVERAGE"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="logout" stepKey="logout"/>
25+
</after>
26+
27+
<!-- Go to new order status page -->
28+
<amOnPage url="{{AdminOrderStatusPage.url}}" stepKey="goToOrderStatusPage"/>
29+
<click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/>
30+
31+
<!-- Fill the form and validate message -->
32+
<actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave">
33+
<argument name="status" value="{{duplicatingCodeOrderStatus.status}}"/>
34+
<argument name="label" value="{{duplicatingCodeOrderStatus.label}}"/>
35+
</actionGroup>
36+
<actionGroup ref="AssertOrderStatusFormSaveDuplicateError" stepKey="seeFormSaveDuplicateError"/>
37+
</test>
38+
</tests>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="AdminCreateOrderStatusDuplicatingLabelTest">
12+
<annotations>
13+
<stories value="Create order status"/>
14+
<title value="Create order status with duplicating label"/>
15+
<description value="Create an order status and get success message"/>
16+
<group value="sales"/>
17+
<group value="mtf_migrated"/>
18+
<severity value="AVERAGE"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="logout" stepKey="logout"/>
25+
</after>
26+
27+
<!-- Go to new order status page -->
28+
<amOnPage url="{{AdminOrderStatusPage.url}}" stepKey="goToOrderStatusPage"/>
29+
<click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/>
30+
31+
<!-- Fill the form and validate message -->
32+
<actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave">
33+
<argument name="status" value="{{duplicatingLabelOrderStatus.status}}"/>
34+
<argument name="label" value="{{duplicatingLabelOrderStatus.label}}"/>
35+
</actionGroup>
36+
<actionGroup ref="AssertOrderStatusFormSaveSuccess" stepKey="seeFormSaveSuccess"/>
37+
38+
<!-- Verify the order status grid page shows the order status we just created -->
39+
<actionGroup ref="AssertOrderStatusExistsInGrid" stepKey="searchCreatedOrderStatus">
40+
<argument name="status" value="{{duplicatingLabelOrderStatus.status}}"/>
41+
<argument name="label" value="{{duplicatingLabelOrderStatus.label}}"/>
42+
</actionGroup>
43+
</test>
44+
</tests>

0 commit comments

Comments
 (0)