I have an dynamically loaded table based on an infinite-scroll component. I can test the loaded items as follows, but only 20 items are loaded at a time.
How can I repeat until the 500th item comes into view without repeating the code 100 times?
cy.get('div.infinite-scroll-component')
.children()
.should('have.length', 20)
.last()
.scrollIntoView()
cy.contains('Loading')
.should('be.visible')
<div class="infinite-scroll-component" style="height: auto; overflow: auto;">List:
<div style="height: 30px; border: 1px solid green; margin: 6px; padding: 8px;">Item #0</div>
<div style="height: 30px; border: 1px solid green; margin: 6px; padding: 8px;">Item #1</div>
<div style="height: 30px; border: 1px solid green; margin: 6px; padding: 8px;">Item #2</div>
<div style="height: 30px; border: 1px solid green; margin: 6px; padding: 8px;">Item #3</div>
...