diff --git a/cypress/e2e/virtual-scroll.cy.js b/cypress/e2e/virtual-scroll.cy.js index 765fb641a..c24433bca 100644 --- a/cypress/e2e/virtual-scroll.cy.js +++ b/cypress/e2e/virtual-scroll.cy.js @@ -65,30 +65,44 @@ describe('Virtual scroll with custom select option style', () => { cy.get(button).find('.filter-option-inner-inner') .should('contain', firstSelectOptionText); - // test the first 50 options + const n = 20; + const typeOptions = { + // Delay after each keypress (Default: 10) + delay: 0, + }; + + // Test the first n options. { - let n = 50; let iterator = testArray.entries(); cy.get(button).click(); - while (n--) { + + for (let i = 1; i <= n; i++) { const [, { text }] = iterator.next().value; - cy.get('li').contains(text) - .should('have.class', 'active'); - dropdownMenu.type('{downArrow}'); + + // Sampling (testing every 5 typing actions) + if (i % 5 === 0) { + cy.get('li').contains(text) + .should('have.class', 'active'); + } + dropdownMenu.type('{downArrow}', typeOptions); } cy.get(button).click(); } - // test the last 50 options + // Test the last n select options. { - let n = 50; let iterator = Array.from(testArray).reverse().entries(); cy.get(button).click(); - while (n--) { + + for (let i = 1; i <= n; i++) { const [, { text }] = iterator.next().value; - dropdownMenu.type('{upArrow}'); - cy.get('li').contains(text) - .should('have.class', 'active'); + dropdownMenu.type('{upArrow}', typeOptions); + + // Sampling (testing every 5 typing actions) + if (i % 5 === 0) { + cy.get('li').contains(text) + .should('have.class', 'active'); + } } cy.get(button).click(); }