<?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="AdminDeleteUserViaCurlActionGroup">
        <arguments>
            <argument name="user" type="entity" />
            <argument name="adminPassword" type="string" defaultValue="{{DefaultAdminUser.password}}" />
        </arguments>
        <amOnPage stepKey="amOnAdminUsersPage" url="{{AdminUsersPage.url}}"/>
        <waitForPageLoad stepKey="waitForAdminUserPageLoad"/>
        <waitForElementClickable selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="WaitForresetFiltersElementToBeClickable"/>
        <click selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="resetFilters" />
        <waitForPageLoad stepKey="waitForFiltersToReset" />
        <waitForElementVisible selector="{{AdminLegacyDataGridTableSection.columnTemplateStrict(user.username, 'user_id')}}" stepKey="waitForUserIdVisible" />
        <scrollTo  selector="{{AdminLegacyDataGridTableSection.columnTemplateStrict(user.username, 'user_id')}}" stepKey="scrollToUserId" />
        <waitForElementVisible selector="{{AdminLegacyDataGridTableSection.columnTemplateStrict(user.username, 'user_id')}}" stepKey="waitForUserIdVisibleBeforeElementIsGrabbed" />
        <grabTextFrom selector="{{AdminLegacyDataGridTableSection.columnTemplateStrict(user.username, 'user_id')}}" stepKey="userId" />
        <createData entity="deleteUser" stepKey="deleteUser">
            <field key="user_id">{$userId}</field>
            <field key="current_password">{{adminPassword}}</field>
        </createData>
    </actionGroup>
</actionGroups>
