<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <actionGroup name="PlaceSimpleOrderActionGroup">

        <annotations>
            <description>Places an oder from the payment page.</description>
        </annotations>

        <!-- Wait for place order button and click on it -->
        <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
        <scrollTo selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="scrollToPlaceOrderButton"/>
        <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
        <makeScreenshot stepKey="screenshotErrors" />

        <wait stepKey="waitForOrderPlacement" time="10"/>

        <waitForPageLoad stepKey="waitForSuccessPageToLoad" time="30"/>

        <!-- Check if success message is displayed -->
        <waitForElement selector="{{CheckoutSuccessMainSection.successTitle}}" stepKey="waitForSuccessMessage"/>
        <wait time="5" stepKey="waitForUIToRender"/>
        <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeOrderSuccessMessage"/>

    </actionGroup>
</actionGroups>
