Skip to content

Commit 7cae6cc

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop-expedited-prs
- merged with '2.4-develop-prs' branch
2 parents 47675b6 + a5d20a6 commit 7cae6cc

File tree

18 files changed

+432
-26
lines changed

18 files changed

+432
-26
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="AdminProductGridUrlFilterApplierTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Filter product using GET URL parameter"/>
15+
<title value="Verify that filter is applied on product grid when filters parameter is set on url"/>
16+
<description value="Accessing product grid url with filters parameter"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/1320712/scenarios/4931106"/>
19+
<group value="product"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<createData entity="simpleProductWithShortNameAndSku" stepKey="createSimpleProduct"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
27+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
28+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
29+
</after>
30+
<amOnPage url="{{AdminProductIndexPage.url}}?filters[name]=$$createSimpleProduct.name$$" stepKey="navigateToProductGridWithFilters"/>
31+
<waitForPageLoad stepKey="waitForProductGrid"/>
32+
<see selector="{{AdminProductGridSection.productGridNameProduct($$createSimpleProduct.name$$)}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProduct"/>
33+
<seeElement selector="{{AdminProductGridFilterSection.enabledFilters}}" stepKey="seeEnabledFilters"/>
34+
<see selector="{{AdminProductGridFilterSection.enabledFilters}}" userInput="Name: $$createSimpleProduct.name$$" stepKey="seeProductNameFilter"/>
35+
</test>
36+
</tests>

app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<referenceContainer name="content">
2222
<uiComponent name="product_listing"/>
2323
<block class="Magento\Catalog\Block\Adminhtml\Product" name="products_list"/>
24+
<block class="Magento\Backend\Block\Template" template="Magento_Catalog::product/grid/url_filter_applier.phtml" name="product_list_url_filter_applier" />
2425
</referenceContainer>
2526
</body>
2627
</page>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var $block \Magento\Backend\Block\Template */
8+
?>
9+
<script type="text/x-magento-init">
10+
{
11+
"*": {
12+
"Magento_Ui/js/grid/url-filter-applier": {
13+
"listingNamespace": "product_listing"
14+
}
15+
}
16+
}
17+
</script>

app/code/Magento/Cms/Test/Mftf/Section/BlockPageActionsSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
<element name="idColumn" type="button" selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]"/>
1616
<element name="clearAll" type="button" selector="//div[@class='admin__data-grid-header']//button[contains(text(), 'Clear all')]"/>
1717
<element name="activeFilters" type="button" selector="//div[@class='admin__data-grid-header']//span[contains(text(), 'Active filters:')]" />
18+
<element name="activeFilterDiv" type="button" selector="(//div[contains(@class, 'admin__data-grid-filters-current') and contains(@class, '_show')])[1]"/>
1819
<element name="FilterBtn" type="input" selector="//button[text()='Filters']"/>
1920
<element name="URLKey" type="input" selector="//div[@class='admin__form-field-control']/input[@name='identifier']"/>
2021
<element name="ApplyFiltersBtn" type="button" selector="//span[text()='Apply Filters']"/>
22+
<element name="blockGridRowByTitle" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
2123
</section>
2224
</sections>

