jeudi 17 septembre 2020

how can i reach the returned value of cy.each in Cypress.io

im trying to fail my test if the return value is false and im stuck how can i fail the test after returning false it says : expected '<div.products>' to be true

        cy.get('.products').each(($el,index,$list) => {
            const productName = $el.find('h4.product-name').text();

            if(!productName.includes('ca')){
                return false;
            }
            
        }).then(($list) => {
            console.log($list)
            expect($list).to.be.true;
        })
        
    })
}
)

Aucun commentaire:

Enregistrer un commentaire