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

495
Views
La función de reloj Cypress hace que el cuerpo html sea invisible

en mis pruebas de ciprés, busco configurar el reloj a una hora específica para tener un marco de tiempo constante para cada prueba.

Cuando llamo:

 cy.visit('/path/to/page'); cy.get('#elementId').click();

Todo está bien.

Sin embargo, cuando hago:

 cy.clock(Date.now()); cy.visit('/path/to/page'); cy.get('#elementId').click();

Obtuve el siguiente error:

 This element `<button with Id i want to click>` is not visible because its parent `<body>` has CSS property: `display: none`

Esto también sucede cuando no paso argumentos a cy.clock() . ¿Por qué cy.clock() configura el cuerpo de esta página como invisible? ¿Y cómo evito esto?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

El cy.clock() sobrescribe y congela las funciones de JavaScript relacionadas con los temporizadores: setTimeout, setInterval y los objetos Date.

Parece que su aplicación utiliza setTimeout durante la carga y algunos javascript iniciales no se completan.

Intente agregar un cy.tick() a la secuencia de comandos

 cy.clock(Date.now()); cy.visit('/path/to/page'); cy.tick(1000); // try longer and shorter timings cy.get('#elementId').click()
about 4 years ago · Santiago Trujillo Report

0

¿Qué tal si proporciona una salida personalizada para que el elemento sea visible primero y luego click() ?

 cy.get('#elementId', {timeout: 6000}).should('be.visible').click()

O también puede usar {force: true} en caso de que quiera hacer clic en un elemento oculto.

 cy.get('#elementId', {timeout: 6000}).should('be.visible').click({force: true})
about 4 years ago · Santiago Trujillo 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!