<?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">
    <!-- Open the Minicart and check Summary -->
    <actionGroup name="StorefrontCheckCartDiscountAndSummaryActionGroup">
        <annotations>
            <description>Validates that the provided Order Total and Discount Totals are present and correct under the 'Summary' section of the Storefront Shopping Cart page.</description>
        </annotations>
        <arguments>
            <argument name="total" type="string"/>
            <argument name="discount" type="string"/>
        </arguments>
        <waitForElement time="30" selector="{{CheckoutCartSummarySection.estimateShippingAndTaxForm}}" stepKey="waitForEstimateShippingAndTaxForm"/>
        <waitForElement time="30" selector="{{CheckoutCartSummarySection.shippingMethodForm}}" stepKey="waitForShippingMethodForm"/>
        <waitForElementVisible time="30" selector="{{CheckoutCartSummarySection.total}}" stepKey="waitForTotalElement"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <waitForText selector="{{CheckoutCartSummarySection.total}}" userInput="${{total}}" stepKey="assertTotal"/>
        <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
        <waitForText selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/>
    </actionGroup>
</actionGroups>
