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

105
Vistas
Is there a way to trigger a hook after the execution of a specific command in cypress

I am trying to monitor the state of the DOM after each call to cy.get and cy.find. I noticed that there are hooks in cypress but they only allow me to run before or after the test. I also looked at plugins, but I am not sure they would allow me to achieve what I am trying to do (I might be missing something though since I am a newbie in cypress).

So basically, my question is: Is it possible to trigger some kind of hook, that would be called every time a specific command is called by the cypress process?

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

0

"Command" is a generic term for Cypress language feature that start with cy..

Some, like cy.get() and .find() are querying commands and have no affect on the DOM.

Others like .click() trigger an event in the app that may change the DOM, so you would use querying commands to see what has changed, or more precisely to test that what you expect to change have indeed changed.

Hooks you mention like beforeEach() and afterEach() are mocha hooks that intercept stages of the test, but they do not query the DOM.

There are also other events that will run some code after Cypress does something, but that's advanced stuff, not often used, and too broad to answer without a specific use-case.


If you want to look at inner workings of the Cypress queue, review this blog Visualize Cypress Command Queue and the accompanying video.

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