Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
How to intercept video file in Cypress?

I'm trying to mock static video with cy.intercept

cy.intercept('/video.webm', { fixture: 'videos/video.webm' });

And that doesn't seems to work, it still return actual video instead of fixture one. I Also tried specify encoding binary and null like that

cy.intercept('/video.webm', { fixture: 'videos/video.webm,null' });
cy.intercept('/video.webm', { fixture: 'videos/video.webm,binary' });

But null gives me an error - The value "null" is invalid for option "encoding"

And with binary it seems that it returns an empty black video

So what am I doing wrong?

almost 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I can't fault it, this example works - plays the bunny vid which I have in cypress/fixtures.

Best guess is you have the wrong fixture path.

cy.visit('https://www.webmfiles.org/demo-files/');

cy.intercept('/elephants-dream.webm', { fixture: 'big-buck-bunny_trailer.webm,null' })
cy.get('a[href="https://dl8.webmfiles.org/elephants-dream.webm"]')
  .click()
almost 4 years ago · Santiago Trujillo Denunciar

0

So I figured it out, do not know why but this works for me.

cy.intercept('/video.webm', (req) => {
    req.continue((res) => {
        res.send({ fixture:'videos/video.webm' });
    });
});

PS: Also this answer from @TesterDick actually works https://stackoverflow.com/a/73887996/12937539. But when I use video as source in the video tag and not in the link this not working. Maybe video tag with source the case

almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda