Cypress IO- Writing a For Loop

To force an arbitrary loop, I create an array with the indices I want, and then call cy.wrap

var genArr = Array.from({length:15},(v,k)=>k+1)
cy.wrap(genArr).each((index) => {
    cy.get("#button-" + index).click()
})

Leave a Comment