diff --git a/cypress/e2e/swap/errors.test.ts b/cypress/e2e/swap/errors.test.ts index cdb6f04cd5..da28dc2c7a 100644 --- a/cypress/e2e/swap/errors.test.ts +++ b/cypress/e2e/swap/errors.test.ts @@ -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') + }) }) diff --git a/cypress/fixtures/insufficientLiquidity.json b/cypress/fixtures/insufficientLiquidity.json new file mode 100644 index 0000000000..ff36da9d06 --- /dev/null +++ b/cypress/fixtures/insufficientLiquidity.json @@ -0,0 +1,5 @@ +{ + "errorCode": "QUOTE_ERROR", + "detail": "No quotes available", + "id": "63363cc1-d474-4584-b386-7c356814b79f" +} \ No newline at end of file