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

178
Visualizações
cypress get method can not get data-cy at my component

cy custom method

Cypress.Commands.add('shouldRenderShowcase', ({ name,  highlight = false }) => {
  cy.getByDataCy(name).within(() => {
    cy.findByRole('heading', { name }).should('exist')
    cy.getByDataCy('game-card').should('have.length.gt', 0)
    cy.getByDataCy('highlight').should(highlight ? 'exist' : 'not.exist')

    if (highlight) {
      cy.getByDataCy('highlight').within(() => {
        cy.findByRole('link').should('have.attr', 'href')
      })
    }

  })
})

Guys, i have this custom method to check my component that calls Showcase. As you can see, i have another custom method inside, which calls getByDataCy, its the same as cy.get, but i dont need to pass content inside the [].

I this test, i have been looking for a component, inside the showcase which calls game-card, but the cypress does not find it.

As you can see in the image below, there is cy="game-card" inside the article tag. I dont know why the cypress did found it. Can you help me?

cy does not find data-cy, but there is a data-cy in html tree

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

0

I found the error. I have three test that call this method, and one of those there were no games in it, but the message was seems like for everyone. The error was because my backend could not find new released games. Thank you for your time!

about 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