<?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">
    <!--Create a new root category-->
    <actionGroup name="AdminCreateRootCategory">
        <annotations>
            <description>Requires navigation to Category creation. Adds a new root category and asserts on creation.</description>
        </annotations>
        <arguments>
            <argument name="categoryEntity" defaultValue="NewRootCategory"/>
        </arguments>
        
        <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/>
        <click selector="{{AdminCategorySidebarActionSection.AddRootCategoryButton}}" stepKey="clickOnAddRootCategoryButton"/>
        <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/>
        <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterNewRootCategoryName"/>
        <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
        <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/>
        <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
        <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/>
        <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/>
        <seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeNewCategoryPageTitle"/>
        <seeElement selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="seeCategoryInTree"/>
    </actionGroup>
</actionGroups>
