<?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="SwitchCategoryStoreViewActionGroup">
        <annotations>
            <description>Navigates to category page, selects a category and changes store view to specified store.</description>
        </annotations>
        <arguments>
            <argument name="Store"/>
            <argument name="CatName"/>
        </arguments>

        <amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatName)}}" stepKey="navigateToCreatedCategory"/>
        <waitForPageLoad stepKey="waitForPageLoad2"/>
        <waitForLoadingMaskToDisappear stepKey="waitForSpinner"/>
        <scrollToTopOfPage stepKey="scrollToToggle"/>
        <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="openStoreViewDropDown"/>
        <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(Store)}}" stepKey="selectStoreView"/>
        <waitForPageLoad stepKey="waitForPageLoad3"/>
        <waitForLoadingMaskToDisappear stepKey="waitForSpinner2"/>
        <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="selectStoreViewAccept"/>
        <waitForPageLoad stepKey="waitForStoreViewChangeLoad"/>
    </actionGroup>
</actionGroups>
