Skip to content

Commit

Permalink
test: ensured when trending topic is click, we search and get results
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Apr 18, 2024
1 parent cd72976 commit 37a35b8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 81 deletions.
19 changes: 19 additions & 0 deletions cypress/e2e/trendingTopics/trendingTopics.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ describe('test trending topics', () => {
url: 'http://localhost:8444/api/get_trends*',
}).as('getTrends')

cy.intercept({
method: 'GET',
url: 'http://localhost:8444/api/v2/search*',
}).as('search')

cy.visit('/', {
onBeforeLoad(win) {
// @ts-ignore
Expand All @@ -38,6 +43,20 @@ describe('test trending topics', () => {
for (let i = 0; i < responseBody.length; i++) {
cy.contains('.list', `#${responseBody[i].name}`).should('exist')
}
cy.contains(`#${responseBody[0].name}`).eq(0).click()

//wait for search result
cy.wait('@search')

cy.get('#search-result-list').should('exist')

// Check if the search result list has more than one child
cy.get('#search-result-list').children().should('have.length.gt', 0)

//cancel search
cy.get('[data-testid="search_action_icon"]').click()

cy.get('.list').should('exist')
})
})
})
Loading

0 comments on commit 37a35b8

Please sign in to comment.