2022-07-14 19:19:23 +03:00
|
|
|
describe('Swap', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
before(() => {
|
|
|
|
cy.visit('/swap')
|
feat(lists): allow selecting and adding token lists (#1023)
* more list stuff
Use the selected list instead of the default list, but also use the default list
start list selection code
* move token warning to a modal, fix the install issue
* add/remove/enter key
* handle enter on currency select for ETHER
* change slippage tolerance to be a slider
* make ui closer to the mocks
* commit slider changes
* back to tabs
* copy changes
* bump list version
* some styling for the list select
* bump uniswap default list version
* use contract calls to get ens names and addresses
* show list logo
* fix failing integration test
* .eth.link
* list introduction screen
* remove showSendWithSwap
* fix integration and unit tests
* resolve ENS names
* logos from ens
* fix the lint errors
* some refactoring to better support using a the library provider from the user for resolving ENS names
* load list info from the list url for the introduction page
* make it slightly harder to remove a list
* minor clean up, some help text and links
* remove icon from list update popup
* show added/removed tokens
* add GA everywhere, don't debounce contenthash lookups
* show tags
* fix tag key
* tag display, list rendering, needs optimization
* fix list fetching in firefox, style issue in safari
* sort the lists, clean up styling
* use client provider when possible
* show token warning for url loaded tokens
* improve the warning modal
* some refactoring to fix the list fetching on networks other than mainnet
* fix tests
* some minor improvements
* increase timeout to maybe fix integration tests which pass locally
* build for tests using the dev network url
* reset the lists if we deleted the other two copies
* improve how we handle updating the default list of lists
* fix integration test
* Update token list selection styles
* fix external links, reuse the on click outside code, show add errors
* show the list origin instead of the full url
* fix update list link
* show host instead of hostname
do not automatically dismiss major version upgrades for lists
* fix link to tokenlists.org
* add uma
* clean up styling in list rows
* bump token list version
* bump token list version again
* hover symbol to see currency name
* bump version
* add cmc lists, dharma list
Co-authored-by: Callil Capuozzo <callil.capuozzo@gmail.com>
2020-08-26 16:46:21 +03:00
|
|
|
})
|
2022-02-28 21:30:37 +03:00
|
|
|
|
2022-03-08 19:31:52 +03:00
|
|
|
it('starts with ETH selected by default', () => {
|
|
|
|
cy.get('#swap-currency-input .token-amount-input').should('have.value', '')
|
2022-02-28 21:30:37 +03:00
|
|
|
cy.get('#swap-currency-input .token-symbol-container').should('contain.text', 'ETH')
|
2022-03-08 19:31:52 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input').should('not.have.value')
|
2022-08-11 00:45:28 +03:00
|
|
|
cy.get('#swap-currency-output .token-symbol-container').should('contain.text', 'Select token')
|
2022-02-28 21:30:37 +03:00
|
|
|
})
|
|
|
|
|
2020-05-11 16:03:44 +03:00
|
|
|
it('can enter an amount into input', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('#swap-currency-input .token-amount-input').clear().type('0.001').should('have.value', '0.001')
|
2020-05-11 16:03:44 +03:00
|
|
|
})
|
|
|
|
|
2020-05-13 15:29:54 +03:00
|
|
|
it('zero swap amount', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('#swap-currency-input .token-amount-input').clear().type('0.0').should('have.value', '0.0')
|
2020-05-15 00:12:59 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
it('invalid swap amount', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('#swap-currency-input .token-amount-input').clear().type('\\').should('have.value', '')
|
2020-05-13 15:29:54 +03:00
|
|
|
})
|
|
|
|
|
2020-05-11 16:03:44 +03:00
|
|
|
it('can enter an amount into output', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input').clear().type('0.001').should('have.value', '0.001')
|
2020-05-11 16:03:44 +03:00
|
|
|
})
|
2020-05-13 15:29:54 +03:00
|
|
|
|
|
|
|
it('zero output amount', () => {
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input').clear().type('0.0').should('have.value', '0.0')
|
2020-05-14 22:56:40 +03:00
|
|
|
})
|
|
|
|
|
2021-04-27 04:59:56 +03:00
|
|
|
it.skip('can swap ETH for DAI', () => {
|
2020-05-14 22:56:40 +03:00
|
|
|
cy.get('#swap-currency-output .open-currency-select-button').click()
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click()
|
|
|
|
cy.get('#swap-currency-input .token-amount-input').clear().type('0.0000001')
|
2020-05-14 22:56:40 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input').should('not.equal', '')
|
2020-05-17 00:55:22 +03:00
|
|
|
cy.get('#swap-button').click()
|
|
|
|
cy.get('#confirm-swap-or-send').should('contain', 'Confirm Swap')
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('[data-cy="confirmation-close-icon"]').click()
|
2020-05-13 15:29:54 +03:00
|
|
|
})
|
2020-07-09 06:06:29 +03:00
|
|
|
|
2022-07-19 23:42:45 +03:00
|
|
|
it('add a recipient does not exist unless in expert mode', () => {
|
2020-08-24 21:52:41 +03:00
|
|
|
cy.get('#add-recipient-button').should('not.exist')
|
2020-07-09 06:06:29 +03:00
|
|
|
})
|
|
|
|
|
2022-07-19 23:42:45 +03:00
|
|
|
it.skip('ETH to wETH is same value (wrapped swaps have no price impact)', () => {
|
2022-06-16 22:09:57 +03:00
|
|
|
cy.get('#swap-currency-output .open-currency-select-button').click()
|
2022-07-19 23:42:45 +03:00
|
|
|
cy.get('.token-item-0xc778417E063141139Fce010982780140Aa0cD5Ab').click()
|
|
|
|
cy.get('#swap-currency-input .token-amount-input').clear().type('0.01')
|
2022-06-16 22:09:57 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input').should('have.value', '0.01')
|
|
|
|
})
|
2020-05-11 16:03:44 +03:00
|
|
|
})
|