Uploaded March 2025 | Updated September 2026, 1 week ago
This video shows how to write Cypress custom commands with multiple DOM snapshots showing the app in different stages. We will use "Cypress.log" to create a log instance and then call "log.snapshot" to create instant DOM snapshots. Two things to remember:
- log.snapshot is a synchronous method call, so we want to make sure it runs after the previous Cypress command finishes. Use "cy.then(callback)" for this
- call log.end to signal the official end to the custom command logging
Find the full recipe at glebbahmutov.com/cypress-examples
This video shows how to write Cypress custom commands with multiple DOM snapshots showing the app in different stages. We will use "Cypress.log" to create a log instance and then call "log.snapshot" to create instant DOM snapshots. Two things to remember:
- log.snapshot is a synchronous method call, so we want to make sure it runs after the previous Cypress command finishes. Use "cy.then(callback)" for this
- call log.end to signal the official end to the custom command logging
Find the full recipe at glebbahmutov.com/cypress-examples





![Case-Insensitive Query With Retries
This video shows how you can use Cypress.$ jQuery method to select elements without matching the attribute casing. While cy.get does not allow you to pass i suffix to mark the CSS selector case-insensitive (see bug https://github.com/cypress-io/cypress/issues/25304) you can work around it by using Cypress.$(... i) or even retry it by doing cy.wrap(Cypress).invoke($, ...i)
// static page, lets find all buttons with class btn-primary or bTn-PrImArY
cy.wrap(Cypress.$(button[class=btn-primary i])).should(
have.length,
2,
)
// dynamic page, retry the query
cy.wrap(Cypress)
.invoke($, button[class=btn-primary i])
.should(have.length, 2)
Find the full recipe at https://glebbahmutov.com/cypress-examples Case-Insensitive Query With Retries](https://i.ytimg.com/vi/XQ6GQSmF5_I/mqdefault.jpg)




