Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions tests/cypress/template/vocab-search-page.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,22 @@ describe('Vocabulary search page', () => {
more.should('not.exist')
})
it('More results are loaded on scroll', () => {
cy.visit(`/yso/en/search?clang=en&q=g`)
cy.visit(`/yso/en/search?clang=en&q=an`)
// Check that there are 5 search results
cy.get('#search-results').find('.search-result').should('have.length', 5)
// Scroll to bottom of page

// Listen to the API call
cy.intercept('GET', '/yso/en/search?clang=en&q=an*').as('search')

cy.scrollTo('bottom')
// Check that there are 9 search results
cy.get('#search-results').find('.search-result').should('have.length', 9, {'timeout': 20000})

// Wait for the API call to finish
cy.wait('@search', { timeout: 20000 })

// Check that there are 6 search results
cy.get('#search-results').find('.search-result').should('have.length', 6)
// Check that all results message is displayed
cy.get('#search-count').invoke('text').should('contain', 'All 9 results displayed')
cy.get('#search-count').invoke('text').should('contain', 'All 6 results displayed')

})
})
Loading