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

162
Visualizações
How to reload the first test case if it fails in cypress

Every feature test case starts with landing page testing in cypress.

We are witnessing failures here because of network connectivity issues.

it('should load home page', () => {
    cy.waitUntil(() =>
      cy.contains('Home', { timeout: 500000 }).should('exist')
    );
  });

So, is there a way to reload this test case if it fails once or twice and avoid recursion?

I suspect retries will work here, if so how can we configure it?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use Test Retries. You can add it to Test Suite Level, Test Case level or globally as well. The test will be re-triggered in case of failures.

runMode works for headless. openMode for test runner. You can add both of them followed by how many times you want to retry them. So 2 means, once after the test failed, the test will be re-executed 2 times until the test passes, So if the test passes in the first re-execution, the second re-execution will not happen.

it(
  'should load home page',
  {
    retries: {
      runMode: 2,
      openMode: 1,
    },
  },
  () => {
    cy.waitUntil(() => cy.contains('Home', {timeout: 500000}).should('exist'))
  }
)
about 4 years ago · Juan Pablo Isaza 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