<?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">
    <!-- Add product with selected option to Cart from the product page  -->
    <actionGroup name="StorefrontAddProductWithSelectedConfigurableOptionToCartActionGroup">
        <annotations>
            <description>Selects the provided Product Option in the drop down on a Storefront Configurable product page. Clicks on Add to Cart. Validates that the Success Message is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="product" type="entity"/>
            <argument name="option" type="string"/>
        </arguments>

        <selectOption userInput="{{option}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption"/>
        <click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/>
        <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/>
        <see selector="{{StorefrontProductPageSection.messagesBlock}}" userInput="You added {{product.name}} to your shopping cart." stepKey="assertSuccessMessage"/>
    </actionGroup>
</actionGroups>
