← Back to library
Cypressassertionsbeginnerv10+

Assert table row count

Count table rows and assert an exact or minimum number.

1it('table renders the correct number of rows', () => {
2  cy.visit('/users');
3
4  cy.get('table tbody tr').should('have.length', 10);
5
6  // Or assert a minimum
7  cy.get('table tbody tr')
8    .its('length')
9    .should('be.gte', 5);
10});
#table#rows#have.length#count