<?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="SetCartAttributeConditionForCartPriceRuleActionGroup">
        <annotations>
            <description>Sets the provided Cart Attribute Condition (Attribute Name, Operator Type and Value) on the Admin Cart Price Rule creation/edit page.</description>
        </annotations>
        <arguments>
            <argument name="attributeName" type="string"/>
            <argument name="operatorType" defaultValue="is" type="string"/>
            <argument name="value" type="string"/>
        </arguments>

        <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/>
        <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/>
        <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/>
        <waitForPageLoad stepKey="waitForDropDownOpened"/>
        <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/>
        <waitForPageLoad stepKey="waitForOperatorOpened"/>
        <click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseOption"/>
        <selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType"/>
        <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/>
        <fillField userInput="{{value}}" selector="{{AdminCartPriceRulesFormSection.conditionsValue}}" stepKey="fillActionValue"/>
        <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
        <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
    </actionGroup>
</actionGroups>
