Skip to content

Commit 7c9a7ad

Browse files
ENGCOM-8098: clear errors when apply new filters #28687
- Merge Pull Request #28687 from AbdulRahmanAbouzaid/magento2:reset_filters_after_error_fix-8538 - Merged commits: 1. 674324c 2. 9fac5f7 3. 3852c89 4. 7517b21 5. cef2186
2 parents 1dc62a7 + cef2186 commit 7c9a7ad

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminGridFilterRemoveErrorMessageBeforeApplyFiltersTest">
11+
<annotations>
12+
<stories value="Reset Error Messages"/>
13+
<title value="Remove Error Message Before Apply Filters"/>
14+
<description value="Test login to Admin UI and Remove Error Message Before Apply Filters"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MC-37450"/>
17+
<group value="ui"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<createData entity="NewRootCategory" stepKey="rootCategory"/>
23+
<createData entity="defaultSimpleProduct" stepKey="createProduct">
24+
<requiredEntity createDataKey="rootCategory" />
25+
</createData>
26+
<createData entity="defaultSimpleProduct" stepKey="createProduct2">
27+
<requiredEntity createDataKey="rootCategory" />
28+
</createData>
29+
30+
<!--Create website-->
31+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
32+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
33+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
34+
</actionGroup>
35+
<!-- Create second store -->
36+
<actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore">
37+
<argument name="website" value="{{customWebsite.name}}"/>
38+
<argument name="store" value="{{customStoreGroup.name}}"/>
39+
<argument name="rootCategory" value="$$rootCategory.name$$"/>
40+
</actionGroup>
41+
<!-- Create second store view -->
42+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
43+
<argument name="StoreGroup" value="customStoreGroup"/>
44+
<argument name="customStore" value="customStoreEN"/>
45+
</actionGroup>
46+
</before>
47+
<after>
48+
<deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/>
49+
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/>
50+
<deleteData stepKey="deleteProduct2" createDataKey="createProduct2"/>
51+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
52+
</after>
53+
54+
<!--Filter created simple product in grid and add category and website created in create data-->
55+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductCatalogPage"/>
56+
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
57+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
58+
<argument name="product" value="$$createProduct2$$"/>
59+
</actionGroup>
60+
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/>
61+
<waitForPageLoad stepKey="waitUntilProductIsOpened"/>
62+
<actionGroup ref="AddWebsiteToProductActionGroup" stepKey="updateSimpleProductAddingWebsiteCreated">
63+
<argument name="website" value="{{customWebsite.name}}"/>
64+
</actionGroup>
65+
66+
<!--Search updated simple product(from above step) in the grid by StoreView and Name-->
67+
<actionGroup ref="FilterProductInGridByStoreViewAndNameActionGroup" stepKey="searchCreatedSimpleProductInGrid">
68+
<argument name="storeView" value="{{customStoreEN.name}}"/>
69+
<argument name="productName" value="$$createProduct2.name$$"/>
70+
</actionGroup>
71+
72+
<!--Go to stores and delete website created in create data-->
73+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
74+
<argument name="websiteName" value="{{customWebsite.name}}"/>
75+
</actionGroup>
76+
77+
<!--Go to grid page and verify AssertErrorMessage-->
78+
<actionGroup ref="AssertErrorMessageAfterDeletingWebsiteActionGroup" stepKey="verifyErrorMessage">
79+
<argument name="errorMessage" value="Something went wrong with processing the default view and we have restored the filter to its original state."/>
80+
</actionGroup>
81+
82+
<!--Apply new filters to verify error message is removed -->
83+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/>
84+
<click selector="{{AdminProductGridFilterSection.storeViewDropdown('Default Store View')}}" stepKey="clickStoreViewDropdown"/>
85+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="$$createProduct.name$$" stepKey="fillProductNameInNameFilter"/>
86+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
87+
<see selector="{{AdminProductGridFilterSection.nthRow('1')}}" userInput="$$createProduct.name$$" stepKey="seeFirstRowToVerifyProductVisibleInGrid"/>
88+
<dontSeeElement selector="{{AdminMessagesSection.error}}" stepKey="dontSeeErrorMessage"/>
89+
90+
</test>
91+
</tests>

app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ define([
200200
* @returns {Filters} Chainable.
201201
*/
202202
apply: function () {
203+
$('body').notification('clear');
203204
this.set('applied', removeEmpty(this.filters));
204205

205206
return this;

0 commit comments

Comments
 (0)