<?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="AdminAddCustomUrlRewriteActionGroup">
        <annotations>
            <description>Goes to the Admin URL Rewrite edit page. Adds the provided Custom URL Rewrite details. Clicks on Save. Validates that the Success Message is present.</description>
        </annotations>
        <arguments>
            <argument name="customUrlRewriteValue" type="string"/>
            <argument name="storeValue" type="string"/>
            <argument name="requestPath" type="string"/>
            <argument name="targetPath" type="string"/>
            <argument name="redirectTypeValue" type="string"/>
            <argument name="description" type="string"/>
        </arguments>

        <amOnPage url="{{AdminUrlRewriteEditPage.url('')}}" stepKey="openUrlRewriteEditPage"/>
        <waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad" after="openUrlRewriteEditPage"/>
        <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/>
        <click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectCustom"/>
        <click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/>
        <click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/>
        <fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/>
        <fillField selector="{{AdminUrlRewriteEditSection.targetPath}}" userInput="{{targetPath}}" stepKey="fillTargetPath"/>
        <click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/>
        <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="selectRedirectTypeValue"/>
        <fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/>
        <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/>
        <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessSaveMessage"/>
    </actionGroup>
</actionGroups>
