Uploaded November 2023 | Updated November 2026, 3 days ago
This video shows how to filter DOM elements using the cy.filter command and how to filter items in an array using the cy.invoke command that uses the "filter" Array method. Find the full source code in the repo github.com/bahmutov/cypress-map Tip: by chaining these query command we retry getting the data or elements if the assertion fails.
This video shows how to filter DOM elements using the cy.filter command and how to filter items in an array using the cy.invoke command that uses the "filter" Array method. Find the full source code in the repo github.com/bahmutov/cypress-map Tip: by chaining these query command we retry getting the data or elements if the assertion fails.









![Custom Should Read Assertion From Cypress-map Plugin
This video shows a custom read assertion that checks the text of a single or multiple elements using strings or regular expressions:
cy.get(li).should(read, [
Write code,
Add tests,
/^Pay $d+ fine$/,
])
The assertion is part of my cypress-map plugin https://github.com/bahmutov/cypress-map and the full recipe I am showing in this video is at https://glebbahmutov.com/cypress-examples/recipes/should-read.html Custom Should Read Assertion From Cypress-map Plugin](https://i.ytimg.com/vi/AzJx-8VD6yI/mqdefault.jpg)
![Compare Text In An Element Against Several Possible Values Using oneOf Assertion
You can confirm an element has text that matches string A OR string B OR string C etc using the Chai oneOf assertion.
cy.get(#guest-name)
.invoke(text)
.should(be.oneOf, [Joe, Mary, Anna])
I prefer the above code to a regular expression. Find this example at https://glebbahmutov.com/cypress-examples Compare Text In An Element Against Several Possible Values Using oneOf Assertion](https://i.ytimg.com/vi/B6LqwUHXCcg/mqdefault.jpg)