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?
"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.