<?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="validateVideoBackgroundPlaying">
        <annotations>
            <description>Validates that the video in the video background is playing.</description>
        </annotations>
        <arguments>
            <argument name="section" defaultValue="RowOnStage"/>
            <argument name="videoUrl" defaultValue="PageBuilderVideoBackgroundUrl_Empty"/>
            <argument name="index" defaultValue="1" type="string"/>
        </arguments>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <wait time="5" stepKey="waitToPreventVideoFlakiness"/>
        <waitForElementVisible selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="waitForVideoVisible"/>
        <waitForElement selector="{{section.videoBackgroundVideoUrl(index, videoUrl.renderedValue)}}" stepKey="waitForVideoUrl"/>
        <grabAttributeFrom selector="{{section.videoBackgroundVideoElement(index)}}" userInput="style" stepKey="videoStyle"/>
        <assertStringContainsString stepKey="assertVideoPlaying">
            <expectedResult type="string">transform: translate3d(</expectedResult>
            <actualResult type="variable">$videoStyle</actualResult>
        </assertStringContainsString>
        <waitForElement selector="{{section.videoBackgroundFallbackImage(index)}}|{{section.videoBackgroundNoFallbackImage(index)}}" stepKey="waitForFallbackImage"/>
        <grabAttributeFrom selector="{{section.videoBackgroundFallbackImage(index)}}|{{section.videoBackgroundNoFallbackImage(index)}}" userInput="style" stepKey="fallbackImageStyle"/>
        <assertStringContainsString stepKey="assertFallbackImageNotDisplayed">
            <expectedResult type="string">display: none;</expectedResult>
            <actualResult type="variable">$fallbackImageStyle</actualResult>
        </assertStringContainsString>
    </actionGroup>
</actionGroups>
