@@ -504,22 +504,33 @@ test.describe('View Transitions', () => {
504504 await expect ( img ) . toBeVisible ( 'The image tag should have the transition scope attribute.' ) ;
505505 } ) ;
506506
507- test ( '<video> can persist using transition:persist' , async ( { page, astro } ) => {
507+ test ( '<video> can persist using transition:persist' , async ( { page, astro, browserName } ) => {
508+ // NOTE: works locally but fails on CI
509+ test . skip ( browserName === 'firefox' , 'Firefox has issues playing the video. Errors on play()' ) ;
510+
508511 const getTime = ( ) => document . querySelector ( 'video' ) . currentTime ;
509512
510513 // Go to page 1
511514 await page . goto ( astro . resolveUrl ( '/video-one' ) ) ;
512515 const vid = page . locator ( 'video' ) ;
513516 await expect ( vid ) . toBeVisible ( ) ;
517+ // Mute the video before playing, otherwise there's actually sounds when testing
518+ await vid . evaluate ( ( el ) => ( el . muted = true ) ) ;
519+ // Browser blocks autoplay, so we manually play it here. For some reason,
520+ // you need to click and play it manually for it to actually work.
521+ await vid . click ( ) ;
522+ await vid . evaluate ( ( el ) => el . play ( ) ) ;
514523 const firstTime = await page . evaluate ( getTime ) ;
515524
516525 // Navigate to page 2
517526 await page . click ( '#click-two' ) ;
518- const p = page . locator ( '#video-two' ) ;
519- await expect ( p ) . toBeVisible ( ) ;
527+ const vid2 = page . locator ( '#video-two' ) ;
528+ await expect ( vid2 ) . toBeVisible ( ) ;
529+ // Use a very short timeout so we can ensure there's always a video playtime gap
530+ await page . waitForTimeout ( 50 ) ;
520531 const secondTime = await page . evaluate ( getTime ) ;
521532
522- expect ( secondTime ) . toBeGreaterThanOrEqual ( firstTime ) ;
533+ expect ( secondTime ) . toBeGreaterThan ( firstTime ) ;
523534 } ) ;
524535
525536 test ( 'React Islands can persist using transition:persist' , async ( { page, astro } ) => {
0 commit comments