uniswap-interface-uncensored/cypress/integration/swap.test.ts

66 lines
2.4 KiB
TypeScript
Raw Normal View History

2020-05-11 16:03:44 +03:00
describe('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
beforeEach(() => {
cy.visit('/swap')
})
2020-05-11 16:03:44 +03:00
it('can enter an amount into input', () => {
2021-02-16 11:46:17 +03:00
cy.get('#swap-currency-input .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
2020-05-11 16:03:44 +03:00
})
it('zero swap amount', () => {
2021-02-16 11:46:17 +03:00
cy.get('#swap-currency-input .token-amount-input').type('0.0', { delay: 200 }).should('have.value', '0.0')
})
it('invalid swap amount', () => {
2021-02-16 11:46:17 +03:00
cy.get('#swap-currency-input .token-amount-input').type('\\', { delay: 200 }).should('have.value', '')
})
2020-05-11 16:03:44 +03:00
it('can enter an amount into output', () => {
2021-02-16 11:46:17 +03:00
cy.get('#swap-currency-output .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
2020-05-11 16:03:44 +03:00
})
it('zero output amount', () => {
2021-02-16 11:46:17 +03:00
cy.get('#swap-currency-output .token-amount-input').type('0.0', { delay: 200 }).should('have.value', '0.0')
})
it.skip('can swap ETH for DAI', () => {
cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').should('be.visible')
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click({ force: true })
cy.get('#swap-currency-input .token-amount-input').should('be.visible')
2020-06-08 17:50:27 +03:00
cy.get('#swap-currency-input .token-amount-input').type('0.001', { force: true, delay: 200 })
cy.get('#swap-currency-output .token-amount-input').should('not.equal', '')
Refactor ExchangePage into Swap and Send pages (#774) * Part 1, separate swap and send, move duplicate code into separate files * Move some more constants out of the swap/send * Support defaults from URL parameters * Implement query string parsing via a redux action * Finish merging the changes * Fix the slippage warnings * Clean up some other files * More refactoring * Move the price bar out of the component * Move advanced details and some computations into utilities * Make same improvements to send * Approval hook * Swap page functional with swap callback hook * Swap/send page functional with swap callback hook * Fix lint * Move styleds.ts * Fix integration test * Fix error state in swap and move some things around * Move send callback out of send page * Make send behave more like current behavior * Differentiate swap w/o send on send page from swap w/o send on swap page * Remove userAdvanced which was always false * Remove the price bar which is not used in the new UI * Delete the file * Fix null in the send dialog and move another component out of send * Move the swap modal header out to another file * Include change after merge * Add recipient to swap message * Keep input token selected if user has no balance and clicks send with swap * Move the modal footer out of send component * Remove the hard coded estimated time * Fix the label/action for swap/sends * Share the swap modal footer between swap and send * Fix integration test * remove margin from popper to suppress warnings fix missing ENS name recipient link default deadline to 15 minutes * ensure useApproveCallback returns accurate data * clean up callbacks * extra space * Re-apply ignored changes from v2 branch ExchangePage file Co-authored-by: Noah Zinsmeister <noahwz@gmail.com>
2020-05-17 00:55:22 +03:00
cy.get('#swap-button').click()
cy.get('#confirm-swap-or-send').should('contain', 'Confirm Swap')
})
it.skip('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-08-24 21:52:41 +03:00
describe('expert mode', () => {
beforeEach(() => {
2021-02-16 11:46:17 +03:00
cy.window().then((win) => {
2020-08-24 21:52:41 +03:00
cy.stub(win, 'prompt').returns('confirm')
})
cy.get('#open-settings-dialog-button').click()
cy.get('#toggle-expert-mode-button').click()
cy.get('#confirm-expert-mode').click()
})
it.skip('add a recipient is visible', () => {
2020-08-24 21:52:41 +03:00
cy.get('#add-recipient-button').should('be.visible')
})
it.skip('add a recipient', () => {
2020-08-24 21:52:41 +03:00
cy.get('#add-recipient-button').click()
cy.get('#recipient').should('exist')
})
it.skip('remove recipient', () => {
2020-08-24 21:52:41 +03:00
cy.get('#add-recipient-button').click()
cy.get('#remove-recipient-button').click()
cy.get('#recipient').should('not.exist')
})
})
2020-05-11 16:03:44 +03:00
})