Skip to content

Commit 09293a5

Browse files
committed
MC-38787: Admin Product Grid Page indicator issue
1 parent 719c206 commit 09293a5

File tree

5 files changed

+98
-27
lines changed

5 files changed

+98
-27
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByStringNoClearActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<description>Searches the Admin Products grid by string without clearing filters.</description>
1414
</annotations>
1515
<arguments>
16-
<argument name="keyword" type="string"/>
16+
<argument name="keyword" defaultValue="" type="string"/>
1717
</arguments>
1818

1919
<fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/>

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

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<test name="AdminGridPageNumberSetsToOneAfterNewSearchTest">
12-
1312
<annotations>
1413
<features value="Catalog"/>
1514
<stories value="Catalog grid"/>
@@ -27,27 +26,28 @@
2726
<actionGroup ref="AdminProductCatalogPageOpenActionGroup" stepKey="goToProductCatalog"/>
2827
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridToDefaultView"/>
2928
<actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteProductIfTheyExist"/>
30-
<createData stepKey="category1" entity="SimpleSubCategory"/>
3129

32-
<createData stepKey="simpleProduct1" entity="SimpleProduct">
30+
<!-- Create required prerequisites -->
31+
<createData entity="SimpleSubCategory" stepKey="category1"/>
32+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
3333
<requiredEntity createDataKey="category1"/>
3434
</createData>
35-
<createData stepKey="simpleProduct2" entity="SimpleProduct">
35+
<createData entity="SimpleProduct" stepKey="simpleProduct2">
3636
<requiredEntity createDataKey="category1"/>
3737
</createData>
38-
<createData stepKey="simpleProduct3" entity="SimpleProduct">
38+
<createData entity="SimpleProduct" stepKey="simpleProduct3">
3939
<requiredEntity createDataKey="category1"/>
4040
</createData>
41-
<createData stepKey="simpleProduct4" entity="SimpleProduct">
41+
<createData entity="SimpleProduct" stepKey="simpleProduct4">
4242
<requiredEntity createDataKey="category1"/>
4343
</createData>
44-
<createData stepKey="virtualProduct1" entity="VirtualProduct">
44+
<createData entity="VirtualProduct" stepKey="virtualProduct1">
4545
<requiredEntity createDataKey="category1"/>
4646
</createData>
47-
<createData stepKey="virtualProduct2" entity="VirtualProduct">
47+
<createData entity="VirtualProduct" stepKey="virtualProduct2">
4848
<requiredEntity createDataKey="category1"/>
4949
</createData>
50-
<createData stepKey="virtualProduct3" entity="VirtualProduct">
50+
<createData entity="VirtualProduct" stepKey="virtualProduct3">
5151
<requiredEntity createDataKey="category1"/>
5252
</createData>
5353
</before>
@@ -59,39 +59,47 @@
5959
</actionGroup>
6060
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearFilters"/>
6161

62-
<deleteData stepKey="deleteCategory1" createDataKey="category1"/>
63-
64-
<deleteData stepKey="deleteSimpleProduct1" createDataKey="simpleProduct1"/>
65-
<deleteData stepKey="deleteSimpleProduct2" createDataKey="simpleProduct2"/>
66-
<deleteData stepKey="deleteSimpleProduct3" createDataKey="simpleProduct3"/>
67-
<deleteData stepKey="deleteSimpleProduct4" createDataKey="simpleProduct4"/>
68-
<deleteData stepKey="deleteVirtualProduct1" createDataKey="virtualProduct1"/>
69-
<deleteData stepKey="deleteVirtualProduct2" createDataKey="virtualProduct2"/>
70-
<deleteData stepKey="deleteVirtualProduct3" createDataKey="virtualProduct3"/>
62+
<!-- Delete prerequisites -->
63+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
64+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
65+
<deleteData createDataKey="simpleProduct3" stepKey="deleteSimpleProduct3"/>
66+
<deleteData createDataKey="simpleProduct4" stepKey="deleteSimpleProduct4"/>
67+
<deleteData createDataKey="virtualProduct1" stepKey="deleteVirtualProduct1"/>
68+
<deleteData createDataKey="virtualProduct2" stepKey="deleteVirtualProduct2"/>
69+
<deleteData createDataKey="virtualProduct3" stepKey="deleteVirtualProduct3"/>
70+
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
7171

7272
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
7373
</after>
7474

