Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda