<?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="StorefrontOpenProductFromQuickSearchActionGroup">
        <annotations>
            <description>Clicks on the provided Product Name from the Storefront Quick Search Results page.</description>
        </annotations>
        <arguments>
            <argument name="productName" type="string"/>
            <argument name="productUrlKey" type="string"/>
        </arguments>

        <scrollTo selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}" stepKey="scrollToProduct"/>
        <click stepKey="openProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/>
        <waitForPageLoad stepKey="waitForProductLoad"/>
        <seeInCurrentUrl url="{{productUrlKey}}" stepKey="checkUrl"/>
        <see stepKey="checkName" selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productName}}"/>
    </actionGroup>
</actionGroups>