7575
<actionGroup ref="AdminProductCatalogPageOpenActionGroup" stepKey="goToProductCatalog"/>
7676

77+
<!-- Set the product grid to display one product per page -->
7778
<actionGroup ref="AdminDataGridSelectCustomPerPageActionGroup" stepKey="select1ProductPerPage">
7879
<argument name="perPage" value="ProductPerPage.productCount"/>
7980
</actionGroup>
8081

82+
<!-- Performing the first search and assertions -->
8183
<actionGroup ref="SearchProductGridByStringNoClearActionGroup" stepKey="searchForSimpleProduct">
8284
<argument name="keyword" value="SimpleProduct"/>
8385
</actionGroup>
86+
<actionGroup ref="AdminGridAssertTotalPageCountActionGroup" stepKey="waitForTotalPagesCountFourToBeVisible">
87+
<argument name="expectedTotalPageCount" value="4"/>
88+
</actionGroup>
89+
<actionGroup ref="AdminGridGoToNextPageActionGroup" stepKey="clickNextPageProductGrid"/>
90+
<actionGroup ref="AdminGridAssertCurrentPageNumberActionGroup" stepKey="assertCurrentPageIsTwoOnProductGridFirstSearch">
91+
<argument name="expectedCurrentPageNumber" value="2"/>
92+
</actionGroup>
8493

85-
<waitForElementVisible selector="{{AdminDataGridPaginationSection.totalPagesCount('4')}}" stepKey="seeTotalPagesIsFourOnFirstSearch"/>
86-
<comment userInput="Go to the next page" stepKey="nextPage"/>
87-
<click selector="{{AdminDataGridPaginationSection.nextPage}}" stepKey="clickNextPageProductGrid"/>
88-
<seeInField selector="{{AdminDataGridPaginationSection.currentPage}}" userInput="2" stepKey="seeOnSecondPageProductGridOnFirstSearch"/>
89-
94+
<!-- Performing the second search and assertions of successful current page number reset -->
9095
<actionGroup ref="SearchProductGridByStringNoClearActionGroup" stepKey="searchForVirtualProduct">
9196
<argument name="keyword" value="VirtualProduct"/>
9297
</actionGroup>
93-
94-
<waitForElementVisible selector="{{AdminDataGridPaginationSection.totalPagesCount('3')}}" stepKey="seeTotalPagesIsThreeOnSecondSearch"/>
95-
<seeInField selector="{{AdminDataGridPaginationSection.currentPage}}" userInput="1" stepKey="seeOnFirstPageProductGridOnSecondSearch"/>
98+
<actionGroup ref="AdminGridAssertTotalPageCountActionGroup" stepKey="waitForTotalPagesCountThreeToBeVisible">
99+
<argument name="expectedTotalPageCount" value="3"/>
100+
</actionGroup>
101+
<actionGroup ref="AdminGridAssertCurrentPageNumberActionGroup" stepKey="assertCurrentPageIsOneOnProductGridSecondSearch">
102+
<argument name="expectedCurrentPageNumber" value="1"/>
103+
</actionGroup>
96104
</test>
97105
</tests>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminGridAssertCurrentPageNumberActionGroup">
11+
<annotations>
12+
<description>
13+
Assert current page number on admin grid
14+
</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="expectedCurrentPageNumber" defaultValue="1" type="string"/>
18+
</arguments>
19+
20+
<seeInField selector="{{AdminDataGridPaginationSection.currentPage}}" userInput="{{expectedCurrentPageNumber}}" stepKey="seeCurrentPageNumberOnGrid"/>
21+
</actionGroup>
22+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminGridAssertTotalPageCountActionGroup">
11+
<annotations>
12+
<description>
13+
Assert total page count on admin grid
14+
</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="expectedTotalPageCount" defaultValue="1" type="string"/>
18+
</arguments>
19+
20+
<waitForElementVisible selector="{{AdminDataGridPaginationSection.totalPagesCount('expectedTotalPageCount')}}" stepKey="waitForTotalPagesCountToBeVisible"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminGridGoToNextPageActionGroup">
11+
<annotations>
12+
<description>
13+
Go to next page of the admin grid.
14+
</description>
15+
</annotations>
16+
17+
<click selector="{{AdminDataGridPaginationSection.nextPage}}" stepKey="clickNextPageOnGrid"/>
18+
</actionGroup>
19+
</actionGroups>

0 commit comments

Comments
 (0)