<?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="AdminCreateCustomerWithWebSiteAndGroupActionGroup">
        <annotations>
            <description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description>
        </annotations>
        <arguments>
            <argument name="customerData" defaultValue="Simple_US_Customer"/>
            <argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/>
            <argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/>
        </arguments>

        <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/>
        <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/>
        <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/>
        <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/>
        <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/>
        <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/>
        <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/>
        <selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/>
        <waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/>
        <click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/>
        <waitForPageLoad stepKey="waitForCustomersPage"/>
        <see stepKey="seeSuccessMessage" userInput="You saved the customer."/>
    </actionGroup>
</actionGroups>
