diff --git a/cypress/e2e/specs/intercept.e2e.cy.ts b/cypress/e2e/specs/intercept.e2e.cy.ts index 645273ea73..384570e5c7 100644 --- a/cypress/e2e/specs/intercept.e2e.cy.ts +++ b/cypress/e2e/specs/intercept.e2e.cy.ts @@ -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') @@ -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 }) => { @@ -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() @@ -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) - }) - }) }) \ No newline at end of file