uniswap-interface-uncensored/cypress/integration/add-liquidity.test.ts
Justin Domingue 00403a4810
test: support stubbing subgraph data in cypress (#2259)
* upgrade to 7.0

* first iteration of stubbing subgraph in integration tests

* added fixtures

* add tests for fee tier distribution and liquidity chart

* remove unused test utils

* update yarn.lock

* fixed merge artifacts
2021-08-30 15:56:38 -04:00

55 lines
2.5 KiB
TypeScript

describe('Add Liquidity', () => {
it('loads the two correct tokens', () => {
cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/0xc778417E063141139Fce010982780140Aa0cD5Ab/500')
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'MKR')
cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'ETH')
})
it('does not crash if ETH is duplicated', () => {
cy.visit('/add/0xc778417E063141139Fce010982780140Aa0cD5Ab/0xc778417E063141139Fce010982780140Aa0cD5Ab')
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'ETH')
cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('not.contain.text', 'ETH')
})
it('token not in storage is loaded', () => {
cy.visit('/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85')
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'SKL')
cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'MKR')
})
it('single token can be selected', () => {
cy.visit('/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d')
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'SKL')
cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85')
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'MKR')
})
describe('with subgraph', () => {
it('loads fee tier distribution', () => {
cy.intercept('POST', '/subgraphs/name/uniswap/uniswap-v3', { fixture: 'subgraph/feeTierDistribution.json' }).as(
'getFeeTierDistributionQuery'
)
cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/0xc778417E063141139Fce010982780140Aa0cD5Ab')
cy.wait('@getFeeTierDistributionQuery')
cy.get('[data-test-id=selected-fee-label]').should('contain.text', '0.3% fee tier')
cy.get('[data-test-id=selected-fee-percentage]').should('contain.text', '70%')
})
it('loads ticks data', () => {
cy.intercept('POST', '/subgraphs/name/uniswap/uniswap-v3', { fixture: 'subgraph/v3Ticks.json' }).as(
'getV3TicksQuery'
)
cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/0xc778417E063141139Fce010982780140Aa0cD5Ab/3000')
cy.wait('@getV3TicksQuery')
// TODO: test ticks data (requires stubbing infura pool.tickCurrent)
cy.get('[data-test-id=liquidity-chart-loader]').should('exist')
})
})
})