Uploaded March 2025 | Updated November 2026, 39 minutes ago
This video shows the new CSS property ":user-invalid" that is available in the latest browsers. This property is turned on when the user has interacted with an input field, removed the focus, and the field does not pass its validations.
- more about the CSS property at developer.mozilla.org/en-US/docs/Web/CSS/:user-invalid
- this full example at glebbahmutov.com/cypress-examples/recipes/user-invalid-form-validation.html part of glebbahmutov.com/cypress-examples
- I used the "cypress-real-events" plugin to type into the field to trigger the CSS state github.com/dmtrKovalenko/cypress-real-events
- to get the "::before" CSS object, I used helper queries from the github.com/bahmutov/cypress-map plugin
This video shows the new CSS property ":user-invalid" that is available in the latest browsers. This property is turned on when the user has interacted with an input field, removed the focus, and the field does not pass its validations.
- more about the CSS property at developer.mozilla.org/en-US/docs/Web/CSS/:user-invalid
- this full example at glebbahmutov.com/cypress-examples/recipes/user-invalid-form-validation.html part of glebbahmutov.com/cypress-examples
- I used the "cypress-real-events" plugin to type into the field to trigger the CSS state github.com/dmtrKovalenko/cypress-real-events
- to get the "::before" CSS object, I used helper queries from the github.com/bahmutov/cypress-map plugin
![The Text Of Each Element Starts With The Given String
Lets confirm the search results when searching for text mi all start with this text (ignoring the case)
cy.get([name=state]).type(mi)
cy.get(#search-results li)
.should(exist)
.each(function ($li, k) {
const text = $li.text()
expect(text, `state ${k + 1}`).to.match(/^mi/i)
})
Find this example at https://glebbahmutov.com/cypress-examples/ The Text Of Each Element Starts With The Given String](https://i.ytimg.com/vi/BWuWf8mqe3k/mqdefault.jpg)









