Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
react-infinite-scroll-component with cypress

I try to test fetching data on scroll in infinity-loading component. I am using react-infinite-scroll-component and cypress.

Component:

<div
    data-testid="chat-messages"
    className="..."
>
    <InfiniteScroll
        dataLength={MessagesComponents.length}
        next={loadMore}
        className="..."
        inverse
        hasMore={!isReachedEnd}
        loader={<Loader />}
        scrollableTarget="list-of-messages"
    >
        {MessagesComponents}
    </InfiniteScroll>
</div>

My test:

    cy.intercept(...).as('loadingMore');

    // Scroll to top
    cy.get('[data-testid="chat-messages"]')
        .children()
        .first()
        .children()
        .first()
        .scrollTo('top');

    cy.wait('@loadingMore').then(() => {...});

Problem (in cypress console):

Timed out retrying after 4000ms: cy.scrollTo() failed because this element is not scrollable:

<div class="infinite-scroll-component" style="height: auto; overflow: auto;">...</div>

Please for help.

Scroll library: link

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!