Skip to content

Commit d0208c0

Browse files
committed
PB-95: Video background for Row
- Adding more MFTF coverage for video background
1 parent b1ba60d commit d0208c0

File tree

3 files changed

+414
-28
lines changed

3 files changed

+414
-28
lines changed

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/BackgroundConfigurationActionGroup.xml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
</arguments>
213213
<waitForPageLoad stepKey="waitForPageLoad"/>
214214
<waitForElementVisible selector="{{section.backgroundType(index, 'video')}}" stepKey="waitForVideoBackground"/>
215+
<waitForElement selector="{{section.backgroundColorElement(index)}}" stepKey="waitForVideoBackgroundColor"/>
215216
<executeJS function="return window.getComputedStyle(document.evaluate(&quot;{{section.backgroundColorElement(index)}}&quot;, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue).backgroundColor" stepKey="backgroundColor"/>
216217
<assertEquals stepKey="assertBackgroundColor">
217218
<expectedResult type="string">{{backgroundColor}}</expectedResult>
@@ -303,6 +304,30 @@
303304
<actualResult type="variable">$fallbackImageStyle</actualResult>
304305
</assertContains>
305306
</actionGroup>
307+
<actionGroup name="validateFallbackImageAfterVideoFinishesPlayingInVideoBackground">
308+
<annotations>
309+
<description>Validates that the video background fallback image renders when the video in video background finishes playing.</description>
310+
</annotations>
311+
<arguments>
312+
<argument name="section" defaultValue="RowOnStage"/>
313+
<argument name="fallbackImage" defaultValue="PageBuilderVideoBackgroundFallbackImage_Empty"/>
314+
<argument name="index" defaultValue="1" type="string"/>
315+
</arguments>
316+
<waitForPageLoad stepKey="waitForPageLoad"/>
317+
<waitForElementVisible selector="{{section.backgroundType(index, 'video')}}" stepKey="waitForVideoBackground"/>
318+
<waitForElementVisible selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="waitForVideo"/>
319+
<waitForElementVisible selector="{{section.videoBackgroundFallbackImage(index)}}" stepKey="waitForFallbackImageVisible"/>
320+
<grabAttributeFrom selector="{{section.videoBackgroundFallbackImageSource(index, fallbackImage.fileName)}}" userInput="src" stepKey="fallbackImageSource"/>
321+
<assertRegExp stepKey="assertFallbackImageValueContainsFileInformation">
322+
<expectedResult type="string">/.*\/(pub\/|\/)?media\/{{fallbackImage.path}}\/{{fallbackImage.fileName}}(_\d+)?\.{{fallbackImage.extension}}/</expectedResult>
323+
<actualResult type="variable">$fallbackImageSource</actualResult>
324+
</assertRegExp>
325+
<grabAttributeFrom selector="{{section.videoBackgroundFallbackImageSource(index, fallbackImage.fileName)}}" userInput="style" stepKey="fallbackImageStyle"/>
326+
<assertContains stepKey="assertCover">
327+
<expectedResult type="string">display: block;</expectedResult>
328+
<actualResult type="variable">$fallbackImageStyle</actualResult>
329+
</assertContains>
330+
</actionGroup>
306331
<actionGroup name="validateEmptyRowWithInvalidVideoBackgroundAndNoFallbackImage">
307332
<annotations>
308333
<description>Validates that the Row renders as an empty row when the video in video background fails to load and there is no fallback image.</description>
@@ -381,15 +406,43 @@
381406
<expectedResult type="string">transform: translate3d(</expectedResult>
382407
<actualResult type="variable">$videoStyle</actualResult>
383408
</assertContains>
409+
<waitForElement selector="{{section.videoBackgroundFallbackImage(index)}}|{{section.videoBackgroundNoFallbackImage(index)}}" stepKey="waitForFallbackImage"/>
410+
<grabAttributeFrom selector="{{section.videoBackgroundFallbackImage(index)}}|{{section.videoBackgroundNoFallbackImage(index)}}" userInput="style" stepKey="fallbackImageStyle"/>
411+
<assertContains stepKey="assertFallbackImageNotDisplayed">
412+
<expectedResult type="string">display: none;</expectedResult>
413+
<actualResult type="variable">$fallbackImageStyle</actualResult>
414+
</assertContains>
415+
</actionGroup>
416+
<actionGroup name="validateVideoBackgroundLoadedButNotPlaying" extends="validateVideoBackgroundPlaying">
417+
<annotations>
418+
<description>Validates that the video in the video background is loaded but not playing.</description>
419+
</annotations>
420+
<assertNotContains stepKey="assertVideoPlaying">
421+
<expectedResult type="string">transform: translate3d(</expectedResult>
422+
<actualResult type="variable">$videoStyle</actualResult>
423+
</assertNotContains>
424+
</actionGroup>
425+
<actionGroup name="validateVideoBackgroundFinishedPlaying" extends="validateVideoBackgroundPlaying">
426+
<annotations>
427+
<description>Validates that the video in the video background is finished playing.</description>
428+
</annotations>
429+
<assertContains stepKey="assertFallbackImageNotDisplayed">
430+
<expectedResult type="string">display: block;</expectedResult>
431+
<actualResult type="variable">$fallbackImageStyle</actualResult>
432+
</assertContains>
384433
</actionGroup>
385-
<actionGroup name="validateVideoBackgroundNotPlaying" extends="validateVideoBackgroundPlaying">
434+
<actionGroup name="validateVideoBackgroundFinishedPlayingBeforeViewing" extends="validateVideoBackgroundPlaying">
386435
<annotations>
387-
<description>Validates that the video in the video background is not playing.</description>
436+
<description>Validates that the video in the video background is finished playing before it's in the viewport.</description>
388437
</annotations>
389438
<assertNotContains stepKey="assertVideoPlaying">
390439
<expectedResult type="string">transform: translate3d(</expectedResult>
391440
<actualResult type="variable">$videoStyle</actualResult>
392441
</assertNotContains>
442+
<assertContains stepKey="assertFallbackImageNotDisplayed">
443+
<expectedResult type="string">display: block;</expectedResult>
444+
<actualResult type="variable">$fallbackImageStyle</actualResult>
445+
</assertContains>
393446
</actionGroup>
394447
<actionGroup name="validateVideoBackgroundLoaded">
395448
<annotations>

app/code/Magento/PageBuilder/Test/Mftf/Data/BackgroundFormData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@
458458
<data key="value">https://www.youtube.com/watch?v=slOtnjsbff0</data>
459459
<data key="renderedValue">https://www.youtube.com/embed/slOtnjsbff0</data>
460460
</entity>
461+
<entity name="PageBuilderVideoBackgroundUrl_YouTube_Insecure" type="pagebuilder_video_background_url">
462+
<data key="name">Video URL</data>
463+
<data key="section">background</data>
464+
<data key="fieldName">video_source</data>
465+
<data key="value">http://www.youtube.com/watch?v=slOtnjsbff0</data>
466+
<data key="renderedValue">https://www.youtube.com/embed/slOtnjsbff0</data>
467+
</entity>
461468
<entity name="PageBuilderVideoBackgroundUrl_Vimeo_Embedded" type="pagebuilder_video_background_url">
462469
<data key="name">Video URL</data>
463470
<data key="section">background</data>
@@ -472,13 +479,27 @@
472479
<data key="value">https://vimeo.com/2393127</data>
473480
<data key="renderedValue">https://player.vimeo.com/video/2393127</data>
474481
</entity>
482+
<entity name="PageBuilderVideoBackgroundUrl_Vimeo_Insecure" type="pagebuilder_video_background_url">
483+
<data key="name">Video URL</data>
484+
<data key="section">background</data>
485+
<data key="fieldName">video_source</data>
486+
<data key="value">http://vimeo.com/2393127</data>
487+
<data key="renderedValue">https://player.vimeo.com/video/2393127</data>
488+
</entity>
475489
<entity name="PageBuilderVideoBackgroundUrl_Mp4_URL" type="pagebuilder_video_background_url">
476490
<data key="name">Video URL</data>
477491
<data key="section">background</data>
478492
<data key="fieldName">video_source</data>
479493
<data key="value">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
480494
<data key="renderedValue">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
481495
</entity>
496+
<entity name="PageBuilderVideoBackgroundUrl_Mp4_URL_Insecure" type="pagebuilder_video_background_url">
497+
<data key="name">Video URL</data>
498+
<data key="section">background</data>
499+
<data key="fieldName">video_source</data>
500+
<data key="value">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
501+
<data key="renderedValue">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
502+
</entity>
482503
<entity name="PageBuilderVideoBackgroundUrl_Invalid_Text" type="pagebuilder_video_background_url">
483504
<data key="name">Video URL</data>
484505
<data key="section">background</data>

0 commit comments

Comments
 (0)