<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * Copyright © Magento, Inc. All rights reserved.
  * See COPYING.txt for license details.
  */
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
    <test name="AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest" deprecated="Use StorefrontAddressStateFieldForUKCustomerRemainOptionAfterRefreshTest instead">
        <annotations>
            <features value="Checkout"/>
            <stories value="Guest checkout"/>
            <title value="DEPRECATED. Address State Field For UK Customers Remain Option even After Browser Refresh"/>
            <description value="Address State Field For UK Customers Remain Option even After Browser Refresh"/>
            <severity value="MAJOR"/>
            <testCaseId value="MAGETWO-93329"/>
            <group value="checkout"/>
            <skip>
                <issueId value="DEPRECATED">Use StorefrontAddressStateFieldForUKCustomerRemainOptionAfterRefreshTest instead</issueId>
            </skip>
            <group value="pr_exclude"/>
        </annotations>
        <before>
            <createData entity="_defaultCategory" stepKey="createCategory"/>
            <createData entity="ApiSimpleProduct" stepKey="createProduct">
                <requiredEntity createDataKey="createCategory"/>
            </createData>
        </before>
        <after>
            <deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
            <deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
        </after>

        <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="onCategoryPage"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
        <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/>
        <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
        <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/>
        <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/>
        <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" />
        <selectOption stepKey="selectCounty" selector="{{CheckoutShippingSection.country}}" userInput="{{UK_Address.country_id}}"/>
        <waitForPageLoad stepKey="waitFormToReload"/>
        <actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
        <comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitFormToReload1" />
        <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
        <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
        <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
        <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{UK_Address.street[0]}}" stepKey="enterStreet"/>
        <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{UK_Address.city}}" stepKey="enterCity"/>
        <fillField selector="{{CheckoutShippingSection.stateInput}}" userInput="{{UK_Address.province}}" stepKey="enterProvince"/>
        <waitForPageLoad stepKey="waitFormToReload2"/>
        <see userInput="State/Province" stepKey="StateFieldStillExists"/>
        <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{UK_Address.telephone}}" stepKey="enterTelephone"/>
        <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
        <click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
        <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
        <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
        <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>

    </test>
</tests>