app/code/Magento/Cms/Test/Mftf/Section/CmsPagesPageActionsSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<element name="edit" type="button" selector="//div[text()='{{var1}}']/parent::td//following-sibling::td[@class='data-grid-actions-cell']//a[text()='Edit']" parameterized="true"/>
2020
<element name="preview" type="button" selector="//div[text()='{{var1}}']/parent::td//following-sibling::td[@class='data-grid-actions-cell']//a[text()='View']" parameterized="true"/>
2121
<element name="clearAllButton" type="button" selector="//div[@class='admin__data-grid-header']//button[contains(text(), 'Clear all')]"/>
22+
<element name="clearFilters" type="button" selector=".admin__data-grid-header button[data-action='grid-filter-reset']" timeout="30"/>
2223
<element name="activeFilters" type="button" selector="//div[@class='admin__data-grid-header']//span[contains(text(), 'Active filters:')]" />
2324
<element name="spinner" type="input" selector='//div[@data-component="cms_page_listing.cms_page_listing.cms_page_columns"]'/>
2425
<element name="firstItemSelectButton" type="button" selector=".data-grid .action-select-wrap button.action-select"/>
@@ -31,5 +32,6 @@
3132
<element name="massActionsButton" type="button" selector="//div[@class='admin__data-grid-header'][(not(ancestor::*[@class='sticky-header']) and not(contains(@style,'visibility: hidden'))) or (ancestor::*[@class='sticky-header' and not(contains(@style,'display: none'))])]//button[contains(@class, 'action-select')]" />
3233
<element name="massActionsOption" type="button" selector="//div[@class='admin__data-grid-header'][(not(ancestor::*[@class='sticky-header']) and not(contains(@style,'visibility: hidden'))) or (ancestor::*[@class='sticky-header' and not(contains(@style,'display: none'))])]//span[contains(@class, 'action-menu-item') and .= '{{action}}']" parameterized="true"/>
3334
<element name="gridDataRow" type="input" selector=".data-row .data-grid-cell-content"/>
35+
<element name="pagesGridRowByTitle" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
3436
</section>
3537
</sections>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="AdminCmsBlockGridUrlFilterApplierTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="Filter CMS block using GET URL parameter"/>
15+
<title value="Verify that filter is applied on block grid when filters parameter is set on url"/>
16+
<description value="Accessing block grid url with filters parameter"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/1320712/scenarios/4931106"/>
19+
<group value="Cms"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<createData entity="Sales25offBlock" stepKey="createBlock"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
27+
<deleteData createDataKey="createBlock" stepKey="deletePage"/>
28+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
29+
</after>
30+
<amOnPage url="{{CmsBlocksPage.url}}?filters[title]=$$createBlock.title$$" stepKey="navigateToBlockGridWithFilters"/>
31+
<waitForPageLoad stepKey="waitForBlockGrid"/>
32+
<see selector="{{BlockPageActionsSection.blockGridRowByTitle($$createBlock.title$$)}}" userInput="$$createBlock.title$$" stepKey="seeBlock"/>
33+
<seeElement selector="{{BlockPageActionsSection.activeFilterDiv}}" stepKey="seeEnabledFilters"/>
34+
<see selector="{{BlockPageActionsSection.activeFilterDiv}}" userInput="Title: $$createBlock.title$$" stepKey="seeBlockTitleFilter"/>
35+
</test>
36+
</tests>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="AdminCmsPageGridUrlFilterApplierTest">
12+
<annotations>
13+
<features value="CmsPage"/>
14+
<stories value="Filter CMS page using GET URL parameter"/>
15+
<title value="Verify that filter is applied on page grid when filters parameter is set on url"/>
16+
<description value="Accessing page grid url with filters parameter"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/1320712/scenarios/4931106"/>
19+
<group value="Cms"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<createData entity="_defaultCmsPage" stepKey="createPage"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
27+
<deleteData createDataKey="createPage" stepKey="deletePage"/>
28+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
29+
</after>
30+
<amOnPage url="{{CmsPagesPage.url}}?filters[title]=$$createPage.title$$" stepKey="navigateToPageGridWithFilters"/>
31+
<waitForPageLoad stepKey="waitForPageGrid"/>
32+
<see selector="{{CmsPagesPageActionsSection.pagesGridRowByTitle($$createPage.title$$)}}" userInput="$$createPage.title$$" stepKey="seePage"/>
33+
<seeElement selector="{{CmsPagesPageActionsSection.activeFilter}}" stepKey="seeEnabledFilters"/>
34+
<see selector="{{CmsPagesPageActionsSection.activeFilter}}" userInput="Title: $$createPage.title$$" stepKey="seePageTitleFilter"/>
35+
</test>
36+
</tests>

app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
<body>
1010
<referenceContainer name="content">
1111
<uiComponent name="cms_block_listing"/>
12+
<block class="Magento\Backend\Block\Template" template="Magento_Cms::url_filter_applier.phtml" name="block_list_url_filter_applier">
13+
<arguments>
14+
<argument name="listing_namespace" xsi:type="string">cms_block_listing</argument>
15+
</arguments>
16+
</block>
1217
</referenceContainer>
1318
<referenceContainer name="admin.scope.col.wrap" htmlClass="admin__old" /> <!-- ToDo UI: remove this wrapper with old styles removal. The class name "admin__old" is for tests only, we shouldn't use it in any way -->
1419
</body>

app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<body>
1111
<referenceContainer name="content">
1212
<uiComponent name="cms_page_listing"/>
13+
<block class="Magento\Backend\Block\Template" template="Magento_Cms::url_filter_applier.phtml" name="page_list_url_filter_applier">
14+
<arguments>
15+
<argument name="listing_namespace" xsi:type="string">cms_page_listing</argument>
16+
</arguments>
17+
</block>
1318
</referenceContainer>
1419
</body>
1520
</page>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var $block \Magento\Backend\Block\Template */
8+
/** @var \Magento\Framework\Escaper $escaper */
9+
?>
10+
<script type="text/x-magento-init">
11+
{
12+
"*": {
13+
"Magento_Ui/js/grid/url-filter-applier": {
14+
"listingNamespace": "<?= $escaper->escapeJs($block->getListingNamespace()) ?>"
15+
}
16+
}
17+
}
18+
</script>

0 commit comments

Comments
 (0)