-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0105fd
commit d497557
Showing
2 changed files
with
85 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,84 @@ | ||
describe('test trending topics', () => { | ||
it('Checking it trending topics exist', () => { | ||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search/latest*', | ||
}).as('loadLatest') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/about*', | ||
}).as('loadAbout') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/stats*', | ||
}).as('loadStats') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/get_trends*', | ||
}).as('getTrends') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search*', | ||
}).as('search') | ||
|
||
cy.visit('/', { | ||
onBeforeLoad(win) { | ||
// @ts-ignore | ||
win.CYPRESS_USER = 'carol' // eslint-disable-line no-param-reassign | ||
|
||
// @ts-ignore | ||
win.CYPRESS_USER_BUDGET = 300 // eslint-disable-line no-param-reassign | ||
}, | ||
}) | ||
|
||
cy.wait(['@loadAbout', '@loadLatest', '@loadStats']) | ||
|
||
// wait for boltwall queue to send tweets to jarvis | ||
cy.wait(70000) | ||
|
||
cy.get('[data-testid="explore-graph-btn"]').click() | ||
|
||
cy.wait('@getTrends').then((interception) => { | ||
const responseBody = interception.response.body | ||
|
||
cy.get('.list').should('exist') | ||
|
||
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', { timeout: 90000 }).then((interception) => { | ||
cy.log('Search request intercepted') | ||
expect(interception.response.statusCode).to.eq(402) | ||
}) | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search*', | ||
}).as('search2') | ||
|
||
cy.wait('@search2') | ||
|
||
// Check if the search result list has more than one child | ||
// cy.get('.episode-wrapper') | ||
// .should('exist') // Ensure they exist | ||
// .should('have.length.greaterThan', 1) // Check that there are more than one | ||
// .first() // Select the first element | ||
// .click() | ||
|
||
// cy.get('[data-testid="sidebar-sub-view"]').should('have.css', 'position', 'relative') | ||
|
||
// cancel search | ||
cy.get('[data-testid="search_action_icon"]').click() | ||
|
||
cy.get('.list').should('exist') | ||
}) | ||
}) | ||
}) | ||
describe('test trending topics', () => { | ||
it('Checking it trending topics exist', () => { | ||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search/latest*', | ||
}).as('loadLatest') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/about*', | ||
}).as('loadAbout') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/stats*', | ||
}).as('loadStats') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/get_trends*', | ||
}).as('getTrends') | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search*', | ||
}).as('search') | ||
|
||
cy.visit('/', { | ||
onBeforeLoad(win) { | ||
// @ts-ignore | ||
win.CYPRESS_USER = 'carol' // eslint-disable-line no-param-reassign | ||
|
||
// @ts-ignore | ||
win.CYPRESS_USER_BUDGET = 300 // eslint-disable-line no-param-reassign | ||
}, | ||
}) | ||
|
||
cy.wait(['@loadAbout', '@loadLatest', '@loadStats']) | ||
|
||
// wait for boltwall queue to send tweets to jarvis | ||
cy.wait(70000) | ||
|
||
// cy.get('[data-testid="explore-graph-btn"]').click() | ||
|
||
cy.wait('@getTrends').then((interception) => { | ||
const responseBody = interception.response.body | ||
|
||
cy.get('.list').should('exist') | ||
|
||
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', { timeout: 90000 }).then((interception) => { | ||
cy.log('Search request intercepted') | ||
expect(interception.response.statusCode).to.eq(402) | ||
}) | ||
|
||
cy.intercept({ | ||
method: 'GET', | ||
url: 'http://localhost:8444/api/prediction/graph/search*', | ||
}).as('search2') | ||
|
||
cy.wait('@search2') | ||
|
||
// Check if the search result list has more than one child | ||
// cy.get('.episode-wrapper') | ||
// .should('exist') // Ensure they exist | ||
// .should('have.length.greaterThan', 1) // Check that there are more than one | ||
// .first() // Select the first element | ||
// .click() | ||
|
||
// cy.get('[data-testid="sidebar-sub-view"]').should('have.css', 'position', 'relative') | ||
|
||
// cancel search | ||
cy.get('[data-testid="search_action_icon"]').click() | ||
|
||
cy.get('.list').should('exist') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters