Skip to content

Commit 144bfd5

Browse files
Merge pull request #407 from magento-obsessive-owls/PB-425-2
[Owls] PB-425: Update Video Alignment MFTF Video Tests
2 parents 5282c1c + 66915b6 commit 144bfd5

9 files changed

+279
-304
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,15 @@
464464
</arguments>
465465
<waitForPageLoad stepKey="waitForPageLoad"/>
466466
<waitForElement selector="{{section.videoBackgroundJarallaxContainer(index)}}" stepKey="waitForJarallaxContainer"/>
467-
<seeElement selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="seeVideoInDOM"/>
467+
<waitForElement selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="waitForVideo"/>
468468
</actionGroup>
469469
<actionGroup name="validateVideoBackgroundNotLoaded" extends="validateVideoBackgroundLoaded">
470470
<annotations>
471471
<description>Validates that the video in the video background is not loaded.</description>
472472
</annotations>
473-
<dontSeeElementInDOM selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="seeVideoInDOM"/>
473+
<dontSeeElementInDOM selector="{{section.videoBackgroundVideoElement(index)}}" stepKey="waitForVideo"/>
474474
</actionGroup>
475-
<actionGroup name="validateVideoAspectRatio">
475+
<actionGroup name="validateVideoBackgroundVideoAspectRatio">
476476
<annotations>
477477
<description>Validates that the video in the video background has the correct aspect ratio.</description>
478478
</annotations>

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

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -50,75 +50,89 @@
5050
<actualResult type="variable">ratioDifference</actualResult>
5151
</assertLessThanOrEqual>
5252
</actionGroup>
53-
<actionGroup name="validateVideoWithOnlyVideoUrl">
53+
<actionGroup name="validateVideoUrl">
54+
<annotations>
55+
<description>Validates that the video's url in the video content type.</description>
56+
</annotations>
5457
<arguments>
55-
<argument name="page" defaultValue=""/>
58+
<argument name="page" defaultValue="VideoOnStage"/>
5659
<argument name="index" defaultValue="1" type="string"/>
57-
<argument name="url" defaultValue=""/>
58-
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
60+
<argument name="url" defaultValue="PageBuilderVideoUrl_YouTube"/>
5961
<argument name="acceptableOffset" defaultValue="2" type="string"/>
6062
</arguments>
61-
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForElement"/>
62-
<waitForElementVisible selector="{{page.source(index, url.renderedValue)}}" stepKey="waitForUrl"/>
63-
<waitForElementVisible selector="{{page.noWidth(index)}}" stepKey="waitForWidth"/>
64-
<comment userInput="Validate Aspect Ratio" stepKey="commentValidateAspectRatio"/>
63+
<waitForElementVisible selector="{{page.videoElement(index)}}" stepKey="waitForVideoElement"/>
64+
<waitForElementVisible selector="{{page.videoUrl(index, url.renderedValue)}}" stepKey="waitForVideoUrl"/>
65+
</actionGroup>
66+
<actionGroup name="validateVideoAspectRatio">
67+
<annotations>
68+
<description>Validates that the video in the video content type has the correct aspect ratio.</description>
69+
</annotations>
70+
<arguments>
71+
<argument name="page" defaultValue="VideoOnStage"/>
72+
<argument name="index" defaultValue="1" type="string"/>
73+
<argument name="acceptableOffset" defaultValue="2" type="string"/>
74+
</arguments>
75+
<waitForElementVisible selector="{{page.iframe(index)}}" stepKey="waitForVideoIFrame"/>
6576
<executeJS function="return window.calculatedHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.iframe(index)}}&quot;,document.body).iterateNext()).width) / 16 * 9" stepKey="calculatedHeight"/>
6677
<executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.iframe(index)}}&quot;,document.body).iterateNext()).height)" stepKey="actualHeight"/>
6778
<executeJS function="return Math.abs(window.calculatedHeight - window.actualHeight)" stepKey="ratioDifference"/>
6879
<assertLessThanOrEqual stepKey="assertRatio">
6980
<expectedResult type="int">{{acceptableOffset}}</expectedResult>
7081
<actualResult type="variable">ratioDifference</actualResult>
7182
</assertLessThanOrEqual>
72-
<grabAttributeFrom selector="{{page.iframe(index)}}" userInput="src" stepKey="videoSrc"/>
73-
<assertNotContains stepKey="assertNoAutoplay">
74-
<expectedResult type="string">autoplay</expectedResult>
75-
<actualResult type="variable">$videoSrc</actualResult>
76-
</assertNotContains>
7783
</actionGroup>
78-
<actionGroup name="validateVideoWithOnlyVideoUrlMp4">
84+
<actionGroup name="validateVideoAutoPlay">
85+
<annotations>
86+
<description>Validates that the video content type has the autoplay attributes.</description>
87+
</annotations>
7988
<arguments>
80-
<argument name="page" defaultValue=""/>
89+
<argument name="page" defaultValue="VideoOnStage"/>
8190
<argument name="index" defaultValue="1" type="string"/>
82-
<argument name="url" defaultValue=""/>
83-
<!-- This is 2 because the width and the height may both have fractions that could round by a maximum of 1 for each which makes the maximum 2-->
84-
<argument name="acceptableOffset" defaultValue="2" type="string"/>
8591
</arguments>
86-
<waitForElementVisible selector="{{page.base(index)}}" stepKey="waitForElement"/>
87-
<waitForElementVisible selector="{{page.sourceVideo(index, url.renderedValue)}}" stepKey="waitForUrl"/>
88-
<waitForElementVisible selector="{{page.noWidth(index)}}" stepKey="waitForWidth"/>
89-
<comment userInput="Validate Aspect Ratio" stepKey="commentValidateAspectRatio"/>
90-
<executeJS function="return window.calculatedHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.video(index)}}&quot;,document.body).iterateNext()).width) / 16 * 9" stepKey="calculatedHeight"/>
91-
<executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate(&quot;{{page.video(index)}}&quot;,document.body).iterateNext()).height)" stepKey="actualHeight"/>
92-
<executeJS function="return Math.abs(window.calculatedHeight - window.actualHeight)" stepKey="ratioDifference"/>
93-
<assertLessThanOrEqual stepKey="assertRatio">
94-
<expectedResult type="int">{{acceptableOffset}}</expectedResult>
95-
<actualResult type="variable">ratioDifference</actualResult>
96-
</assertLessThanOrEqual>
97-
<waitForElementNotVisible selector="{{page.videoAutoplay(index)}}" stepKey="assertNoAutoplay"/>
92+
<waitForPageLoad stepKey="waitForPageLoad"/>
93+
<waitForElementVisible selector="{{page.videoElement(index)}}" stepKey="waitForVideoElement"/>
94+
<waitForElementVisible selector="{{page.videoAutoplay(index)}}" stepKey="waitForVideoAutoplay"/>
95+
<grabAttributeFrom selector="{{page.videoElement(index)}}" userInput="src" stepKey="videoSrc"/>
96+
<assertContains stepKey="assertAutoplay">
97+
<expectedResult type="string">autoplay=1</expectedResult>
98+
<actualResult type="variable">$videoSrc</actualResult>
99+
</assertContains>
100+
</actionGroup>
101+
<actionGroup name="validateVideoNoAutoPlay" extends="validateVideoAutoPlay">
102+
<annotations>
103+
<description>Validates that the video content type does not have the autoplay attributes.</description>
104+
</annotations>
105+
<waitForElementVisible selector="{{page.videoNoAutoplay(index)}}" stepKey="waitForVideoAutoplay"/>
106+
<assertNotContains stepKey="assertAutoplay">
107+
<expectedResult type="string">autoplay</expectedResult>
108+
<actualResult type="variable">$videoSrc</actualResult>
109+
</assertNotContains>
98110
</actionGroup>
99111
<actionGroup name="validateVideoPlaying">
100112
<annotations>
101-
<description>Validates that the video content type is playing.</description>
113+
<description>Validates that the video content type is playing. Only works with videos that play in an iframe.</description>
102114
</annotations>
103115
<arguments>
104116
<argument name="page" defaultValue="VideoOnStage"/>
105-
<argument name="url" defaultValue="PageBuilderVideoUrl_Empty"/>
106117
<argument name="index" defaultValue="1" type="string"/>
107118
</arguments>
108119
<waitForPageLoad stepKey="waitForPageLoad"/>
109-
<waitForElementVisible selector="{{page.videoElement(index)}}" stepKey="waitForVideoVisible"/>
110-
<executeJS function="document.querySelector('[data-element=\'video\']').id = 'video-iframe'" stepKey="setIframeId"/>
111-
<switchToIFrame userInput="video-iframe" stepKey="switchToVideoIframe"/>
112-
<waitForElementVisible selector="{{page.iframePlaying(index)}}" stepKey="seeIframePlaying"/>
120+
<waitForElementVisible selector="{{page.videoElement(index)}}" stepKey="waitForVideoElement"/>
121+
<executeJS function="document.querySelectorAll('{{page.videoElementCss}}')[{{index}}-1].id = 'video-iframe'" stepKey="setIframeId"/>
122+
<switchToIFrame selector="video-iframe" stepKey="switchToVideoIframe"/>
123+
<waitForElementVisible selector="{{page.iframePlaying}}" stepKey="seeIframePlaying"/>
113124
<switchToIFrame stepKey="switchBackFromIframe"/>
114125
</actionGroup>
115126
<actionGroup name="validateVideoNotAutoplaying" extends="validateVideoPlaying">
116127
<annotations>
117-
<description>Validates that the video content type is not autoplaying.</description>
128+
<description>Validates that the video content type is not autoplaying. Only works with videos that play in an iframe.</description>
118129
</annotations>
119-
<waitForElementVisible selector="{{page.iframeNotAutoplaying(index)}}" stepKey="seeIframePlaying"/>
130+
<waitForElementVisible selector="{{page.iframeNotAutoplaying}}" stepKey="seeIframePlaying"/>
120131
</actionGroup>
121132
<actionGroup name="validateEmptyVideoStage">
133+
<annotations>
134+
<description>Validates that the video content type on the stage in admin is empty.</description>
135+
</annotations>
122136
<arguments>
123137
<argument name="index" defaultValue="1" type="string"/>
124138
</arguments>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,15 @@
520520
<data key="fieldName">video_source</data>
521521
<data key="value">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
522522
<data key="renderedValue">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
523+
<data key="width">320px</data>
524+
<data key="height">320px</data>
523525
</entity>
524526
<entity name="PageBuilderVideoBackgroundUrl_Mp4_URL_Insecure" type="pagebuilder_video_background_url">
525527
<data key="name">Video URL</data>
526528
<data key="section">background</data>
527529
<data key="fieldName">video_source</data>
528530
<data key="value">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
529531
<data key="renderedValue">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
530-
<data key="width">320px</data>
531-
<data key="height">320px</data>
532532
</entity>
533533
<entity name="PageBuilderVideoBackgroundUrl_Invalid_Text" type="pagebuilder_video_background_url">
534534
<data key="name">Video URL</data>

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<!-- URL -->
12-
<entity name="PageBuilderVideoUrl_Default" type="pagebuilder_video_url_property">
12+
<entity name="PageBuilderVideoUrl_Default" type="pagebuilder_video_url_property" deprecated="Use PageBuilderVideoUrl_Empty instead">
1313
<data key="name">Video URL</data>
1414
<data key="section">general</data>
1515
<data key="fieldName">video_source</data>
1616
<data key="text">Video</data>
1717
</entity>
18-
<entity name="PageBuilderVideoUrl_YouTube" type="pagebuilder_video_url_property">
18+
<entity name="PageBuilderVideoUrl_Empty" type="pagebuilder_video_url_property">
1919
<data key="name">Video URL</data>
2020
<data key="section">general</data>
2121
<data key="fieldName">video_source</data>
22-
<data key="value">https://www.youtube.com/embed/slOtnjsbff0</data>
23-
<data key="renderedValue">https://www.youtube.com/embed/slOtnjsbff0</data>
22+
<data key="value"/>
23+
<data key="text">Video</data>
24+
<data key="tooltipText">Video URLs can be links to videos on YouTube or Vimeo, or HTTP(S) links to files with valid video extensions (we recommend .mp4)</data>
2425
</entity>
2526
<entity name="PageBuilder_InvalidVideoURL_Text" type="pagebuilder_video_url_property">
2627
<data key="name">Video URL</data>
@@ -36,19 +37,19 @@
3637
<data key="value">&lt;iframe width=&quot;1280&quot; height=&quot;720&quot; src=&quot;https://www.youtube.com/embed/bLXEUP6vKEk"&gt;&lt;/iframe&gt;</data>
3738
<data key="errorMessage">Please enter a valid video URL. Valid URLs have a video file extension (.mp4, .webm, .ogv) or links to videos on YouTube or Vimeo.</data>
3839
</entity>
39-
<entity name="PageBuilderVideoUrl_NonEmbedded" type="pagebuilder_video_url_property">
40+
<entity name="PageBuilderVideoUrl_YouTube" type="pagebuilder_video_url_property">
4041
<data key="name">Video URL</data>
4142
<data key="section">general</data>
4243
<data key="fieldName">video_source</data>
43-
<data key="value">https://www.youtube.com/watch?v=slOtnjsbff0</data>
44+
<data key="value">https://www.youtube.com/embed/slOtnjsbff0</data>
4445
<data key="renderedValue">https://www.youtube.com/embed/slOtnjsbff0</data>
4546
</entity>
46-
<entity name="PageBuilderVideoUrl_Empty" type="pagebuilder_video_url_property">
47+
<entity name="PageBuilderVideoUrl_NonEmbedded" type="pagebuilder_video_url_property">
4748
<data key="name">Video URL</data>
4849
<data key="section">general</data>
4950
<data key="fieldName">video_source</data>
50-
<data key="value"/>
51-
<data key="tooltipText">Video URLs can be links to videos on YouTube or Vimeo, or HTTP(S) links to files with valid video extensions (we recommend .mp4)</data>
51+
<data key="value">https://www.youtube.com/watch?v=slOtnjsbff0</data>
52+
<data key="renderedValue">https://www.youtube.com/embed/slOtnjsbff0</data>
5253
</entity>
5354
<entity name="PageBuilderVideoUrl_YouTube_Insecure" type="pagebuilder_video_url_property">
5455
<data key="name">Video URL</data>
@@ -84,17 +85,23 @@
8485
<data key="fieldName">video_source</data>
8586
<data key="value">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
8687
<data key="renderedValue">https://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
88+
<data key="width">320px</data>
89+
<data key="height">320px</data>
8790
</entity>
8891
<entity name="PageBuilderVideoUrl_Mp4_URL_Insecure" type="pagebuilder_video_url_property">
8992
<data key="name">Video URL</data>
9093
<data key="section">general</data>
9194
<data key="fieldName">video_source</data>
9295
<data key="value">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
9396
<data key="renderedValue">http://obsessive-owls.s3.us-east-2.amazonaws.com/MFTF/avocado.mp4</data>
94-
<data key="width">320px</data>
95-
<data key="height">320px</data>
9697
</entity>
9798
<!-- Width -->
99+
<entity name="PageBuilderVideoWidth_Empty" type="pagebuilder_video_width_property">
100+
<data key="name">Maximum Width</data>
101+
<data key="section">general</data>
102+
<data key="fieldName">max_width</data>
103+
<data key="value"/>
104+
</entity>
98105
<entity name="PageBuilderVideoWidth_500" type="pagebuilder_video_width_property">
99106
<data key="name">Maximum Width</data>
100107
<data key="section">general</data>

0 commit comments

Comments
 (0)