<?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="AdminChangeProductSEOSettingsActionGroup">
        <arguments>
            <argument name="productName" defaultValue="_defaultProduct.name"/>
        </arguments>
        <!--Scroll to element to avoid test order flakiness-->
        <waitForElement selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="waitForSection"/>
        <executeJS function="return document.querySelector(&quot;{{AdminProductSEOSection.sectionHeader}}&quot;).getBoundingClientRect().y" stepKey="sectionPosition"/>
        <executeJS function="return document.querySelector(&quot;{{AdminHeaderSection.pageMainActions}}&quot;).getBoundingClientRect().height" stepKey="floatingHeaderHeight"/>
        <executeJS function="window.scrollTo({top: {$sectionPosition}-{$floatingHeaderHeight}})" stepKey="scrollToSEOTab"/>
        <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickSearchEngineOptimizationTab"/>
        <waitForPageLoad stepKey="waitForTabOpen"/>
        <fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{productName}}" stepKey="setUrlKeyInput"/>
        <fillField selector="{{AdminProductSEOSection.metaTitleInput}}" userInput="{{productName}}" stepKey="setMetaTitleInput"/>
        <fillField selector="{{AdminProductSEOSection.metaKeywordsInput}}" userInput="{{productName}}" stepKey="setMetaKeywordsInput"/>
        <fillField selector="{{AdminProductSEOSection.metaDescriptionInput}}" userInput="{{productName}}" stepKey="setMetaDescriptionInput"/>
    </actionGroup>
</actionGroups>
