<?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="addOptionsToAttributeActionGroup">
        <annotations>
            <description>Adds 5 provided Options to a new Attribute on the Configurable Product creation/edit page.</description>
        </annotations>
        <arguments>
            <argument name="option1" defaultValue="colorProductAttribute2"/>
            <argument name="option2" defaultValue="colorDefaultProductAttribute1"/>
            <argument name="option3" defaultValue="colorProductAttribute3"/>
            <argument name="option4" defaultValue="colorProductAttribute1"/>
            <argument name="option5" defaultValue="colorDefaultProductAttribute2"/>
        </arguments>
        
        <!--Add option 1 to attribute-->
        <click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption1"/>
        <waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('1')}}" time="30" stepKey="waitForOptionRow1" after="clickAddOption1"/>
        <fillField selector="{{AdminNewAttributePanel.optionAdminValue('0')}}" userInput="{{option1.name}}" stepKey="fillAdminLabel1" after="waitForOptionRow1"/>
        
        <!--Add option 2 to attribute-->
        <click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption2" after="fillAdminLabel1"/>
        <waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('2')}}" time="30" stepKey="waitForOptionRow2" after="clickAddOption2"/>
        <fillField selector="{{AdminNewAttributePanel.optionAdminValue('1')}}" userInput="{{option2.name}}" stepKey="fillAdminLabel2" after="waitForOptionRow2"/>
        
        <!--Add option 3 to attribute-->
        <click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption3" after="fillAdminLabel2"/>
        <waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('3')}}" time="30" stepKey="waitForOptionRow3" after="clickAddOption3"/>
        <fillField selector="{{AdminNewAttributePanel.optionAdminValue('2')}}" userInput="{{option3.name}}" stepKey="fillAdminLabel3" after="waitForOptionRow3"/>
        
        <!--Add option 4 to attribute-->
        <click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption4" after="fillAdminLabel3"/>
        <waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('4')}}" time="30" stepKey="waitForOptionRow4" after="clickAddOption4"/>
        <fillField selector="{{AdminNewAttributePanel.optionAdminValue('3')}}" userInput="{{option4.name}}" stepKey="fillAdminLabel4" after="waitForOptionRow4"/>
        
        <!--Add option 5 to attribute-->
        <click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption5" after="fillAdminLabel4"/>
        <waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('5')}}" time="30" stepKey="waitForOptionRow5" after="clickAddOption5"/>
        <fillField selector="{{AdminNewAttributePanel.optionAdminValue('4')}}" userInput="{{option5.name}}" stepKey="fillAdminLabel5" after="waitForOptionRow5"/>
        
        <!--Save attribute-->
        <click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickSaveAttribute" after="fillAdminLabel5"/>
        <waitForPageLoad stepKey="waitForSavingAttribute"/>
        <see userInput="You saved the product attribute." stepKey="seeSuccessMessage"/>
    </actionGroup>
</actionGroups>
