<?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="AssertCMSPageContentActionGroup">
        <annotations>
            <description>Validates that the CMS Page details are present and correct. PLEASE NOTE: The CMS Page data is Hardcoded, using '_duplicatedCMSPage'.</description>
        </annotations>

        <grabValueFrom selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}"  stepKey="grabTextFromTitle"/>
        <assertEquals stepKey="assertTitle" message="pass">
            <expectedResult type="string">{{_duplicatedCMSPage.title}}</expectedResult>
            <actualResult type="variable">grabTextFromTitle</actualResult>
        </assertEquals>
        <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/>
        <grabValueFrom selector="{{CmsNewPagePageContentSection.content}}"  stepKey="grabTextFromContent"/>
        <assertEquals stepKey="assertContent" message="pass">
            <expectedResult type="string">{{_duplicatedCMSPage.content}}</expectedResult>
            <actualResult type="variable">grabTextFromContent</actualResult>
        </assertEquals>
        <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/>
        <executeJS function="(el = document.querySelector('[name=\'identifier\']')) &amp;&amp; el['se' + 'tAt' + 'tribute']('data-value', el.value.split('-')[0]);" stepKey="setAttribute"/>
        <seeElement selector="{{CmsNewPagePageBasicFieldsSection.duplicatedURLKey(_duplicatedCMSPage.title)}}" stepKey="see"/>
    </actionGroup>
</actionGroups>
