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

244
Visualizações
Cypress does not recognize list element

I am trying to run Cypress tests for a Angular based Frontend. In this application there is a list-component that includes several message-list-items. The problem I'm currently facing is that Cypress does not recognize all message-list-items displayed.I want to compare the expected number of messages with the actual number of displayed messages. At the moment I do not understand Cypress's behavior. Sometimes Cypress recognizes all message-list-items and sometimes a single message is skipped (totally random which one). In the HTML the message-list-item exists and I can see the message-list-item beeing rendered too. Cypress just does not highlight or recognize it at all.

Here is a screenshot of the message-list-item in the HTML HTML message-list-items available

A screenshot from Cypress logs Cypress log output

The code to acess the message-list-items:

 cy.wait(2000).then(() =>
      cy.get('message-list')
        .each(($el, index) => {
          cy.wrap($el).then(() => (resultCounter += 1));
        })
        .then(() =>
          expect(resultCounter).equals(
            expectedMessageCounter
          )
        )
    );

Anyone faced the same problem? Thanks in advance!

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

The easiest way to do this without any flaky results is

cy.get('message-list-item')
  .should('have.length', expectedMessageCounter)

Because you have a .should(), Cypress will retry up to 4 seconds for the correct length.

You do not need to .each().

about 4 years ago · Santiago Gelvez 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