<?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="AdminCreateCustomerWithDefaultAddressWithoutPhoneActionGroup">
        <arguments>
            <argument name="customer" defaultValue="Simple_US_Customer"/>
            <argument name="address" defaultValue="US_Address_NY"/>
        </arguments>
        <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/>
        <click selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}" stepKey="addNewCustomer"/>
        <fillField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/>
        <fillField selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/>
        <fillField selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customer.email}}" stepKey="fillEmail"/>
        <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveAndContinue"/>
        <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
        <see  selector="{{AdminMessagesSection.success}}" userInput="You saved the customer." stepKey="seeSuccessMessage"/>
        <click selector="{{AdminCustomerAccountInformationSection.addressesButton}}" stepKey="goToAddresses"/>
        <waitForPageLoad stepKey="waitForAddresses"/>
        <click selector="{{AdminCustomerAddressesSection.addNewAddress}}" stepKey="clickOnAddNewAddress"/>
        <waitForPageLoad stepKey="waitForAddressFieldsLoad"/>
        <click selector="{{AdminCustomerAddressesSection.defaultBillingAddress}}" stepKey="defaultBillingAddressSetYes"/>
        <click selector="{{AdminCustomerAddressesSection.defaultShippingAddress}}" stepKey="defaultShippingAddressSetYes"/>
        <fillField selector="{{AdminCustomerAddressesSection.firstNameForAddress}}" userInput="{{address.firstname}}" stepKey="fillFirstNameForAddress"/>
        <fillField selector="{{AdminCustomerAddressesSection.lastNameForAddress}}" userInput="{{address.lastname}}" stepKey="fillLastNameForAddress"/>
        <fillField selector="{{AdminCustomerAddressesSection.streetAddress}}" userInput="{{address.street[0]}}" stepKey="fillStreetAddress"/>
        <fillField selector="{{AdminCustomerAddressesSection.city}}" userInput="{{address.city}}" stepKey="fillCity"/>
        <selectOption selector="{{AdminCustomerAddressesSection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/>
        <selectOption selector="{{AdminCustomerAddressesSection.state}}" userInput="{{address.state}}" stepKey="selectState"/>
        <fillField selector="{{AdminCustomerAddressesSection.zip}}" userInput="{{address.postcode}}" stepKey="fillZip"/>
        <click selector="{{AdminSlideOutDialogSection.saveButton}}" stepKey="saveAddress"/>
        <dontSee selector="{{AdminCustomerAddressesSection.phoneNumberRequiredMessage}}" stepKey="dontSeePhoneErrorMessage"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="save"/>
        <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessfullyCreatedMessage"/>
        <see  selector="{{AdminMessagesSection.success}}" userInput="You saved the customer." stepKey="seeSuccessMessageAgain"/>
    </actionGroup>
</actionGroups>
