Skip to content

Commit 7607778

Browse files
committed
MAGETWO-91450: date reverts in past after clicking out of product edit
- added functional test
1 parent 07c6070 commit 7607778

File tree

7 files changed

+93
-2
lines changed

7 files changed

+93
-2
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@
5353
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
5454
</actionGroup>
5555

56+
<!--Filter the product grid by new from date filter-->
57+
<actionGroup name="filterProductGridBySetNewFromDate">
58+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
59+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
60+
<fillField selector="{{AdminProductGridFilterSection.newFromDateFilter}}" userInput="05/16/2018" stepKey="fillSetAsNewProductFilter"/>
61+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
62+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
63+
</actionGroup>
64+
5665
<!--Filter the product grid by a price range-->
5766
<actionGroup name="filterProductGridByPriceRange">
5867
<arguments>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/CustomAttributeData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@
3131
<data key="attribute_code">short_description</data>
3232
<data key="value" unique="suffix">API Product Short Description</data>
3333
</entity>
34+
<entity name="ApiProductNewsFromDate" type="custom_attribute">
35+
<data key="attribute_code">news_from_date</data>
36+
<data key="value">2018-05-17 00:00:00</data>
37+
</entity>
3438
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,18 @@
240240
<requiredEntity type="product_option">ProductOptionDateTime</requiredEntity>
241241
<requiredEntity type="product_option">ProductOptionTime</requiredEntity>
242242
</entity>
243+
<entity name="SimpleProductWithNewFromDate" type="product">
244+
<data key="sku" unique="suffix">SimpleProduct</data>
245+
<data key="type_id">simple</data>
246+
<data key="attribute_set_id">4</data>
247+
<data key="name" unique="suffix">SimpleProduct</data>
248+
<data key="price">125.00</data>
249+
<data key="visibility">4</data>
250+
<data key="status">1</data>
251+
<data key="quantity">1000</data>
252+
<data key="urlKey" unique="suffix">simpleproduct</data>
253+
<data key="weight">1</data>
254+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
255+
<requiredEntity type="custom_attribute_array">ApiProductNewsFromDate</requiredEntity>
256+
</entity>
243257
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeGridSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
<section name="AdminProductAttributeGridSection">
1212
<element name="AttributeCode" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/>
1313
<element name="createNewAttributeBtn" type="button" selector="button[data-index='add_new_attribute_button']"/>
14+
<element name="GridFilterFrontEndLabel" type="input" selector="#attributeGrid_filter_frontend_label"/>
15+
<element name="Search" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/>
16+
<element name="ResetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
17+
<element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]"/>
1418
</section>
1519
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormActionSection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
<section name="AdminProductFormActionSection">
1212
<element name="backButton" type="button" selector="#back" timeout="30"/>
1313
<element name="saveButton" type="button" selector="#save-button" timeout="30"/>
14-
<element name="saveArrow" type="button" selector="button[data-ui-id='save-button-dropdown']" timeout="10"/>
15-
<element name="saveAndClose" type="button" selector="span[title='Save &amp; Close']" timeout="30"/>
14+
<element name="saveArrow" type="button" selector="button[data-ui-id='save-button-dropdown']" timeout="30"/>
15+
<!--<element name="saveAndClose" type="button" selector="span[title='Save &amp; Close']" timeout="30"/>-->
16+
<element name="saveAndClose" type="button" selector="span[id='save_and_close']" timeout="30"/>
1617
<element name="changeStoreButton" type="button" selector="#store-change-button" timeout="10"/>
1718
<element name="selectStoreView" type="button" selector="//ul[@data-role='stores-list']/li/a[normalize-space(.)='{{var1}}']" timeout="10" parameterized="true"/>
1819
</section>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductGridFilterSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<element name="priceFilterTo" type="input" selector="input.admin__control-text[name='price[to]']"/>
2929
<element name="typeFilter" type="select" selector="select.admin__control-select[name='type_id']"/>
3030
<element name="statusFilter" type="select" selector="select.admin__control-select[name='status']"/>
31+
<element name="newFromDateFilter" type="input" selector="input.admin__control-text[name='news_from_date[from]']"/>
3132
<element name="keywordSearch" type="input" selector="input#fulltext"/>
3233
<element name="keywordSearchButton" type="button" selector=".data-grid-search-control-wrap button.action-submit" timeout="30"/>
3334
</section>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminProductGridFilteringByDateAttributeTest">
12+
<annotations>
13+
<title value="Verify Set Product as new Filter input on Product Grid doesn't getreset to currentDate"/>
14+
<description value="Data input in the new from date filter field should not change"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-92019"/>
17+
<group value="product"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
21+
<createData entity="SimpleProductWithNewFromDate" stepKey="createSimpleProductWithDate"/>
22+
</before>
23+
<after>
24+
<deleteData createDataKey="createSimpleProductWithDate" stepKey="deleteProduct"/>
25+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
26+
</after>
27+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttribute"/>
28+
<waitForPageLoad stepKey="wait1"/>
29+
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGrid"/>
30+
<fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="Set Product as New from Date" stepKey="setAttributeLabel"/>
31+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromGrid"/>
32+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
33+
<waitForPageLoad stepKey="wait2"/>
34+
<click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="openAdvancedPropertiesTab"/>
35+
<selectOption selector="#is_filterable_in_grid" userInput="Yes" stepKey="isFilterableInGrid"/>
36+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/>
37+
<waitForPageLoad stepKey="waitForSaveAttribute"/>
38+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCache"/>
39+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
40+
<waitForPageLoad time="30" stepKey="waitForProductGridPageLoad"/>
41+
<click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="openColumnsdropDown1"/>
42+
<checkOption selector="{{AdminProductGridFilterSection.viewColumnOption('Set Product as New from Date')}}" stepKey="showProductAsNewColumn"/>
43+
<click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdown1"/>
44+
<seeElement selector="{{AdminProductGridSection.columnHeader('Set Product as New from Date')}}" stepKey="seeNewFromDateColumn"/>
45+
<waitForPageLoad stepKey="waitforFiltersToApply"/>
46+
<actionGroup ref="filterProductGridBySetNewFromDate" stepKey="filterProductGridToCheckSetAsNewColumn"/>
47+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnFirstRowProductGrid"/>
48+
<waitForPageLoad stepKey="waitForProductEditPageToLoad"/>
49+
<actionGroup ref="AdminFormSaveAndClose" stepKey="saveAndCloseProductForm"/>
50+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="expandFilters"/>
51+
<seeInField selector="{{AdminProductGridFilterSection.newFromDateFilter}}" userInput="05/16/2018" stepKey="checkForNewFromDate"/>
52+
<click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="openColumnsDropdown2"/>
53+
<uncheckOption selector="{{AdminProductGridFilterSection.viewColumnOption('Set Product as New from Date')}}" stepKey="hideProductAsNewColumn"/>
54+
<dontSeeElement selector="{{AdminProductGridSection.columnHeader('Set Product as New from Date')}}" stepKey="dontSeeNewFromDateColumn"/>
55+
<click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="closeColumnsDropdown2"/>
56+
<click selector="{{AdminProductGridFilterSection.clearAll}}" stepKey="clearGridFilters"/>
57+
</test>
58+
</tests>

0 commit comments

Comments
 (0)