Uploaded August 2023 | Updated September 2026, 1 week ago
This short video shows the new release of cypress-if plugin for writing conditional logic in Cypress tests. The plugin finally supports Cypress v12+ thanks to the pull request github.com/bahmutov/cypress-if/pull/65
The test to conditionally close the popup dialog is:
cy.get('aside.banner')
.if('visible')
.wait(1000)
.contains('button', 'Agree')
.click()
.else()
.log('**not visible**')
cy.get('aside.banner').should('not.be.visible')
For more see the plugin's README github.com/bahmutov/cypress-if
This short video shows the new release of cypress-if plugin for writing conditional logic in Cypress tests. The plugin finally supports Cypress v12+ thanks to the pull request github.com/bahmutov/cypress-if/pull/65
The test to conditionally close the popup dialog is:
cy.get('aside.banner')
.if('visible')
.wait(1000)
.contains('button', 'Agree')
.click()
.else()
.log('**not visible**')
cy.get('aside.banner').should('not.be.visible')
For more see the plugin's README github.com/bahmutov/cypress-if




![Chai Nested Property Assertion In Cypress
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 https://glebbahmutov.com/cypress-examples/recipes/lesser-known-chai-assertions.html Chai Nested Property Assertion In Cypress](https://i.ytimg.com/vi/R1u73hgA1_Q/mqdefault.jpg)





