Skip to content

Commit 29e0105

Browse files
committed
MC-40240: Product grid date filters does not work for en_GB locale
1 parent d587052 commit 29e0105

File tree

4 files changed

+145
-0
lines changed

4 files changed

+145
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<actionGroup name="FilterProductGridByCustomDateRangeActionGroup">
12+
<annotations>
13+
<description>Filters the Admin Products grid by the provided Date Filter.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="code" type="string"/>
17+
<argument name="date" type="string"/>
18+
</arguments>
19+
20+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
21+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
22+
<fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeFrom(code)}}" userInput="{{date}}" stepKey="fillProductDatetimeFromFilter"/>
23+
<fillField selector="{{AdminProductGridFilterSection.inputByCodeRangeTo(code)}}" userInput="{{date}}" stepKey="fillProductDatetimeToFilter"/>
24+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
25+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/>
7676
<element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/>
7777
<element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/>
78+
<element name="newAddedAttributeInput" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]//input" parameterized="true"/>
7879
<element name="newCategoryButton" type="button" selector="button[data-index='create_category_button']" timeout="30"/>
7980
<element name="footerBlock" type="block" selector="//footer"/>
8081
<element name="categories" type="text" selector="//*[@class='admin__action-multiselect-crumb']/span[contains(text(), '{{categoryName}}')]" parameterized="true"/>
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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="AdminProductGridFilteringByDateWithCustomLocaleTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Filter products"/>
14+
<title value="Product grid date filters does not work for en_GB locale"/>
15+
<description value="Product grid date filters does not work for en_GB locale"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-40644"/>
18+
<useCaseId value="MC-40240"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleProduct" stepKey="createProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
28+
<!-- Create new User -->
29+
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
30+
<actionGroup ref="AdminCreateUserWithRoleAndLocaleActionGroup" stepKey="createAdminUser">
31+
<argument name="user" value="activeAdmin"/>
32+
<argument name="role" value="roleDefaultAdministrator"/>
33+
<argument name="interfaceLocale" value="en_GB"/>
34+
</actionGroup>
35+
</before>
36+
<after>
37+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
38+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
39+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute">
40+
<argument name="ProductAttribute" value="dateProductAttribute"/>
41+
</actionGroup>
42+
<actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetGridFilter"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
46+
<!-- Generate date for use as default value, needs to be MM/d/YYYY and mm/d/yy -->
47+
<generateDate date="now" format="m/j/Y" stepKey="generateDefaultDate"/>
48+
<generateDate date="now" format="j/m/Y" stepKey="generateDefaultDateGB"/>
49+
50+
<!-- Navigate to Stores > Attributes > Product. -->
51+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="goToProductAttributes"/>
52+
53+
<!-- Create new Product Attribute as TextField, with code and default value. -->
54+
<actionGroup ref="CreateProductAttributeWithDateFieldActionGroup" stepKey="createAttribute">
55+
<argument name="attribute" value="dateProductAttribute"/>
56+
<argument name="date" value="{$generateDefaultDate}"/>
57+
</actionGroup>
58+
59+
<!-- Go to default attribute set edit page -->
60+
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/{{AddToDefaultSet.attributeSetId}}/" stepKey="onAttributeSetEdit"/>
61+
<!-- Assert created attribute in unassigned section -->
62+
<see userInput="{{dateProductAttribute.attribute_code}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/>
63+
<!-- Assign attribute to a group -->
64+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup">
65+
<argument name="group" value="Product Details"/>
66+
<argument name="attribute" value="{{dateProductAttribute.attribute_code}}"/>
67+
</actionGroup>
68+
<!-- Assert attribute in a group -->
69+
<see userInput="{{dateProductAttribute.attribute_code}}" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/>
70+
<!-- Save attribute set -->
71+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/>
72+
73+
<!-- Open Product Edit Page and set custom attribute value -->
74+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct">
75+
<argument name="product" value="$createProduct$"/>
76+
</actionGroup>
77+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
78+
<argument name="product" value="$createProduct$"/>
79+
</actionGroup>
80+
<fillField selector="{{AdminProductFormSection.newAddedAttributeInput(dateProductAttribute.attribute_code)}}" userInput="{$generateDefaultDate}" stepKey="fillCustomDateValue"/>
81+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
82+
83+
<!-- Logout master admin and Login as new User -->
84+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutMasterAdmin"/>
85+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToNewAdmin">
86+
<argument name="username" value="{{activeAdmin.username}}"/>
87+
<argument name="password" value="{{activeAdmin.password}}"/>
88+
</actionGroup>
89+
90+
<!-- Open Product Index Page and filter the product -->
91+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex2"/>
92+
<actionGroup ref="FilterProductGridByCustomDateRangeActionGroup" stepKey="filterProductGridByCustomDateRange">
93+
<argument name="code" value="{{dateProductAttribute.attribute_code}}"/>
94+
<argument name="date" value="{$generateDefaultDateGB}"/>
95+
</actionGroup>
96+
<!-- Check products filtering -->
97+
<see selector="{{AdminProductGridSection.productGridNameProduct($createProduct.name$)}}" userInput="$createProduct.name$" stepKey="seeProductName"/>
98+
</test>
99+
</tests>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<!-- Create new user with role and locale setting-->
11+
<actionGroup name="AdminCreateUserWithRoleAndLocaleActionGroup" extends="AdminCreateUserWithRoleActionGroup">
12+
<arguments>
13+
<argument name="interfaceLocale" defaultValue="en_US" type="string"/>
14+
</arguments>
15+
16+
<selectOption selector="{{AdminNewUserFormSection.interfaceLocale}}" userInput="{{interfaceLocale}}" stepKey="setInterfaceLocate" after="confirmPassword"/>
17+
</actionGroup>
18+
</actionGroups>

0 commit comments

Comments
 (0)