<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright 2022 Adobe
 * All Rights Reserved.
 */
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <actionGroup name="AdminResetPasswordActionGroup">
        <annotations>
            <description>Reset password using old password on My Account page.</description>
        </annotations>
        <amOnPage url="{{AdminSystemAccountPage.url}}" stepKey="openAdminSystemAccountPage" />
        <fillField selector="{{AdminSystemAccountSection.newPassword}}" userInput="Admin@12345678" stepKey="enterPassword"/>
        <fillField selector="{{AdminSystemAccountSection.passwordConfirmation}}" userInput="Admin@12345678" stepKey="confirmPassword"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveUser"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <see userInput="This is a required field." stepKey="seeRequiredField1"/>
        <fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="Invalid12345678" stepKey="fillWrongPassword"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveUser1"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <scrollToTopOfPage stepKey="scrollToTopOfPage"/>
        <see userInput="The password entered for the current user is invalid. Verify the password and try again." stepKey="seeErrorMessage1"/>
        <fillField selector="{{AdminSystemAccountSection.newPassword}}" userInput="Admin@12345678" stepKey="enterPassword1"/>
        <fillField selector="{{AdminSystemAccountSection.passwordConfirmation}}" userInput="Admin@12345678" stepKey="confirmPassword1"/>
        <fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="123123aaa" stepKey="fillCorrectPassword"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveUser2"/>
        <see selector="{{AdminMessagesSection.success}}" userInput="The password of this account has been modified successfully." stepKey="seeSuccessMessage"/>

    </actionGroup>
</actionGroups>

