Home > Back-end >  How to use cypress, scrollTo in Ionic App?
How to use cypress, scrollTo in Ionic App?

Time:09-25

For a test in Cypress I want to scroll down to the bottom of the page created with Ionic.

I have tried using scrollTo on the window:

cy.scrollTo('bottom')

But got an error: Timed out retrying after 4000ms: cy.scrollTo() failed because this element is not scrollable:<window>

Using scrollIntoView on the element itself, did not help either.

Also scrolling the main ionic container:

cy.get('ion-content').scrollTo('bottom')

resulted in the same error.

Has anybody an idea?

CodePudding user response:

Using the main div in shadow root inside the ion-content container did the trick for me:

cy.get('ion-content').shadow().find('main').scrollTo('bottom')

It seems to be the container which is actually scrollable

  • Related