<?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="AdminAssertAssignedSourcesQtyInGridForProductActionGroup">
        <annotations>
            <description>Admin asserts the assigned sources quantity as zero on product grid page.</description>
        </annotations>
        <arguments>
            <argument name="productSku" type="string"/>
            <argument name="source1_name"/>
            <argument name="source2_name"/>
            <argument name="source3_name"/>
            <argument name="source4_name"/>
        </arguments>
        <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
        <waitForPageLoad stepKey="waitForProductIndexPageToLoad"/>
        <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
        <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
        <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProduct1SkuFilter"/>
        <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
        <waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
        <scrollTo selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="scrollToProduct1AssignedSourcesGrid"/>
        <waitForElementVisible selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="waitForProduct1AssignedSourcesGridToBeinteractable"/>
        <moveMouseOver selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="hoverOverProduct1AssignedSourcesGrid"/>
        <waitForElementVisible selector="{{AdminProductGridSection.qtyPerSourceOnHover(source1_name,'0')}}" stepKey="waitForElementVisiblePostHoverOnProduct1"/>
        <seeElement selector="{{AdminProductGridSection.qtyPerSourceOnHover(source1_name,'0')}}" stepKey="see0quantityForProduct1ForAssignedSources1"/>
        <seeElement selector="{{AdminProductGridSection.qtyPerSourceOnHover(source2_name,'0')}}" stepKey="see0quantityForProduct1ForAssignedSources2"/>
        <seeElement selector="{{AdminProductGridSection.qtyPerSourceOnHover(source3_name,'0')}}" stepKey="see0quantityForProduct1ForAssignedSources3"/>
        <seeElement selector="{{AdminProductGridSection.qtyPerSourceOnHover(source4_name,'0')}}" stepKey="see0quantityForProduct1ForAssignedSources4"/>
    </actionGroup>
</actionGroups>
