<?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="AdminSetShippingOriginConfigActionGroup">
        <arguments>
            <argument name="country" type="string" defaultValue="Canada"/>
            <argument name="state" type="string" defaultValue="Saskatchewan"/>
            <argument name="postcode" type="string" defaultValue="S4P3Y2"/>
        </arguments>
        <!-- navigate to the tax configuration page -->
        <amOnPage url="{{AdminShippingSettingsPage.url}}" stepKey="goToAdminShippingPage"/>
        <waitForPageLoad stepKey="waitForShippingConfigLoad"/>
        <conditionalClick selector="{{AdminShippingSettingsConfigSection.Origin}}" dependentSelector="{{AdminShippingSettingsConfigSection.OriginOpened}}" visible="false" stepKey="openPriceDisplaySettings"/>
        <uncheckOption stepKey="clickCountry" selector="{{AdminShippingSettingsConfigSection.systemValueCountry}}"/>
        <waitForPageLoad stepKey="waitForUncheck"/>
        <selectOption selector="{{AdminShippingSettingsConfigSection.dropdownCountry}}" userInput="{{country}}" stepKey="SelectCountry"/>
        <uncheckOption stepKey="clickState" selector="{{AdminShippingSettingsConfigSection.systemValueState}}"/>
        <wait stepKey="WaitForUncheckStateSystemValue" time="10"/>
        <selectOption selector="{{AdminShippingSettingsConfigSection.dropdownState}}" userInput="{{state}}" stepKey="SelectState"/>
        <uncheckOption stepKey="clickPostcode" selector="{{AdminShippingSettingsConfigSection.systemValuePostcode}}"/>
        <wait stepKey="waitForUncheckSystemPostcode" time="10"/>
        <fillField selector="{{AdminShippingSettingsConfigSection.PostcodeValue}}" userInput="{{postcode}}" stepKey="fillPostcode"/>
        <!-- Save the settings -->
        <scrollToTopOfPage stepKey="scrollToTop"/>
        <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveChanges"/>
    </actionGroup>
</actionGroups>
