Skip to content

Commit ddfdcfb

Browse files
committed
ACPT-677: Catalog product grid improvement
- Add MFTF test;
1 parent dcac850 commit ddfdcfb

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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="AdminLimitNumberOfProductsInGridTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Limit number of products in grid"/>
15+
<title value="Limit total number of products in grid collection"/>
16+
<description value="Verify that total number of products in grid collection can be limited"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="ACPT-699"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
22+
<before>
23+
<magentoCLI stepKey="enableLimitNumberOfProductsInGrid" command="config:set admin/grid/limit_total_number_of_products 1"/>
24+
<magentoCLI stepKey="setCustomRecordsLimit" command="config:set admin/grid/records_limit 2"/>
25+
<createData entity="SimpleProduct" stepKey="createSimpleProduct1"/>
26+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
27+
</before>
28+
29+
<after>
30+
<magentoCLI stepKey="disableLimitNumberOfProductsInGrid" command="config:set admin/grid/limit_total_number_of_products 0"/>
31+
<magentoCLI stepKey="setDefaultRecordsLimit" command="config:set admin/grid/records_limit 20000"/>
32+
<deleteData createDataKey="createSimpleProduct1" stepKey="deleteSimpleProduct1"/>
33+
<deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/>
34+
<deleteData createDataKey="createSimpleProduct3" stepKey="deleteSimpleProduct3"/>
35+
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
36+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
37+
</after>
38+
39+
<!-- Check that 1 record found and pagination is displayed because number of products is less than limit -->
40+
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
41+
<actionGroup ref="AdminAssertNumberOfRecordsInUiGridActionGroup" stepKey="assert1RecordInProductGrid">
42+
<argument name="number" value="1"/>
43+
</actionGroup>
44+
<see selector="{{AdminGridHeaders.numberOfPages}}" userInput="of 1" stepKey="see1PageFound"/>
45+
46+
<!-- Create 2 more products -->
47+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct2"/>
48+
<createData entity="SimpleProduct3" stepKey="createSimpleProduct3"/>
49+
<!-- Check that 3 records found and pagination is not displayed because number of products is greater than limit -->
50+
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter2"/>
51+
<dontSee userInput="3 records found" selector="{{AdminGridHeaders.totalRecords}}" stepKey="dontSeeRecords"/>
52+
<dontSee selector="{{AdminGridHeaders.numberOfPages}}" userInput="of 1" stepKey="dontSee1PageFound"/>
53+
54+
<!-- Search for 1 simple product by name in filter -->
55+
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterSimpleProductByName">
56+
<argument name="product" value="SimpleProduct3"/>
57+
</actionGroup>
58+
<!-- Check that 1 record found and pagination is displayed because number of filtered products is less than limit -->
59+
<actionGroup ref="AdminAssertNumberOfRecordsInUiGridActionGroup" stepKey="assertOneRecordInProductGrid">
60+
<argument name="number" value="1"/>
61+
</actionGroup>
62+
<see selector="{{AdminGridHeaders.numberOfPages}}" userInput="of 1" stepKey="see1PageFound2"/>
63+
64+
<!-- Search for all 3 simple products in filter -->
65+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
66+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
67+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="Simple Product" stepKey="fillProductNameFilter"/>
68+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
69+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
70+
<!-- Check that 3 records found and pagination is not displayed because number of filtered products is greater than limit -->
71+
<dontSee userInput="3 records found" selector="{{AdminGridHeaders.totalRecords}}" stepKey="dontSeeThreeRecords"/>
72+
<dontSee selector="{{AdminGridHeaders.numberOfPages}}" userInput="of 1" stepKey="dontSee1PageFound2"/>
73+
</test>
74+
</tests>

app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection/AdminGridHeadersSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="headerByName" type="text" selector="//div[@data-role='grid-wrapper']//span[@class='data-grid-cell-content' and contains(text(), '{{var1}}')]/parent::*" parameterized="true"/>
1313
<element name="columnsNames" type="text" selector="[data-role='grid-wrapper'] .data-grid-th &gt; span"/>
1414
<element name="totalRecords" type="text" selector="div.admin__data-grid-header-row.row.row-gutter div.row div.admin__control-support-text"/>
15+
<element name="numberOfPages" type="text" selector="div.admin__data-grid-header-row.row.row-gutter div.row div.admin__data-grid-pager > label"/>
1516
</section>
1617
</sections>

0 commit comments

Comments
 (0)