How to use Cypress to assert that a HTML element has a height or width greater than a specified amount?

Viewed 2523

This Github thread highlights how to use Cypress to assert an element has a specified height.

cy.get(mainMenu).should('have.css', 'height', '55px')

How do I use Cypress to assert an element is greater than a specified height?

For example, I want to assert that a certain HTML element always has a height greater than 100px.

1 Answers
cy.get(mainMenu).invoke('height').should('gte', 55)

invoke() - to call a jquery function on an element which is the height.

gte (aka. least) - to assert the target is equal or greater than a given value

Related