<?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="StoreViewDisabledErrorSaveMessageActionGroup">
        <annotations>
            <description>Goes to the Admin Store View creation page. Fills in the provided Details (Store Group Name, Store View and Store View Status). Validates that the Error Message is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="storeGroupName" type="string"/>
            <argument name="storeView" type="string"/>
            <argument name="storeViewStatus" type="string"/>
        </arguments>

        <amOnPage  url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/>
        <waitForPageLoad stepKey="waitForProductPageLoad"/>
        <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
        <fillField userInput="{{storeView}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
        <fillField userInput="{{storeView}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
        <selectOption userInput="{{storeViewStatus}}" selector="{{AdminNewStoreSection.statusDropdown}}" stepKey="selectStoreViewStatus"/>
        <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/>
        <waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationButton"/>
        <conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="clickAcceptNewStoreViewCreationButton"/>
        <waitForElementVisible selector="{{AdminStoresMainActionsSection.errorMessage}}" stepKey="waitForErrorMessage"/>
        <see selector="{{AdminStoresMainActionsSection.errorMessage}}" userInput="The default store cannot be disabled" stepKey="AssertStoreDisabledErrorSaveMessage"/>
    </actionGroup>
</actionGroups>
