Uploaded February 2025 | Updated September 2026, 1 week ago
This video shows a lesser known Chai assertion "have.nested.property" The assertion works very well with objects and arrays:
cy.wrap({ name: { first: 'Joe' } })
.should('have.nested.property', 'name.first', 'Joe')
// array example
cy.wrap([
{ sum: 42 },
{ sum: 101 },
{ sum: { errors: ['Invalid operation'] } },
]).should(
'have.nested.property',
'2.sum.errors.0',
'Invalid operation',
)
The code examples are at glebbahmutov.com/cypress-examples/recipes/lesser-known-chai-assertions.html
This video shows a lesser known Chai assertion "have.nested.property" The assertion works very well with objects and arrays:
cy.wrap({ name: { first: 'Joe' } })
.should('have.nested.property', 'name.first', 'Joe')
// array example
cy.wrap([
{ sum: 42 },
{ sum: 101 },
{ sum: { errors: ['Invalid operation'] } },
]).should(
'have.nested.property',
'2.sum.errors.0',
'Invalid operation',
)
The code examples are at glebbahmutov.com/cypress-examples/recipes/lesser-known-chai-assertions.html










