<?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="CloseLightboxModalActionGroup">
        <annotations>
            <description>Closes the payment method modal.</description>
        </annotations>

        <!-- Switch to Overlay Iframe -->
        <waitForElementVisible selector="{{StorefrontStripePaymentMethodSection.modalOverlayIframe}}" time="60" stepKey="waitForOverlayIframe"/>
        <switchToIFrame selector="{{StorefrontStripePaymentMethodSection.modalOverlayIframe}}" stepKey="switchToOverlayIframe"/>

        <!-- Switch to Modal Content Iframe (the hosted voucher page) -->
        <waitForElementVisible selector="{{StorefrontStripePaymentMethodSection.modalContentIframe}}" time="60" stepKey="waitForContentIframe"/>
        <switchToIFrame selector="{{StorefrontStripePaymentMethodSection.modalContentIframe}}" stepKey="switchToContentIframe"/>
        <waitForElementVisible selector="{{StorefrontStripePaymentMethodSection.modalCloseButton}}" time="60" stepKey="waitForCloseButtonVisible"/>

        <!-- Wait for close button and close the iframe -->
        <waitForElementClickable selector="{{StorefrontStripePaymentMethodSection.modalCloseButton}}" time="60" stepKey="waitForCloseButtonClickable"/>
        <wait time="2" stepKey="waitForJavascriptBindings"/>
        <click selector="{{StorefrontStripePaymentMethodSection.modalCloseButton}}" stepKey="clickCloseButton"/>
        <switchToIFrame stepKey="switchOutOfOxxoContentIframe"/>
        <switchToIFrame stepKey="switchOutOfOverlayIframe"/>

    </actionGroup>
</actionGroups>
