<?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="AdminDeleteStoreViewActionGroup">
        <annotations>
            <description>Goes to the Admin Stores grid page. Deletes the provided Store without creating a Backup. Validates that the Success Message is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="customStore" defaultValue="customStore"/>
        </arguments>

        <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/>
        <waitForPageLoad stepKey="waitStoreIndexPageLoad"/>
        <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="resetSearchFilter"/>
        <fillField selector="{{AdminStoresGridSection.storeFilterTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilterField"/>
        <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearch"/>
        <click selector="{{AdminStoresGridSection.storeNameInFirstRow}}" stepKey="clickStoreViewInGrid"/>
        <waitForPageLoad stepKey="waitForStoreViewPage"/>
        <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreView"/>
        <selectOption selector="{{AdminStoreBackupOptionsSection.createBackupSelect}}" userInput="No" stepKey="dontCreateDbBackup"/>
        <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewAgain"/>
        <waitForElementVisible selector="{{AdminConfirmationModalSection.title}}" stepKey="waitingForWarningModal"/>
        <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreDelete"/>
        <waitForPageLoad stepKey="waitForSuccessMessage"/>
        <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitSuccessMessageAppears"/>
        <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the store view." stepKey="seeDeleteMessage"/>
    </actionGroup>
</actionGroups>
