<?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="StoreFrontSelectDropDownSearchSuggestionActionGroup">
        <annotations>
            <description>Fills the Storefront Quick Search field. Validates that the provided Search Suggestion is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="searchQuery" type="string"/>
        </arguments>

        <waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" stepKey="waitForQuickSearchToBeVisible"/>
        <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{searchQuery}}" stepKey="fillSearchInput"/>
        <waitForElementVisible selector="{{StorefrontQuickSearchSection.searchDropDownSuggestion}}" stepKey="WaitForSearchDropDownSuggestion"/>
        <see selector="{{StorefrontQuickSearchSection.searchDropDownSuggestion}}" userInput="{{searchQuery}}" stepKey="seeDropDownSuggestion"/>
        <click selector="{{StorefrontQuickSearchSection.searchDropDownName(searchQuery)}}" stepKey="clickOnSearchSuggestion"/>
        <waitForPageLoad stepKey="waitForSelectedProductToLoad"/>
    </actionGroup>
</actionGroups>
