chore: e2e insufficient liquidity test (#7075)

* chore: e2e insufficient liquidity test

* Update cypress/e2e/swap/errors.test.ts

Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>

* fixing lint

* waiting for quote

* stubbing insufficient liquidity response

* req reply

* trying full url

* maybe cors

* moving before visit

* adding back timeout

* Revert "adding back timeout"

This reverts commit 89cff3afb815f5e5db005347f20812b83e047057.

* in describe block

* moving to new file

* moving to errors test file

* moving comment

* removing extra describe

---------

Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>
This commit is contained in:
Jack Short 2023-11-08 13:11:41 -05:00 committed by GitHub
parent b4f3555600
commit c27e70b87c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

@ -116,4 +116,17 @@ describe('Swap errors', () => {
getBalance(DAI).should('be.closeTo', initialBalance + 200, 1)
})
})
it('no liquidity', () => {
// The API response is too variable so stubbing a 404.
cy.intercept('POST', 'https://api.uniswap.org/v2/quote', {
statusCode: 404,
fixture: 'insufficientLiquidity.json',
})
cy.visit(`/swap?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`)
cy.get('#swap-currency-output .token-amount-input').type('100000000000000').should('have.value', '100000000000000') // 100 trillion
cy.contains('Insufficient liquidity for this trade.')
cy.get('#swap-button').should('not.exist')
})
})

@ -0,0 +1,5 @@
{
"errorCode": "QUOTE_ERROR",
"detail": "No quotes available",
"id": "63363cc1-d474-4584-b386-7c356814b79f"
}