-1

I have the following code from the picture and the website, how can I make an assertion that the row has a 4 length? And how i say in the tittle , it is not a table body :(

Thank you!!!

   https://i.stack.imgur.com/vqbfA.png
   https://i.stack.imgur.com/vLL74.jpg

1 Answers1

0

Since it's a list, you will get the length of all li elements in one go. The best I could think of, that you can do is, get all the list elements and then make assert that that the total length %4 == 0. Which will mean no matter how many rows are there all the rows will have 4 elements. Something like

cy.get('li[id*="screenshot"]')
  .its('length')
  .then((len) => {
    cy.wrap(len % 4).should('eq', 0)
  })
Alapan Das
  • 17,144
  • 3
  • 29
  • 52