Uploaded March 2024 | Updated September 2026, 1 week ago
This video shows custom query commands from cypress-map plugin. I explain how the "cy.difference" command can help compare a large object of extracted text from the page and show a nice error message if several values are different. Read the blog post "Check Fees And Totals Using Cypress" glebbahmutov.com/blog/check-fees-using-cypress and find the source code in the repo github.com/bahmutov/cypress-prices-check Plugin cypress-map can be found at github.com/bahmutov/cypress-map
This video shows custom query commands from cypress-map plugin. I explain how the "cy.difference" command can help compare a large object of extracted text from the page and show a nice error message if several values are different. Read the blog post "Check Fees And Totals Using Cypress" glebbahmutov.com/blog/check-fees-using-cypress and find the source code in the repo github.com/bahmutov/cypress-prices-check Plugin cypress-map can be found at github.com/bahmutov/cypress-map
![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)







![Use cy.filter Command To Filter Elements By Child Element Presence
We can use the cy.filter command to filter DOM elements by the presence of some child elements. For example, to find all LI elements that have an element inside with class new, we can do the following (this example also verifies the elements own text)
// confirm 2 new elements
cy.get(li).filter(:has(.new)).should(have.length, 2)
// confirm the elements without new label
// have specific tet
cy.get(li)
.filter(:not(:has(.new)))
.map(childNodes.0.nodeValue)
.mapInvoke(trim)
.should(deep.equal, [Grapes, Pears])
Note: map and mapInvoke commands come from the plugin https://github.com/bahmutov/cypress-map
Find this recipe at https://glebbahmutov.com/cypress-examples/ Use cy.filter Command To Filter Elements By Child Element Presence](https://i.ytimg.com/vi/ZC6fXDkPtMI/mqdefault.jpg)

