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

104
Vistas
Verify number of times window.close was called - cypress

I have created stub for window.close for cypress I want to know number of times it has been called .

 cy.window().then(win => {
   cy.stub(win, 'close').as('parentWindowCalled');
 });

I want to check whether window.close is never called . How can I do that ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You would need the stub object

let stub
cy.window().then(win => {
  stub = cy.stub(win, 'close').as('parentWindowCalled');
})

// actions
cy.wait('@parentWindowCalled')
cy.wait('@parentWindowCalled')
cy.wait('@parentWindowCalled')

cy.then(() => expect(stub).to.have.been.called.exactly(3))

to.have.been.called is just extracting the call count from the spy, so you can chain other criteria like .have.been.called.at.least(3).

about 4 years ago · Juan Pablo Isaza 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