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

177
Vistas
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 Respuestas
Responde la pregunta

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 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