Use each Function From cypress-recurse Plugin To Iterate And Stop

Pubblicato il: 16 marzo 2022
sul canale di: gleb bahmutov
2,375
19

This video shows how to use "each" function from the https://github.com/bahmutov/cypress-r... plugin to iterate over the elements and stop when we see the number 7. It is simpler than using the standard cy.each command.

// https://github.com/bahmutov/cypress-r...
import { each } from 'cypress-recurse'

it('stops when it sees 7 using each from cypress-recurse', function () {
cy.visit('index.html')

cy.get('tbody button').then(
each(
function ($button) {
return cy
.wrap($button)
.click()
.parent()
.parent()
.contains('td', /\d/)
.invoke('text')
.then(Number)
},
function (n) {
return n === 7
}
),
)
})

Find this test in https://github.com/bahmutov/better-cy... repository and read the blog post https://glebbahmutov.com/blog/better-...


In questa pagina del sito puoi guardare il video online Use each Function From cypress-recurse Plugin To Iterate And Stop della durata di ore minuti seconda in buona qualità , che l'utente ha caricato gleb bahmutov 16 marzo 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,375 volte e gli è piaciuto 19 spettatori. Buona visione!