'How to validate multiple texts on a page in Cypress
I am trying to validate multiple texts on a web page. When I use the invoke method it is giving me 'Maximum call stack size exceeded error' because of multiple function calls.
How can I limit the use of .then() calls?
Below is my cypress code and I have more than 25 text validations to do
Cypress._.times(5, () => {
Elements.flow.gettablerow().eq(Elements.getrandomnumber()).within($row => {
Elements.flow.getcheckbox().check({ force: true })
Elements.flow.getbutton().click().then($el => {
Elements.flow.getheader().invoke('text').then($text => {
expect($text).to.equals('header text')
})
Elements.flow.getwarningtext().invoke('text').then(text => {
expect(text).to.equals('warning text')
})
Elements.flow.getvelocitytext().invoke('text').then($text => {
expect($text).to.equals(`velocit text`)
})
})
})
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
