<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * Copyright © Magento, Inc. All rights reserved.
  * See COPYING.txt for license details.
  */
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
    <test name="ValidateResizeOnUnevenGridTest">
        <annotations>
            <features value="PageBuilder"/>
            <stories value="Column"/>
            <title value="Grid Size: Verify we can resize columns on uneven grid sizes"/>
            <description value="Verify we can resize columns on uneven grid sizes"/>
            <severity value="MAJOR"/>
            <useCaseId value="MC-950"/>
            <testCaseId value="MC-2295"/>
            <group value="pagebuilder"/>
            <group value="pagebuilder-column"/>
            <group value="pagebuilder-columnGridSize"/>
            <group value="cloud"/>
        </annotations>
        <before>
            <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
            <actionGroup ref="navigateToAPageWithPageBuilder" stepKey="navigateToAPageWithPageBuilder"/>
            <actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
            <actionGroup ref="dragContentTypeToStage" stepKey="dragRowToRootContainer">
                <argument name="contentType" value="PageBuilderRowContentType"/>
                <argument name="containerTargetType" value="PageBuilderRootContainerContentType"/>
            </actionGroup>
        </before>
        <after>
            <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/>
        </after>
        <actionGroup ref="dragContentTypeToStage" stepKey="dragColumnIntoStage">
            <argument name="contentType" value="PageBuilderColumnGroupContentType"/>
        </actionGroup>
        <actionGroup ref="duplicateContentType" stepKey="duplicateColumn">
            <argument name="contentType" value="PageBuilderColumnContentType"/>
            <argument name="targetIndex" value="1"/>
        </actionGroup>
        <seeNumberOfElements selector="{{ColumnOnBackend.allColumns}}" userInput="3" stepKey="seeNumberOfColumns3"/>
        <actionGroup ref="updateGridSizeInForm" stepKey="updateGridSizeTo7">
            <argument name="gridSize" value="7"/>
        </actionGroup>
        <actionGroup ref="saveEditPanelSettings" stepKey="saveEditPanelSettings"/>
        <seeNumberOfElements selector="{{ColumnOnBackend.allColumns}}" userInput="3" stepKey="seeNumberOfColumnsStill3"/>
        <actionGroup ref="closeGridSizeForm" stepKey="closeGridSizeForm"/>
        <!-- Verify Initial Column Sizes -->
        <comment userInput="Verify Initial Column Sizes " stepKey="context0"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('1','2/7')}}" stepKey="checkWidthFirstColumn"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('2','2/7')}}" stepKey="checkWidthSecondColumn"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('3','3/7')}}" stepKey="checkWidthThirdColumn"/>
        <!-- Grab grid guide location for column 1 -->
        <comment userInput="Grab grid guide width" stepKey="context1"/>
        <executeJS function="return document.querySelector('{{ColumnOnBackend.columnResizeGridLine('1')}}').clientWidth" stepKey="guideWidth"/>
        <!-- Resize Column 1 -->
        <comment userInput="Resize Column 1" stepKey="context2"/>
        <dragAndDrop selector1="{{ColumnOnBackend.columnX('1')}} {{ColumnOnBackend.columnResizeHandle}}" selector2="{{ColumnOnBackend.columnResizeGridLine('1')}}" x="$guideWidth" stepKey="resizeColumn1"/>
        <waitForPageLoad stepKey="waitForDragAndDrop"/>
        <seeNumberOfElements selector="{{ColumnOnBackend.allColumns}}" userInput="3" stepKey="seeNumberOfColumnsStill32"/>
        <!-- Verify New Column Sizes -->
        <comment userInput="Verify New Column Sizes " stepKey="context3"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('1','1/7')}}" stepKey="checkWidthFirstColumn2"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('2','3/7')}}" stepKey="checkWidthSecondColumn2"/>
        <seeElement selector="{{ColumnOnBackend.displayLabel('3','3/7')}}" stepKey="checkWidthThirdColumn2"/>
    </test>
</tests>
