<?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="AdminConfigurationPaymentAdvancedActionGroup">
        <annotations>
            <description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample PayPal credentials and other details. Clicks on Save.</description>
        </annotations>
        <arguments>
            <argument name="credentials" defaultValue="_CREDS"/>
            <argument name="countryCode" type="string" defaultValue="us"/>
        </arguments>
        <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
        <waitForPageLoad stepKey="waitForConfigPageLoad"/>
        <waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/>
        <conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="expandOtherPaypalConfigButton"/>
        <waitForElementClickable selector="{{PayPalPaymentsProConfigSection.paymentsAdvanced(countryCode)}}" stepKey="waitForPayPalPaymentsAdvancedConfigureBtn"/>
        <click selector ="{{PayPalPaymentsProConfigSection.paymentsAdvanced(countryCode)}}" stepKey="clickPayPalPaymentsAdvancedConfigureBtn"/>
        <waitForElementVisible selector="{{AdminConfigurepaymentsAdvancedSection.user(countryCode)}}" stepKey="waitForUser"/>
        <fillField selector ="{{AdminConfigurepaymentsAdvancedSection.user(countryCode)}}" userInput="{{credentials.magento/paypal_paymentsflowlink_user}}" stepKey="inputUser"/>
        <waitForElementVisible selector="{{AdminConfigurepaymentsAdvancedSection.password(countryCode)}}" stepKey="waitForPassword"/>
        <fillField selector ="{{AdminConfigurepaymentsAdvancedSection.password(countryCode)}}" userInput="{{credentials.magento/paypal_paymentsflowlink_password}}}" stepKey="inputPassword"/>
        <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfiguration"/>
    </actionGroup>
</actionGroups>
