How could I scroll one page to the right in Cypress?
E.g. I have a horizontally scrollable area. The area contains elements a
, b
and if I scroll to the right a
and b
get destroyed, while c
and d
get added.
My attempt is to find out the width of the scrollable view and then scroll that amount to the right. But the width does not get retrieved before the scrollTo
gets called.
Here is what I am trying to do:
const width = cy.getCy("scroll-viewport").invoke("width");
cy.getCy("scroll-viewport").scrollTo(width, 0);