Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

378
Views
cy.click() falló porque requiere un elemento DOM?
 it('TC01 - ', () => { const dataToTest = productCatalogData.case1 createGLCode(dataToTest) toastMessageIsEqualsTo('GL Code Created!') }); it('TC02 - ', () => { const dataToTest = productCatalogData.case2 editGLCode(dataToTest) //toastMessageIsEqualsTo('GL Code Updated!') }); it('TC03 - ', () => { const dataToTest = productCatalogData.case3 deleteGLCode(dataToTest) toastMessageIsEqualsTo('GL Code Deleted!')

Tengo la función de cierre de sesión en afterEach hook.

Pero en el momento del tercer caso de prueba, me muestra un error de "cy.click() falló porque requiere un elemento DOM". y "El asunto recibido fue: undefined ".

Sin embargo, cuando vuelvo a ejecutar el mismo caso de prueba, funciona perfectamente bien.

 | export const clickLogout = () => { > 5 | cy.get('[id=logoutBtn]').click({ force: true }); | ^ 6 | };

Dando error aquí.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Parece que cy.get('[id=logoutBtn]') falta en el DOM debido al cierre de sesión en afterEach() .

Supongo que en algún lugar de esos métodos personalizados está iniciando sesión. (Por cierto, debe hacerlo explícitamente en la prueba para que sea más fácil de entender sus pruebas).

Si es así, agregue una verificación de visibilidad al botón de cierre de sesión

 cy.get('[id=logoutBtn]') .should('be.visible') .click({ force: true })

Si no es así, deberá agregar todo el código personalizado a la pregunta, ya que el problema se encuentra en algún lugar allí.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!