@@ -60,13 +60,13 @@ describe('Video', () => {
6060 cy . get ( playButton ) . should ( 'exist' )
6161 cy . get ( videoElement ) . its ( '0.paused' ) . should ( 'equal' , true )
6262 if ( viewport === 'macbook-13' ) {
63- cy . get ( controls ) . realHover ( )
63+ cy . hoverAndDisplay ( controls )
6464 }
6565 cy . get ( playButton ) . click ( )
6666 cy . get ( pauseButton ) . should ( 'exist' )
6767 cy . get ( videoElement ) . its ( '0.paused' ) . should ( 'equal' , false )
6868 if ( viewport === 'macbook-13' ) {
69- cy . get ( controls ) . realHover ( )
69+ cy . hoverAndDisplay ( controls )
7070 }
7171 cy . get ( pauseButton ) . click ( )
7272 cy . get ( playButton ) . should ( 'exist' )
@@ -76,21 +76,17 @@ describe('Video', () => {
7676 cy . get ( loadingSpinner ) . should ( 'not.exist' )
7777 cy . get ( fullScreenEnterButton ) . should ( 'exist' )
7878 if ( viewport === 'macbook-13' ) {
79- cy . get ( controls ) . realHover ( )
79+ cy . hoverAndDisplay ( controls )
8080 }
8181 cy . get ( fullScreenEnterButton ) . should ( 'be.visible' )
8282
8383 cy . get ( fullScreenEnterButton ) . realClick ( )
8484 cy . wait ( 1000 )
85- if ( viewport === 'macbook-13' ) {
86- cy . get ( controls ) . realHover ( )
87- }
85+ cy . hoverAndDisplay ( controls )
8886 cy . get ( fullScreenExitButton ) . should ( 'exist' )
8987 cy . document ( ) . its ( 'fullscreenElement' ) . should ( 'exist' )
9088
91- if ( viewport === 'macbook-13' ) {
92- cy . get ( controls ) . realHover ( )
93- }
89+ cy . hoverAndDisplay ( controls )
9490 cy . get ( fullScreenExitButton ) . realClick ( )
9591 cy . wait ( 1000 )
9692 cy . document ( ) . its ( 'fullscreenElement' ) . should ( 'not.exist' )
@@ -129,11 +125,14 @@ describe('Video', () => {
129125 } )
130126
131127 if ( viewport === 'macbook-13' ) {
132- cy . get ( controls ) . realHover ( )
128+ cy . hoverAndDisplay ( controls )
133129 }
134130 cy . get ( fullScreenEnterButton ) . realClick ( )
135131 cy . get ( fullScreenExitButton ) . should ( 'not.exist' )
136132 cy . get ( fullScreenEnterButton ) . should ( 'exist' )
133+ if ( viewport === 'macbook-13' ) {
134+ cy . hoverAndDisplay ( controls )
135+ }
137136 cy . get ( controlError ) . should ( 'exist' )
138137 } )
139138 it ( `should display an error message if pressing play fails on ${ viewport } screen` , ( ) => {
@@ -151,7 +150,7 @@ describe('Video', () => {
151150 cy . get ( playButton ) . should ( 'exist' )
152151 cy . get ( pauseButton ) . should ( 'not.exist' )
153152 if ( viewport === 'macbook-13' ) {
154- cy . get ( controls ) . realHover ( )
153+ cy . hoverAndDisplay ( controls )
155154 }
156155 cy . get ( controlError ) . should ( 'exist' )
157156 } )
@@ -201,22 +200,22 @@ describe('Video', () => {
201200 it ( `should go forwards and backwards 10 seconds when clicking the forward/back buttons` , ( ) => {
202201 const tenSeconds = 10
203202
204- cy . get ( controls ) . realHover ( )
203+ cy . hoverAndDisplay ( controls )
205204 cy . get ( '[data-cy=forward-ten-seconds-button]' ) . click ( )
206205 cy . get ( videoElement ) . its ( '0.currentTime' ) . should ( 'equal' , tenSeconds )
207206 cy . get ( '[data-cy=replay-ten-seconds-button]' ) . click ( )
208207 cy . get ( videoElement ) . its ( '0.currentTime' ) . should ( 'equal' , 0 )
209208 } )
210209 it ( `should mute and unmute the audio when clicking the mute button` , ( ) => {
211- cy . get ( controls ) . realHover ( )
210+ cy . hoverAndDisplay ( controls )
212211 cy . get ( playButton ) . click ( )
213212 cy . get ( videoElement ) . its ( '0.muted' ) . should ( 'equal' , false )
214213 cy . get ( muteButton ) . click ( { force : true } )
215214 cy . get ( videoElement ) . its ( '0.muted' ) . should ( 'equal' , true )
216215 } )
217216 it ( `should change the volume when adjusting the volume slider on desktop` , ( ) => {
218217 cy . get ( videoElement ) . its ( '0.volume' ) . should ( 'equal' , 1 )
219- cy . get ( controls ) . realHover ( )
218+ cy . hoverAndDisplay ( controls )
220219 cy . get ( muteButton ) . focus ( ) . get ( volumeSlider ) . should ( 'be.visible' )
221220
222221 const sliderAnimationWait = 1000
@@ -226,34 +225,34 @@ describe('Video', () => {
226225 } )
227226 it ( `should change the time when the video progress slider is adjusted` , ( ) => {
228227 cy . get ( videoElement ) . its ( '0.currentTime' ) . should ( 'equal' , 0 )
229- cy . get ( controls ) . realHover ( )
228+ cy . hoverAndDisplay ( controls )
230229 cy . get ( progressSlider ) . type ( '{rightArrow}' )
231230 cy . get ( videoElement ) . its ( '0.currentTime' ) . should ( 'be.greaterThan' , 0 )
232231 } )
233232 it ( 'should show the correct view when going to fullscreen mode then changing the viewport size' , ( ) => {
234233 cy . get ( fullScreenEnterButton ) . should ( 'exist' )
235- cy . get ( controls ) . realHover ( )
234+ cy . hoverAndDisplay ( controls )
236235 cy . get ( fullScreenEnterButton ) . realClick ( )
237236 cy . wait ( 1000 )
238237 cy . get ( fullScreenExitButton ) . should ( 'exist' )
239238 cy . document ( ) . its ( 'fullscreenElement' ) . should ( 'exist' )
240239
241240 cy . viewport ( 'iphone-6' )
242- cy . get ( controls ) . realHover ( )
241+ cy . hoverAndDisplay ( controls )
243242 cy . get ( fullScreenExitButton ) . click ( )
244243 cy . wait ( 1000 )
245244 cy . get ( fullScreenEnterButton ) . should ( 'exist' )
246245 cy . document ( ) . its ( 'fullscreenElement' ) . should ( 'not.exist' )
247246 } )
248247 it ( 'should toggle between picture-in-picture and normal mode when clicking the picture-in-picture button' , ( ) => {
249248 cy . get ( pictureInPictureButton ) . should ( 'exist' )
250- cy . get ( controls ) . realHover ( )
249+ cy . hoverAndDisplay ( controls )
251250 cy . get ( pictureInPictureButton ) . realClick ( )
252251 cy . wait ( 1000 )
253252 cy . get ( pictureInPictureExitButton ) . should ( 'exist' )
254253 cy . document ( ) . its ( 'pictureInPictureElement' ) . should ( 'exist' )
255254
256- cy . get ( controls ) . realHover ( )
255+ cy . hoverAndDisplay ( controls )
257256 cy . get ( pictureInPictureExitButton ) . click ( )
258257 cy . wait ( 1000 )
259258 cy . get ( pictureInPictureButton ) . should ( 'exist' )
0 commit comments