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

44 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-05-11 16:03:44 +03:00
describe('Swap', () => {
2020-06-30 21:02:09 +03:00
beforeEach(() => cy.visit('/swap'))
2020-05-11 16:03:44 +03:00
it('can enter an amount into input', () => {
cy.get('#swap-currency-input .token-amount-input')
2020-06-08 17:50:27 +03:00
.type('0.001', { delay: 200 })
.should('have.value', '0.001')
2020-05-11 16:03:44 +03:00
})
it('zero swap amount', () => {
cy.get('#swap-currency-input .token-amount-input')
2020-06-08 17:50:27 +03:00
.type('0.0', { delay: 200 })
.should('have.value', '0.0')
})
it('invalid swap amount', () => {
cy.get('#swap-currency-input .token-amount-input')
2020-06-08 17:50:27 +03:00
.type('\\', { delay: 200 })
.should('have.value', '')
})
2020-05-11 16:03:44 +03:00
it('can enter an amount into output', () => {
cy.get('#swap-currency-output .token-amount-input')
2020-06-08 17:50:27 +03:00
.type('0.001', { delay: 200 })
.should('have.value', '0.001')
2020-05-11 16:03:44 +03:00
})
it('zero output amount', () => {
cy.get('#swap-currency-output .token-amount-input')
2020-06-08 17:50:27 +03:00
.type('0.0', { delay: 200 })
.should('have.value', '0.0')
})
it('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')
})
2020-05-11 16:03:44 +03:00
})