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', () => {
|
2020-05-15 00:12:59 +03:00
|
|
|
cy.get('#swap-currency-input .token-amount-input')
|
2020-06-08 17:50:27 +03:00
|
|
|
.type('0.001', { delay: 200 })
|
2020-05-15 00:12:59 +03:00
|
|
|
.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', () => {
|
2020-05-15 00:12:59 +03:00
|
|
|
cy.get('#swap-currency-input .token-amount-input')
|
2020-06-08 17:50:27 +03:00
|
|
|
.type('0.0', { delay: 200 })
|
2020-05-15 00:12:59 +03:00
|
|
|
.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 })
|
2020-05-15 00:12:59 +03:00
|
|
|
.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', () => {
|
2020-05-15 00:12:59 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input')
|
2020-06-08 17:50:27 +03:00
|
|
|
.type('0.001', { delay: 200 })
|
2020-05-15 00:12:59 +03:00
|
|
|
.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', () => {
|
2020-05-15 00:12:59 +03:00
|
|
|
cy.get('#swap-currency-output .token-amount-input')
|
2020-06-08 17:50:27 +03:00
|
|
|
.type('0.0', { delay: 200 })
|
2020-05-15 00:12:59 +03:00
|
|
|
.should('have.value', '0.0')
|
2020-05-14 22:56:40 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can swap ETH for DAI', () => {
|
|
|
|
cy.get('#swap-currency-output .open-currency-select-button').click()
|
2020-05-23 19:06:16 +03:00
|
|
|
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 })
|
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')
|
2020-05-13 15:29:54 +03:00
|
|
|
})
|
2020-07-09 06:06:29 +03:00
|
|
|
|
|
|
|
it('add a recipient', () => {
|
|
|
|
cy.get('#add-recipient-button').click()
|
|
|
|
cy.get('#recipient').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('remove recipient', () => {
|
|
|
|
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
|
|
|
})
|