<?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="deleteBlock">
        <annotations>
            <description>Goes to the Admin CMS Blocks page. Filters the grid based on the provided Block. Deletes the Block via the grid.</description>
        </annotations>
        <arguments>
            <argument name="Block" defaultValue=""/>
        </arguments>
        
        <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/>
        <waitForPageLoad stepKey="waitForPageLoad1"/>
        <conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/>
        <waitForPageLoad stepKey="waitForPageLoad2"/>
        <click selector="{{BlockPageActionsSection.FilterBtn}}" stepKey="clickFilterBtn"/>
        <fillField selector="{{BlockPageActionsSection.URLKey}}" userInput="{{Block.identifier}}" stepKey="fillBlockIdentifierInput"/>
        <click selector="{{BlockPageActionsSection.ApplyFiltersBtn}}" stepKey="applyFilter"/>
        <waitForLoadingMaskToDisappear stepKey="waitForGridToLoadResults"/>
        <waitForElementVisible selector="{{BlockPageActionsSection.select(Block.identifier)}}" stepKey="waitForCMSPageGrid"/>
        <click selector="{{BlockPageActionsSection.select(Block.identifier)}}" stepKey="clickSelect"/>
        <waitForElementVisible selector="{{BlockPageActionsSection.edit(Block.identifier)}}" stepKey="waitForEditLink"/>
        <click selector="{{BlockPageActionsSection.edit(Block.identifier)}}" stepKey="clickEdit"/>
        <waitForLoadingMaskToDisappear stepKey="waitForPageToLoad"/>
        <click selector="{{CmsBlockBlockActionSection.deleteBlock}}" stepKey="deleteBlock"/>
        <waitForElementVisible selector="{{CmsBlockBlockActionSection.deleteConfirm}}" stepKey="waitForOkButtonToBeVisible"/>
        <click selector="{{CmsBlockBlockActionSection.deleteConfirm}}" stepKey="clickOkButton"/>
        <waitForPageLoad stepKey="waitForPageLoad3"/>
        <see userInput="You deleted the block." stepKey="seeSuccessMessage"/>
    </actionGroup>
</actionGroups>
