<?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="StorefrontClearShoppingCartActionGroup">
        <annotations>
            <description>Clicks the Clear Shopping Cart button on the storefront on the shopping cart page and verifies shopping cart gets emptied.</description>
        </annotations>

        <waitForElementVisible selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="waitForEmptyCartButton"/>
        <click selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="clickEmptyCartButton"/>
        <waitForElementVisible selector="{{CheckoutCartProductSection.modalMessage}}" stepKey="waitForModalMessage"/>
        <waitForText selector="{{CheckoutCartProductSection.modalMessage}}" userInput="Are you sure you want to remove all items from your shopping cart?" stepKey="waitForTextModalMessage"/>
        <waitForElementVisible selector="{{CheckoutCartProductSection.modalConfirmButton}}" stepKey="waitForModalConfirmButton"/>
        <click selector="{{CheckoutCartProductSection.modalConfirmButton}}" stepKey="clickModalConfirmButton"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <seeCurrentUrlEquals url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart" stepKey="seeCurrentUrlEqualsCartPage"/>
        <waitForText selector="{{CheckoutCartMessageSection.emptyCartMessage}}" userInput="You have no items in your shopping cart." stepKey="waitForEmptyCartMessage"/>

    </actionGroup>
</actionGroups>
