Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ltthienn committed Nov 22, 2023
1 parent be2e906 commit d4e5381
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions cypress/e2e/specs/intercept.e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ const tokenCatalog = new TokenCatalog()
const farm = new FarmPage()

describe('Intercept', { tags: TAG.regression }, () => {
before(() => {
beforeEach(() => {
SwapPage.open(DEFAULT_URL)
})

afterEach(() => {
cy.clearCookies();
cy.clearLocalStorage();
})

describe('Swap', () => {
it('Should get route successfully', () => {
cy.intercept('GET', '**/routes?**').as('get-route')
Expand All @@ -18,16 +23,16 @@ describe('Intercept', { tags: TAG.regression }, () => {

describe('Pools', () => {
it('Should get pool, farm list successfully', () => {
SwapPage.goToPoolPage()
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
cy.intercept('GET', '**/pools?**').as('get-pool-list')
SwapPage.goToPoolPage()
cy.wait('@get-farm-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
cy.wait('@get-pool-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
})

it('Should be displayed APR and TVL values', () => {
cy.reload()
cy.intercept('GET', '**/pools?**').as('get-pools')
SwapPage.goToPoolPage()
cy.wait('@get-pools', { timeout: 20000 }).its('response.body.data').then(response => {
const totalPools = response.pools.length;
const count = response.pools.reduce((acc: number, pool: { totalValueLockedUsd: string; apr: string }) => {
Expand All @@ -41,9 +46,16 @@ describe('Intercept', { tags: TAG.regression }, () => {
})
})

describe('My Pools', () => {
it('Should get farm list successfully', () => {
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
SwapPage.goToMyPoolsPage()
cy.wait('@get-farm-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
})
})

describe('Farms', () => {
it('Should get pool, farm list successfully', () => {
cy.reload()
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
cy.intercept('GET', '**/pools?**').as('get-pool-list')
SwapPage.goToFarmPage()
Expand All @@ -57,13 +69,4 @@ describe('Intercept', { tags: TAG.regression }, () => {
})
})
})

describe('My Pools', () => {
it('Should get farm list successfully', () => {
cy.reload()
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
SwapPage.goToMyPoolsPage()
cy.wait('@get-farm-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
})
})
})

0 comments on commit d4e5381

Please sign in to comment.