<?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="AdminAuthorizeAnOrderActionGroup">
        <annotations>
            <description>Authorize the processing order on the Admin orders view page. Validates that the provided Order Status is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="orderStatus" type="string" defaultValue="Processing"/>
        </arguments>
        <waitForElementClickable selector="{{AdminOrderDetailsMainActionsSection.authorize}}" stepKey="waitForAuthorizeButtonToBeClickable"/>
        <click selector="{{AdminOrderDetailsMainActionsSection.authorize}}" stepKey="clickAuthorizeButton"/>
        <waitForText selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to authorize full order amount?" stepKey="seeConfirmationMessage"/>
        <waitForElementClickable selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForOkayButtonToAppear"/>
        <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmOrder"/>
        <waitForText selector="{{AdminMessagesSection.success}}" userInput="Payment authorization has been successfully created." stepKey="seeAuthorizedSuccessMessage"/>
        <waitForText selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{orderStatus}}" stepKey="seeOrderStatus"/>
    </actionGroup>
</actionGroups>
