2021-08-31 18:10:07 +03:00
|
|
|
import { CyHttpMessages } from 'cypress/types/net-stubbing'
|
2021-09-22 02:21:28 +03:00
|
|
|
|
2021-08-31 18:10:07 +03:00
|
|
|
import { aliasQuery, hasQuery } from '../utils/graphql-test-utils'
|
|
|
|
|
2020-05-21 06:31:05 +03:00
|
|
|
describe('Add Liquidity', () => {
|
2021-08-31 18:10:07 +03:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.intercept('POST', '/subgraphs/name/uniswap/uniswap-v3', (req) => {
|
|
|
|
aliasQuery(req, 'feeTierDistribution')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-05-21 06:45:49 +03:00
|
|
|
it('loads the two correct tokens', () => {
|
2023-03-03 22:20:41 +03:00
|
|
|
cy.visit('/add/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6/500')
|
|
|
|
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'UNI')
|
2020-05-27 18:42:25 +03:00
|
|
|
cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'ETH')
|
2020-05-21 06:45:49 +03:00
|
|
|
})
|
2020-05-21 06:31:05 +03:00
|
|
|
|
2020-05-21 06:45:49 +03:00
|
|
|
it('does not crash if ETH is duplicated', () => {
|
2023-03-03 22:20:41 +03:00
|
|
|
cy.visit('/add/0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6/0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6')
|
2020-05-27 18:42:25 +03:00
|
|
|
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')
|
2020-05-21 06:45:49 +03:00
|
|
|
})
|
|
|
|
|
2022-10-06 23:16:58 +03:00
|
|
|
it.skip('token not in storage is loaded', () => {
|
2023-03-03 22:20:41 +03:00
|
|
|
cy.visit('/add/0x07865c6e87b9f70255377e024ace6630c1eaa37f/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984')
|
|
|
|
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'USDC')
|
|
|
|
cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'UNI')
|
2020-05-21 06:31:05 +03:00
|
|
|
})
|
2020-07-10 22:25:15 +03:00
|
|
|
|
2022-10-06 23:16:58 +03:00
|
|
|
it.skip('single token can be selected', () => {
|
2023-03-03 22:20:41 +03:00
|
|
|
cy.visit('/add/0x07865c6e87b9f70255377e024ace6630c1eaa37f')
|
|
|
|
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'USDC')
|
|
|
|
cy.visit('/add/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984')
|
|
|
|
cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'UNI')
|
2020-07-10 22:25:15 +03:00
|
|
|
})
|
2021-07-13 22:54:49 +03:00
|
|
|
|
2022-10-06 23:16:58 +03:00
|
|
|
it.skip('loads fee tier distribution', () => {
|
2021-08-31 18:10:07 +03:00
|
|
|
cy.fixture('feeTierDistribution.json').then((feeTierDistribution) => {
|
|
|
|
cy.intercept('POST', '/subgraphs/name/uniswap/uniswap-v3', (req: CyHttpMessages.IncomingHttpRequest) => {
|
2022-08-17 03:01:12 +03:00
|
|
|
if (hasQuery(req, 'FeeTierDistributionQuery')) {
|
|
|
|
req.alias = 'FeeTierDistributionQuery'
|
2021-08-31 18:10:07 +03:00
|
|
|
|
|
|
|
req.reply({
|
|
|
|
body: {
|
|
|
|
data: {
|
|
|
|
...feeTierDistribution,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'access-control-allow-origin': '*',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2021-07-13 22:54:49 +03:00
|
|
|
|
2023-03-03 22:20:41 +03:00
|
|
|
cy.visit('/add/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6')
|
2021-07-13 22:54:49 +03:00
|
|
|
|
2022-08-17 03:01:12 +03:00
|
|
|
cy.wait('@FeeTierDistributionQuery')
|
2021-07-13 22:54:49 +03:00
|
|
|
|
2021-08-31 18:10:07 +03:00
|
|
|
cy.get('#add-liquidity-selected-fee .selected-fee-label').should('contain.text', '0.3% fee tier')
|
2021-11-12 17:46:26 +03:00
|
|
|
cy.get('#add-liquidity-selected-fee .selected-fee-percentage').should('contain.text', '40%')
|
2021-07-13 22:54:49 +03:00
|
|
|
})
|
|
|
|
})
|
2020-05-21 06:31:05 +03:00
|
|
|
})
|