<?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="SwitchToPayPalGroupBtnActionGroup">
        <annotations>
            <description>Switch to Paypal group button</description>
        </annotations>
        <arguments>
            <argument name="elementNumber" type="string" defaultValue="0"/>
        </arguments>
        <!--set ID for iframe of PayPal group button-->
        <executeJS function="document.getElementsByClassName('component-frame')[{{elementNumber}}].setAttribute('name', 'myFrame');" stepKey="setIDForIframe"/>
        <!--switch to iframe of PayPal group button-->
        <switchToIFrame userInput="myFrame" stepKey="switchToIframe"/>
        <waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/>
        <click selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="clickPayPalBtn"/>
        <switchToIFrame stepKey="switchBackToMainFrame"/>
    </actionGroup>
</actionGroups>
