<?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">
    <actionGroup name="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup">
        <arguments>
            <argument name="credentials" defaultValue="_CREDS"/>
        </arguments>
        <!--Check in-context-->
        <switchToNextTab stepKey="switchToInContentTab"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <seeCurrentUrlMatches regex="~\//www.sandbox.paypal.com/~" stepKey="seeCurrentUrlMatchesConfigPath1"/>
        <conditionalClick selector="{{PayPalPaymentSection.notYouLink}}" dependentSelector="{{PayPalPaymentSection.notYouLink}}" visible="true" stepKey="selectNotYouSection"/>
        <conditionalClick selector="{{PayPalPaymentSection.existingAccountLoginBtn}}" dependentSelector="{{PayPalPaymentSection.existingAccountLoginBtn}}" visible="true" stepKey="skipAccountCreationAndLogin"/>
        <waitForPageLoad stepKey="waitForLoginPageLoad"/>
        <waitForElementClickable selector="{{PayPalPaymentSection.email}}" stepKey="waitForLoginForm"/>
        <click selector="{{PayPalPaymentSection.email}}" stepKey="focusOnEmailField"/>
        <clearField selector="{{PayPalPaymentSection.email}}" stepKey="clearEmailField"/>
        <fillField selector="{{PayPalPaymentSection.email}}" userInput="{{credentials.magento/PAYPAL_LOGIN}}" stepKey="fillEmail"/>
        <click selector="{{PayPalPaymentSection.nextButton}}" stepKey="clickNext"/>
        <waitForElementVisible selector="{{PayPalPaymentSection.password}}" stepKey="waitForPasswordField"/>
        <click selector="{{PayPalPaymentSection.password}}" stepKey="focusOnPasswordField"/>
        <fillField selector="{{PayPalPaymentSection.password}}" userInput="{{credentials.magento/PAYPAL_PWD}}" stepKey="fillPassword"/>
        <waitForElementClickable selector="{{PayPalPaymentSection.loginBtn}}" stepKey="waitForLoginBtn"/>
        <click selector="{{PayPalPaymentSection.loginBtn}}" stepKey="login"/>
        <waitForPageLoad stepKey="wait"/>
    </actionGroup>
</actionGroups>
