In my test I need to fill particular cells in table. In tested app, cells do not exist in DOM unless they are visible in the scrolled view. So I need a method that will check if the cell with particular ID exist in DOM, if no scroll horizontal to right by 100px and check again. If it still doesn’t exist scroll again and so on.
Here is the method (I keep it in the page object):
scrollToColumn(column){
cy.exist("div[data-tutorial-selector-id='dataRightPane'] div[data-columnid='"+column+"']").then((exist)=>{
if(exist) {
return
} else {
cy.get("div[class='antiscroll-inner']").scrollTo(100, 0)
this.scrollToColumn(column);
}
})
}
The thing is that when Cypress is calling this method it crashes completely; no errors, just freezes.
I have tried to use this method as a variable as I have heard the suggestion it might work but it didn’t.
2