Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda