Uploaded August 2023 | Updated November 2026, 14 minutes ago
It would be really cool if one could write something like this in Cypress specs using the "await" syntax to get the results:
await cy.visit('/')
const n = await cy.get('#projects-count').invoke('text').then(parseInt)
cy.log(n)
expect(n, 'number of projects').to.be.within(350, 400)
Now it is possible. I will publish the code later. If you want to stay tuned, subscribe to this youtube channel and to my monthly newsletter at cypresstips.substack.com The code for this video is in github.com/bahmutov/cy-await but this is very very very ALPHA
It would be really cool if one could write something like this in Cypress specs using the "await" syntax to get the results:
await cy.visit('/')
const n = await cy.get('#projects-count').invoke('text').then(parseInt)
cy.log(n)
expect(n, 'number of projects').to.be.within(350, 400)
Now it is possible. I will publish the code later. If you want to stay tuned, subscribe to this youtube channel and to my monthly newsletter at cypresstips.substack.com The code for this video is in github.com/bahmutov/cy-await but this is very very very ALPHA


![Check N Checkboxes
This video shows how to check multiple checkboxes and how to validate the number of checked and clear boxes in your Cypress tests
// there are no checked boxes at first
cy.get(input[type=checkbox]:checked).should(have.length, 0)
const n = Cypress._.random(1, 5)
cy.log(`checking the first ${n} boxes`)
for (let k = 0; k less than n; k += 1) {
cy.get(input[type=checkbox]).eq(k).check()
}
cy.get(input[type=checkbox]:checked).should(have.length, n)
// clear boxes
cy.get(input[type=checkbox]:not(:checked)).should(
have.length,
5 - n,
)
Find this recipe at https://glebbahmutov.com/cypress-examples Check N Checkboxes](https://i.ytimg.com/vi/6vw47x6Nqc0/mqdefault.jpg)







