<?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="validatePageBuilderTemplatePreviewImageModal">
        <annotations>
            <description>Validate all buttons and the image on the template image preview modal.</description>
        </annotations>
        <arguments>
            <argument name="templateName" defaultValue="{{PageBuilderTemplateNameRandom.name}}" type="string"/>
        </arguments>
        <waitForPageLoad stepKey="waitForModalLoad"/>
        <waitForElementVisible selector="{{PageBuilderPreviewImageModal.image}}" stepKey="waitForImageLoad"/>
        <see userInput="{{templateName}}" selector="{{PageBuilderPreviewImageModal.title}}" stepKey="seeTitle"/>
        <seeElement selector="{{PageBuilderPreviewImageModal.closeButton}}" stepKey="seeCloseButton"/>
        <executeJS function="return document.evaluate(&quot;{{PageBuilderPreviewImageModal.image}}&quot;, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.naturalHeight" stepKey="screenshotNaturalHeight"/>
        <executeJS function="return document.evaluate(&quot;{{PageBuilderPreviewImageModal.image}}&quot;, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.naturalWidth" stepKey="screenshotNaturalWidth"/>
        <assertGreaterThan stepKey="assertNaturalHeightGreaterThanZero">
            <expectedResult type="int">0</expectedResult>
            <actualResult type="variable">screenshotNaturalHeight</actualResult>
        </assertGreaterThan>
        <assertGreaterThan stepKey="assertNaturalWidthGreaterThanZero">
            <expectedResult type="int">0</expectedResult>
            <actualResult type="variable">screenshotNaturalWidth</actualResult>
        </assertGreaterThan>
    </actionGroup>
</actionGroups>
