<?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="OpenEditCustomerFromAdminActionGroup">
        <annotations>
            <description>Goes to the Admin Customers grid page. Filters the grid based on the provided Customer. Clicks on Edit.</description>
        </annotations>
        <arguments>
            <argument name="customer"/>
        </arguments>

        <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/>
        <click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="openFilter"/>
        <fillField userInput="{{customer.email}}" selector="{{AdminCustomerFiltersSection.emailInput}}" stepKey="filterEmail"/>
        <click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>
        <waitForPageLoad stepKey="waitForPageLoad2"/>
        <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEdit"/>
        <waitForPageLoad stepKey="waitForPageLoad3"/>
    </actionGroup>
</actionGroups>
