<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * Copyright 2024 Adobe
  * All Rights Reserved.
  */
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <!-- Add custom option, title and type -->
    <actionGroup name="AdminAddProductCustomOptionActionGroup">
        <annotations>
            <description>Adds the provided Custom Option Title/Type to a Product on the Admin Product creation/edit page under the 'Customizable Options' section.</description>
        </annotations>
        <arguments>
            <argument name="customOptionTitle" type="string"/>
            <argument name="customOptionType" type="string"/>
        </arguments>

        <scrollTo selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="scrollToCustomizableOptionsSection"/>
        <waitForPageLoad stepKey="waitForScrolling"/>
        <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/>
        <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/>
        <waitForPageLoad stepKey="waitForAddProductPageLoad"/>
        <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionTitle}}"/>
        <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/>
        <waitForPageLoad stepKey="waitForDropdownOpen"/>
        <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType(customOptionType)}}"/>
    </actionGroup>
</actionGroups>
