<?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="StorefrontAddCategoryBundleProductToCartActionGroup">
        <annotations>
            <description>Adds a Bundled Product to the Cart from the Category page.</description>
        </annotations>
        <arguments>
            <argument name="product"/>
            <argument name="quantity" defaultValue="1" type="string"/>
        </arguments>

        <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/>
        <click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/>
        <waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
        <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/>
        <waitForPageLoad time="30" stepKey="waitForPageLoad2"/>
        <fillField selector="{{StorefrontBundleProductActionSection.quantityField}}" userInput="{{quantity}}" stepKey="fillBundleProductQuantity"/>
        <click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddBundleProductToCart"/>
        <waitForPageLoad time="30" stepKey="waitForPageLoad3"/>
        <waitForText userInput="{{quantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/>
    </actionGroup>
</actionGroups>
