Uploaded June 2023 | Updated November 2026, 40 minutes ago
Imagine you have a table. Each row has a button that you must click to reveal a number in the next cell. We need to get those numbers from every row and add them all up and confirm the total sum is 18. This video shows how to correctly use cy.each and cy.then command to order all actions. Find this recipe at glebbahmutov.com/cypress-examples
Imagine you have a table. Each row has a button that you must click to reveal a number in the next cell. We need to get those numbers from every row and add them all up and confirm the total sum is 18. This video shows how to correctly use cy.each and cy.then command to order all actions. Find this recipe at glebbahmutov.com/cypress-examples

![The Text Of Each Element Starts With The Given String
Lets confirm the search results when searching for text mi all start with this text (ignoring the case)
cy.get([name=state]).type(mi)
cy.get(#search-results li)
.should(exist)
.each(function ($li, k) {
const text = $li.text()
expect(text, `state ${k + 1}`).to.match(/^mi/i)
})
Find this example at https://glebbahmutov.com/cypress-examples/ The Text Of Each Element Starts With The Given String](https://i.ytimg.com/vi/BWuWf8mqe3k/mqdefault.jpg)








