Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover Search Term Entity Redirect Works on Store Front by MFTF Test #26574

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateNewSearchTermEntityActionGroup">
<arguments>
<argument name="query" type="string"/>
<argument name="store" type="string"/>
<argument name="redirectUrl" type="string"/>
</arguments>

<click selector="{{AdminSearchTermsGridSection.addNewEntity}}" stepKey="clickAddNewButton"/>
<fillField stepKey="fillSearchQueryField" selector="{{AdminSearchTermFormSection.searchQuery}}" userInput="{{query}}"/>
<selectOption stepKey="storeSelect" selector="{{AdminSearchTermFormSection.storeID}}" userInput="{{store}}"/>
<fillField stepKey="fillRedirectUrl" selector="{{AdminSearchTermFormSection.redirectUrl}}" userInput="{{redirectUrl}}"/>
<click stepKey="saveSearchTerm" selector="{{AdminSearchTermFormSection.save}}"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StoreFrontQuickSearchActionGroup">
<arguments>
<argument name="query" type="string"/>
</arguments>

<fillField stepKey="fillSearchField" selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="{{query}}"/>
<waitForElementVisible selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="waitForSubmitButton"/>
<click stepKey="clickSearchButton" selector="{{StorefrontQuickSearchSection.searchButton}}"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminSearchTermFormSection">
<element name="save" type="button" selector=".page-actions-buttons .save"/>
<element name="searchQuery" type="input" selector=".admin__field-control.control #query_text"/>
<element name="storeID" type="input" selector=".admin__field-control.control #store_id"/>
<element name="redirectUrl" type="input" selector=".admin__field-control.control #redirect"/>
<element name="displayInTerms" type="input" selector=".admin__field-control.control #display_in_terms"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminSearchTermsGridSection">
<element name="addNewEntity" type="button" selector=".page-actions-buttons .add"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontVerifySearchTermEntityRedirectTest">
<annotations>
<stories value="Search Term Redirect"/>
<title value="Create Search Term Entity With Redirect. Check How Redirect is Working on Storefront"/>
<description value="Storefront search by created search term with redirect. Verifying if created redirect is working"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The <severity> annotation is missing here.

</annotations>

<before>
<!-- Login As Admin User -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<!-- Navigate To Marketing Search Terms Grid -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSearchTermPage">
<argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/>
<argument name="submenuUiId" value="{{AdminMenuMarketingSEOAndSearchSearchTerms.dataUiId}}"/>
</actionGroup>
<!-- Create Custom Search Term With Redirect -->
<actionGroup ref="AdminCreateNewSearchTermEntityActionGroup" stepKey="createSearchTerm">
<argument name="query" value="{{SearchTerm.query_text}}"/>
<argument name="store" value="{{SearchTerm.store_id}}"/>
<argument name="redirectUrl" value="{{SearchTerm.redirect}}"/>
</actionGroup>
</before>
<after>
<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="navigateToSearchTermPage"/>
<actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="findCreatedTerm">
<argument name="searchQuery" value="{{SearchTerm.query_text}}"/>
</actionGroup>
<actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteCreatedSearchTerm"/>
Comment on lines +34 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create AdminDeleteSearchTermByQueryActionGroup that actually extends AdminSearchTermFilterBySearchQueryActionGroup and adds <amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="navigateToSearchTermPage"/> before first step and <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteCreatedSearchTerm"/> after last step? :-)

I'm pretty sure that other tests related with SearchTerms will benefit from that change.

</after>

<!-- TEST BODY -->
<!-- Navigate To StoreFront -->
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/>
<!-- Fill in Search Field, Submit Search Request -->
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm">
<argument name="query" value="{{SearchTerm.query_text}}"/>
</actionGroup>
<!-- Assert Current Url -->
<seeCurrentUrlEquals stepKey="checkUrl" url="{{SearchTerm.redirect}}"/>
</test>
</tests>