|
50 | 50 | <actualResult type="variable">ratioDifference</actualResult>
|
51 | 51 | </assertLessThanOrEqual>
|
52 | 52 | </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> |
54 | 57 | <arguments>
|
55 |
| - <argument name="page" defaultValue=""/> |
| 58 | + <argument name="page" defaultValue="VideoOnStage"/> |
56 | 59 | <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"/> |
59 | 61 | <argument name="acceptableOffset" defaultValue="2" type="string"/>
|
60 | 62 | </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"/> |
65 | 76 | <executeJS function="return window.calculatedHeight = parseInt(getComputedStyle(document.evaluate("{{page.iframe(index)}}",document.body).iterateNext()).width) / 16 * 9" stepKey="calculatedHeight"/>
|
66 | 77 | <executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate("{{page.iframe(index)}}",document.body).iterateNext()).height)" stepKey="actualHeight"/>
|
67 | 78 | <executeJS function="return Math.abs(window.calculatedHeight - window.actualHeight)" stepKey="ratioDifference"/>
|
68 | 79 | <assertLessThanOrEqual stepKey="assertRatio">
|
69 | 80 | <expectedResult type="int">{{acceptableOffset}}</expectedResult>
|
70 | 81 | <actualResult type="variable">ratioDifference</actualResult>
|
71 | 82 | </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> |
77 | 83 | </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> |
79 | 88 | <arguments>
|
80 |
| - <argument name="page" defaultValue=""/> |
| 89 | + <argument name="page" defaultValue="VideoOnStage"/> |
81 | 90 | <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"/> |
85 | 91 | </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("{{page.video(index)}}",document.body).iterateNext()).width) / 16 * 9" stepKey="calculatedHeight"/> |
91 |
| - <executeJS function="return window.actualHeight = parseInt(getComputedStyle(document.evaluate("{{page.video(index)}}",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> |
98 | 110 | </actionGroup>
|
99 | 111 | <actionGroup name="validateVideoPlaying">
|
100 | 112 | <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> |
102 | 114 | </annotations>
|
103 | 115 | <arguments>
|
104 | 116 | <argument name="page" defaultValue="VideoOnStage"/>
|
105 |
| - <argument name="url" defaultValue="PageBuilderVideoUrl_Empty"/> |
106 | 117 | <argument name="index" defaultValue="1" type="string"/>
|
107 | 118 | </arguments>
|
108 | 119 | <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"/> |
113 | 124 | <switchToIFrame stepKey="switchBackFromIframe"/>
|
114 | 125 | </actionGroup>
|
115 | 126 | <actionGroup name="validateVideoNotAutoplaying" extends="validateVideoPlaying">
|
116 | 127 | <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> |
118 | 129 | </annotations>
|
119 |
| - <waitForElementVisible selector="{{page.iframeNotAutoplaying(index)}}" stepKey="seeIframePlaying"/> |
| 130 | + <waitForElementVisible selector="{{page.iframeNotAutoplaying}}" stepKey="seeIframePlaying"/> |
120 | 131 | </actionGroup>
|
121 | 132 | <actionGroup name="validateEmptyVideoStage">
|
| 133 | + <annotations> |
| 134 | + <description>Validates that the video content type on the stage in admin is empty.</description> |
| 135 | + </annotations> |
122 | 136 | <arguments>
|
123 | 137 | <argument name="index" defaultValue="1" type="string"/>
|
124 | 138 | </arguments>
|
|
0 commit comments