<?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="AddProductToCheckoutPageActionGroup">
        <annotations>
            <description>Goes to the provided Category page on the Storefront. Adds the 1st Product to the Cart. Goes to Checkout. Select the Shipping Method. Selects PayPal as the Payment Method.</description>
        </annotations>
        <arguments>
            <argument name="Category"/>
        </arguments>

        <amOnPage url="{{StorefrontCategoryPage.url(Category.name)}}" stepKey="onCategoryPage"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
        <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
        <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
        <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/>
        <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>
        <waitForPageLoad stepKey="waitForPageLoad2"/>
        <waitForPageLoad stepKey="waitForLoadingMask"/>
        <waitForElementClickable selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="waitForFirstShippingMethodClickable" />
        <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
        <waitForPageLoad stepKey="waitForLoadingMask2"/>
        <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
        <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
        <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPlaceOrderButton"/>
        <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalCheckbox"/>
        <waitForPageLoad stepKey="waitForPaymentLoad"/>
    </actionGroup>
</actionGroups>
