Uploaded August 2025 | Updated November 2026, 14 minutes ago
This video shows an example of conditional testing:
- if the details element is open, close it and confirm the text is removed from DOM
- if the details element is closed, open it and confirm the text is visible to the user
Find the full recipe at glebbahmutov.com/cypress-examples
This video shows an example of conditional testing:
- if the details element is open, close it and confirm the text is removed from DOM
- if the details element is closed, open it and confirm the text is visible to the user
Find the full recipe at glebbahmutov.com/cypress-examples








![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)
