<?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="ViewProductInAdminGridActionGroup">
        <annotations>
            <description>Filters the Admin Products grid by the provided Product (Name, SKU and Type).</description>
        </annotations>
        <arguments>
            <argument name="product" defaultValue="_defaultProduct"/>
        </arguments>

        <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
        <waitForPageLoad stepKey="waitForPageLoadInitial"/>
        <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
        <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
        <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/>
        <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
        <selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/>
        <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
        <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{product.name}}"  stepKey="seeProductNameInGrid"/>
        <see selector="{{AdminProductGridSection.productGridCell('1', 'Price')}}" userInput="{{product.price}}"  stepKey="seeProductPriceInGrid"/>
        <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/>
    </actionGroup>
</actionGroups>
