<?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="SetTaxClassForShipping">
        <annotations>
            <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'Taxable Goods'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description>
        </annotations>
        
        <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="expandTaxClassesTab"/>
        <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass"/>
        <uncheckOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="uncheckUseSystemValue"/>
        <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="Taxable Goods" stepKey="setShippingTaxClass"/>
        <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/>
        <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig"/>
    </actionGroup>
    
    <actionGroup name="ResetTaxClassForShipping">
        <annotations>
            <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Tax Class for Shipping' to 'None'. Clicks on the Save button. PLEASE NOTE: The value is Hardcoded.</description>
        </annotations>

        <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxConfigPagetoReset"/>
        <waitForPageLoad stepKey="waitForPageLoad2"/>
        <conditionalClick selector="{{SalesConfigSection.TaxClassesTab}}" dependentSelector="{{SalesConfigSection.CheckIfTaxClassesTabExpand}}" visible="true" stepKey="openTaxClassTab"/>
        <waitForElementVisible selector="{{SalesConfigSection.ShippingTaxClass}}" stepKey="seeShippingTaxClass2"/>
        <selectOption selector="{{SalesConfigSection.ShippingTaxClass}}" userInput="None" stepKey="resetShippingTaxClass"/>
        <checkOption selector="{{SalesConfigSection.EnableTaxClassForShipping}}" stepKey="useSystemValue"/>
        <click selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="collapseTaxClassesTab"/>
        <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
    </actionGroup>
    
    <actionGroup name="SetTaxApplyOnSetting">
        <annotations>
            <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button</description>
        </annotations>
        <arguments>
            <argument name="userInput" type="string"/>
        </arguments>
        
        <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/>
        <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/>
        <uncheckOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="enableApplyTaxOnSetting"/>
        <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOn"/>
        <scrollTo selector="{{SalesConfigSection.TaxClassesTab}}" stepKey="scrollToTop"/>
        <click selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" stepKey="collapseCalcSettingsTab"/>
        <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/>
        <waitForPageLoad stepKey="waitForConfigSaved"/>
        <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
    </actionGroup>
    
    <actionGroup name="DisableTaxApplyOnOriginalPrice">
        <annotations>
            <description>Goes to the 'Configuration' page for 'Tax'. Sets 'Apply Tax On' to the provided value. Clicks on the Save button.</description>
        </annotations>
        <arguments>
            <argument name="userInput" type="string"/>
        </arguments>
        
        <amOnPage url="{{AdminSalesTaxClassPage.url}}" stepKey="navigateToSalesTaxPage"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <conditionalClick selector="{{AdminConfigureTaxSection.taxCalculationSettings}}" dependentSelector="{{AdminConfigureTaxSection.taxCalculationAlgorithm}}" visible="false" stepKey="openTaxCalcSettingsSection"/>
        <scrollTo selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" x="0" y="-80" stepKey="goToCheckbox"/>
        <selectOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOn}}" userInput="{{userInput}}" stepKey="setApplyTaxOff"/>
        <checkOption selector="{{AdminConfigureTaxSection.taxCalculationApplyTaxOnInherit}}" stepKey="disableApplyTaxOnSetting"/>
        <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/>
        <waitForPageLoad stepKey="waitForConfigSaved"/>
        <see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
    </actionGroup>
</actionGroups>
