<?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="StorefrontAddProductToCompareActionGroup">
        <annotations>
            <description>Add a Product to the Compare Product list. Validate that the Success Message is present.</description>
        </annotations>
        <arguments>
            <argument name="productVar"/>
        </arguments>

        <waitForPageLoad stepKey="waitForProductPageOpenedAndLoaded" />
        <waitForElementClickable selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="waitForAddToCompareButtonClickable" />
        <click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/>
        <waitForElement selector="{{StorefrontMessagesSection.success}}" stepKey="waitForAddProductToCompareSuccessMessage"/>
        <see selector="{{StorefrontMessagesSection.success}}" userInput="You added product {{productVar.name}} to the comparison list." stepKey="assertAddProductToCompareSuccessMessage"/>
        <waitForPageLoad stepKey="waitForAdditionToFinish" />
    </actionGroup>
</actionGroups>
